diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index f5b4c359..2ef3eced 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -24,6 +24,12 @@ rules: - secrets verbs: - '*' +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - '*' - apiGroups: - garo.tietoevry.com resources: diff --git a/controllers/githubactionrunner_controller.go b/controllers/githubactionrunner_controller.go index 48cca993..c00cb025 100644 --- a/controllers/githubactionrunner_controller.go +++ b/controllers/githubactionrunner_controller.go @@ -73,6 +73,7 @@ func (r *GithubActionRunnerReconciler) IsValid(obj metav1.Object) (bool, error) // +kubebuilder:rbac:groups="",resources=pods,verbs="*" // +kubebuilder:rbac:groups="",resources=secrets,verbs="*" // +kubebuilder:rbac:groups="",resources=events,verbs=create;patch +// +kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs="*" // Reconcile is the main loop implementing the controller action func (r *GithubActionRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { diff --git a/main.go b/main.go index 56828afd..fd72354f 100644 --- a/main.go +++ b/main.go @@ -72,7 +72,7 @@ func main() { Namespace: namespace, LeaderElection: enableLeaderElection, LeaderElectionID: "4ef9cd91.tietoevry.com", - LeaderElectionResourceLock: "configmaps", + LeaderElectionResourceLock: "configmapsleases", } if strings.Contains(namespace, ",") { options.Namespace = ""