Skip to content

Commit

Permalink
Fix operator leader election
Browse files Browse the repository at this point in the history
  • Loading branch information
astefanutti authored and lburgazzoli committed Feb 13, 2019
1 parent b9751f1 commit 3d1705e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ func main() {
}

// Become the leader before proceeding
leader.Become(context.TODO(), "camel-k-lock") // nolint: errcheck
err = leader.Become(context.TODO(), "camel-k-lock")
if err != nil {
log.Error(err, "")
os.Exit(1)
}

r := ready.NewFileReady()
err = r.Set()
Expand Down
4 changes: 4 additions & 0 deletions deploy/operator-deployment-kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ spec:
fieldPath: metadata.namespace
- name: OPERATOR_NAME
value: "camel-k"
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- mountPath: /workspace
name: camel-k-builder
Expand Down
4 changes: 4 additions & 0 deletions deploy/operator-deployment-openshift.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ spec:
fieldPath: metadata.namespace
- name: OPERATOR_NAME
value: "camel-k"
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name

0 comments on commit 3d1705e

Please sign in to comment.