Skip to content

Commit 11d2b4d

Browse files
authored
Merge pull request kubernetes#128340 from googs1025/automated-cherry-pick-of-#127834-upstream-release-1.31
Automated cherry pick of kubernetes#127834: fix(leaderelection): nil check in OnStoppedLeading func
2 parents f7d6fad + c94baac commit 11d2b4d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/controlplane/controller/leaderelection/run_with_leaderelection.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ func RunWithLeaderElection(ctx context.Context, config *rest.Config, newRunnerFn
5050
run(ctx, 1)
5151
},
5252
OnStoppedLeading: func() {
53-
cancel()
53+
if cancel != nil {
54+
cancel()
55+
}
5456
},
5557
}
5658

0 commit comments

Comments
 (0)