Skip to content

Commit

Permalink
fix(controller): Leader Lease Shared Name (argoproj#5214)
Browse files Browse the repository at this point in the history
Signed-off-by: Zach Aller <[email protected]>
  • Loading branch information
zachaller authored Feb 25, 2021
1 parent d83cf21 commit f0e8df0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion workflow/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,15 @@ func (wfc *WorkflowController) Run(ctx context.Context, wfWorkers, workflowTTLWo
}
logCtx := log.WithField("id", nodeID)

instanceID := "default-instance-id"
if wfc.Config.InstanceID != "" {
instanceID = wfc.Config.InstanceID
}

var cancel context.CancelFunc
go leaderelection.RunOrDie(ctx, leaderelection.LeaderElectionConfig{
Lock: &resourcelock.LeaseLock{
LeaseMeta: metav1.ObjectMeta{Name: "workflow-controller", Namespace: wfc.namespace}, Client: wfc.kubeclientset.CoordinationV1(),
LeaseMeta: metav1.ObjectMeta{Name: instanceID, 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 f0e8df0

Please sign in to comment.