Skip to content

Commit c7fe20d

Browse files
authored
Migrate away from configmaps as leader-eletion mechanism (#488)
1 parent a7f1cdf commit c7fe20d

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

config/rbac/role.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ rules:
2424
- secrets
2525
verbs:
2626
- '*'
27+
- apiGroups:
28+
- coordination.k8s.io
29+
resources:
30+
- leases
31+
verbs:
32+
- '*'
2733
- apiGroups:
2834
- garo.tietoevry.com
2935
resources:

controllers/githubactionrunner_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func (r *GithubActionRunnerReconciler) IsValid(obj metav1.Object) (bool, error)
7373
// +kubebuilder:rbac:groups="",resources=pods,verbs="*"
7474
// +kubebuilder:rbac:groups="",resources=secrets,verbs="*"
7575
// +kubebuilder:rbac:groups="",resources=events,verbs=create;patch
76+
// +kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs="*"
7677

7778
// Reconcile is the main loop implementing the controller action
7879
func (r *GithubActionRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func main() {
7272
Namespace: namespace,
7373
LeaderElection: enableLeaderElection,
7474
LeaderElectionID: "4ef9cd91.tietoevry.com",
75-
LeaderElectionResourceLock: "configmaps",
75+
LeaderElectionResourceLock: "configmapsleases",
7676
}
7777
if strings.Contains(namespace, ",") {
7878
options.Namespace = ""

0 commit comments

Comments
 (0)