-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (28 loc) · 812 Bytes
/
main.go
File metadata and controls
34 lines (28 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
sentinel - A Kubernetes controller that tracks container images across workloads
*/
package main
import (
"os"
"os/signal"
"syscall"
sentinel "github.com/MatteoMori/sentinel/cmd/sentinel"
)
func main() {
// Set up channel to listen for interrupt or terminate signals for graceful shutdown
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
// Run sentinel.Execute in a goroutine so we can listen for signals concurrently
done := make(chan struct{})
go func() {
sentinel.Execute() // Execute the root CLI command (./cmd/sentinel/root.go)
close(done)
}()
select {
case <-sigs:
// Handle graceful shutdown here if needed
// For example, we could call a shutdown function in sentinel package
case <-done:
// sentinel.Execute finished execution
}
}