Skip to content

Commit 1659685

Browse files
committed
Handle metrics server context cancellation as graceful shutdown.
1 parent 77d0b59 commit 1659685

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

cmd/machine-api-operator/start.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ func startMetricsCollectionAndServer(ctx *ControllerContext) {
246246

247247
go func() {
248248
if err := metricsServer.Start(metricsServerCtx); err != nil {
249+
if errors.Is(err, context.Canceled) {
250+
klog.V(2).Info("Secure metrics server shutdown complete")
251+
return
252+
}
249253
klog.Fatalf("Unable to start secure metrics server: %v", err)
250254
}
251255
}()

0 commit comments

Comments
 (0)