From 8438d1e76a44a285c891affafa07deb90997f156 Mon Sep 17 00:00:00 2001 From: Artem Yasynskyi Date: Thu, 7 Nov 2024 12:26:07 +0000 Subject: [PATCH] fix: Allow leader election for scheduler-plugins-controller --- .../charts/as-a-second-scheduler/templates/deployment.yaml | 4 ++++ .../install/charts/as-a-second-scheduler/templates/rbac.yaml | 3 +++ manifests/install/charts/as-a-second-scheduler/values.yaml | 1 + 3 files changed, 8 insertions(+) diff --git a/manifests/install/charts/as-a-second-scheduler/templates/deployment.yaml b/manifests/install/charts/as-a-second-scheduler/templates/deployment.yaml index 067393ac3..e926f9f2b 100644 --- a/manifests/install/charts/as-a-second-scheduler/templates/deployment.yaml +++ b/manifests/install/charts/as-a-second-scheduler/templates/deployment.yaml @@ -21,6 +21,10 @@ spec: serviceAccountName: {{ .Values.controller.name }} containers: - name: scheduler-plugins-controller + args: + {{- if .Values.controller.leaderElect }} + - --enableLeaderElection + {{- end }} image: {{ .Values.controller.image }} imagePullPolicy: IfNotPresent {{- with .Values.controller.resources }} diff --git a/manifests/install/charts/as-a-second-scheduler/templates/rbac.yaml b/manifests/install/charts/as-a-second-scheduler/templates/rbac.yaml index 9025fa601..e01682dbc 100644 --- a/manifests/install/charts/as-a-second-scheduler/templates/rbac.yaml +++ b/manifests/install/charts/as-a-second-scheduler/templates/rbac.yaml @@ -104,6 +104,9 @@ rules: - apiGroups: [""] resources: ["events"] verbs: ["create", "patch", "update"] +- apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["create", "get", "update"] - apiGroups: [""] resources: ["nodes"] verbs: ["get", "list", "watch", "patch"] diff --git a/manifests/install/charts/as-a-second-scheduler/values.yaml b/manifests/install/charts/as-a-second-scheduler/values.yaml index 4b036c256..5f5531d1c 100644 --- a/manifests/install/charts/as-a-second-scheduler/values.yaml +++ b/manifests/install/charts/as-a-second-scheduler/values.yaml @@ -19,6 +19,7 @@ controller: name: scheduler-plugins-controller image: registry.k8s.io/scheduler-plugins/controller:v0.30.6 replicaCount: 1 + leaderElect: false priorityClassName: "" resources: {} nodeSelector: {}