Skip to content

Commit

Permalink
Gateway provisioner: release leader election on shutdown (#5377)
Browse files Browse the repository at this point in the history
This matches behavior for the `contour serve`
command and enables upgrades/restarts to happen
faster.

Signed-off-by: Steve Kriss <krisss@vmware.com>
  • Loading branch information
skriss authored May 18, 2023
1 parent 0b4a8b8 commit 020d782
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cmd/contour/gatewayprovisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ func createManager(restConfig *rest.Config, provisionerConfig *gatewayProvisione
}

mgr, err := ctrl.NewManager(restConfig, manager.Options{
Scheme: scheme,
LeaderElection: provisionerConfig.leaderElection,
LeaderElectionResourceLock: "leases",
LeaderElectionID: provisionerConfig.leaderElectionID,
LeaderElectionNamespace: provisionerConfig.leaderElectionNamespace,
MetricsBindAddress: provisionerConfig.metricsBindAddress,
Logger: ctrl.Log.WithName("contour-gateway-provisioner"),
Scheme: scheme,
LeaderElection: provisionerConfig.leaderElection,
LeaderElectionResourceLock: "leases",
LeaderElectionID: provisionerConfig.leaderElectionID,
LeaderElectionNamespace: provisionerConfig.leaderElectionNamespace,
LeaderElectionReleaseOnCancel: true,
MetricsBindAddress: provisionerConfig.metricsBindAddress,
Logger: ctrl.Log.WithName("contour-gateway-provisioner"),
})
if err != nil {
return nil, fmt.Errorf("failed to create manager: %w", err)
Expand Down

0 comments on commit 020d782

Please sign in to comment.