Skip to content

Commit 08d9de8

Browse files
committed
Improve Leader Election Hand Off
This commit introduces a couple of changes to the package server manager to improve hand off between running pods during an upgrade or redeployment. 1. The package server manager will now voluntarily release its lease on manager exit which will speed up voluntary leader transition as the new leader shouldn't have to wait the LeaseDuration time before taking over. I should note that enabling this setting expects that the binary will immediately exit upon release. 2. The package server manager deployment has had its .strategy.type field updated from Rolling to Recreate, which will prevent the new pod from attempting to acquire the lease before the current leader has shutdown and released its lease. Signed-off-by: Alexander Greene <[email protected]>
1 parent e98b8f0 commit 08d9de8

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

cmd/package-server-manager/main.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,18 @@ func run(cmd *cobra.Command, args []string) error {
8080

8181
packageserverCSVFields := fields.Set{"metadata.name": name}
8282
mgr, err := ctrl.NewManager(restConfig, manager.Options{
83-
Scheme: setupScheme(),
84-
Namespace: namespace,
85-
MetricsBindAddress: metricsAddr,
86-
LeaderElection: !disableLeaderElection,
87-
LeaderElectionNamespace: namespace,
88-
LeaderElectionID: leaderElectionConfigmapName,
89-
LeaseDuration: &le.LeaseDuration.Duration,
90-
RenewDeadline: &le.RenewDeadline.Duration,
91-
RetryPeriod: &le.RetryPeriod.Duration,
92-
HealthProbeBindAddress: healthCheckAddr,
93-
PprofBindAddress: pprofAddr,
83+
Scheme: setupScheme(),
84+
Namespace: namespace,
85+
MetricsBindAddress: metricsAddr,
86+
LeaderElection: !disableLeaderElection,
87+
LeaderElectionNamespace: namespace,
88+
LeaderElectionID: leaderElectionConfigmapName,
89+
LeaseDuration: &le.LeaseDuration.Duration,
90+
RenewDeadline: &le.RenewDeadline.Duration,
91+
RetryPeriod: &le.RetryPeriod.Duration,
92+
HealthProbeBindAddress: healthCheckAddr,
93+
PprofBindAddress: pprofAddr,
94+
LeaderElectionReleaseOnCancel: true,
9495
Cache: cache.Options{
9596
ByObject: map[client.Object]cache.ByObject{
9697
&olmv1alpha1.ClusterServiceVersion{}: {

manifests/0000_50_olm_06-psm-operator.deployment.ibm-cloud-managed.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ metadata:
99
include.release.openshift.io/ibm-cloud-managed: "true"
1010
spec:
1111
strategy:
12-
type: RollingUpdate
12+
type: Recreate
1313
replicas: 1
1414
selector:
1515
matchLabels:

manifests/0000_50_olm_06-psm-operator.deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ metadata:
99
include.release.openshift.io/self-managed-high-availability: "true"
1010
spec:
1111
strategy:
12-
type: RollingUpdate
12+
type: Recreate
1313
replicas: 1
1414
selector:
1515
matchLabels:

scripts/generate_crds_manifests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ metadata:
123123
annotations:
124124
spec:
125125
strategy:
126-
type: RollingUpdate
126+
type: Recreate
127127
replicas: 1
128128
selector:
129129
matchLabels:

0 commit comments

Comments
 (0)