diff --git a/cluster-autoscaler/main.go b/cluster-autoscaler/main.go index 304bbedd6300..d2f0ab00a569 100644 --- a/cluster-autoscaler/main.go +++ b/cluster-autoscaler/main.go @@ -434,10 +434,11 @@ func main() { } leaderelection.RunOrDie(ctx.TODO(), leaderelection.LeaderElectionConfig{ - Lock: lock, - LeaseDuration: leaderElection.LeaseDuration.Duration, - RenewDeadline: leaderElection.RenewDeadline.Duration, - RetryPeriod: leaderElection.RetryPeriod.Duration, + Lock: lock, + LeaseDuration: leaderElection.LeaseDuration.Duration, + RenewDeadline: leaderElection.RenewDeadline.Duration, + RetryPeriod: leaderElection.RetryPeriod.Duration, + ReleaseOnCancel: true, Callbacks: leaderelection.LeaderCallbacks{ OnStartedLeading: func(_ ctx.Context) { // Since we are committing a suicide after losing