Skip to content

Commit 06abb06

Browse files
committed
WCC cleanup function
1 parent 56a4333 commit 06abb06

File tree

1 file changed

+9
-0
lines changed
  • components/node-labeler/cmd

1 file changed

+9
-0
lines changed

components/node-labeler/cmd/run.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
"sigs.k8s.io/controller-runtime/pkg/controller"
3535
"sigs.k8s.io/controller-runtime/pkg/event"
3636
"sigs.k8s.io/controller-runtime/pkg/healthz"
37+
"sigs.k8s.io/controller-runtime/pkg/manager"
3738
"sigs.k8s.io/controller-runtime/pkg/metrics"
3839
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
3940
"sigs.k8s.io/controller-runtime/pkg/predicate"
@@ -132,6 +133,14 @@ var runCmd = &cobra.Command{
132133
log.WithError(err).Fatal("unable to bind workspace count controller")
133134
}
134135

136+
err = mgr.Add(manager.RunnableFunc(func(context.Context) error {
137+
wc.Stop()
138+
return nil
139+
}))
140+
if err != nil {
141+
log.WithError(err).Fatal("couldn't properly clean up WorkspaceCountController")
142+
}
143+
135144
metrics.Registry.MustRegister(NodeLabelerCounterVec)
136145
metrics.Registry.MustRegister(NodeLabelerTimeHistVec)
137146

0 commit comments

Comments
 (0)