Skip to content

Commit 72fb349

Browse files
committed
refactor: addition of root ctx to main
1 parent 4d2c3ee commit 72fb349

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmd/kar-controllers/main.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636

3737
"github.com/project-codeflare/multi-cluster-app-dispatcher/cmd/kar-controllers/app"
3838
"github.com/project-codeflare/multi-cluster-app-dispatcher/cmd/kar-controllers/app/options"
39+
"k8s.io/apiserver/pkg/server"
3940

4041
"os"
4142
)
@@ -49,8 +50,15 @@ func main() {
4950
// flag.InitFlags()
5051
s.CheckOptionOrDie()
5152

52-
if err := app.Run(s); err != nil {
53+
ctx := server.SetupSignalContext()
54+
55+
// Run the server
56+
if err := app.Run(ctx, s); err != nil {
5357
fmt.Fprintf(os.Stderr, "%v\n", err)
5458
os.Exit(1)
5559
}
60+
61+
<-ctx.Done()
62+
fmt.Println("Shutting down gracefully")
63+
5664
}

0 commit comments

Comments
 (0)