Skip to content

Commit

Permalink
fix(controller): Leader lease shared name improvments (#5218)
Browse files Browse the repository at this point in the history
Signed-off-by: Zach Aller <[email protected]>
  • Loading branch information
zachaller authored Feb 26, 2021
1 parent 2d2fba3 commit d7dc48c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions workflow/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ func (wfc *WorkflowController) Run(ctx context.Context, wfWorkers, workflowTTLWo
}
logCtx := log.WithField("id", nodeID)

instanceID := "default-instance-id"
leaderName := "workflow-controller"
if wfc.Config.InstanceID != "" {
instanceID = wfc.Config.InstanceID
leaderName = fmt.Sprintf("%s-%s", leaderName, wfc.Config.InstanceID)
}

var cancel context.CancelFunc
go leaderelection.RunOrDie(ctx, leaderelection.LeaderElectionConfig{
Lock: &resourcelock.LeaseLock{
LeaseMeta: metav1.ObjectMeta{Name: instanceID, Namespace: wfc.namespace}, Client: wfc.kubeclientset.CoordinationV1(),
LeaseMeta: metav1.ObjectMeta{Name: leaderName, Namespace: wfc.namespace}, Client: wfc.kubeclientset.CoordinationV1(),
LockConfig: resourcelock.ResourceLockConfig{Identity: nodeID, EventRecorder: wfc.eventRecorderManager.Get(wfc.namespace)},
},
ReleaseOnCancel: true,
Expand Down

0 comments on commit d7dc48c

Please sign in to comment.