From e6b9db38623cbb9369fed3cbca72daede50e9a16 Mon Sep 17 00:00:00 2001 From: Jakub Jarosz <99677300+jjngx@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:20:18 +0100 Subject: [PATCH] Create unique lease obj for each NIC installed via Helm (#6372) --- .../nginx-ingress/templates/controller-lease.yaml | 13 +++++++++++++ charts/nginx-ingress/templates/controller-role.yaml | 2 +- charts/nginx-ingress/values.yaml | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 charts/nginx-ingress/templates/controller-lease.yaml diff --git a/charts/nginx-ingress/templates/controller-lease.yaml b/charts/nginx-ingress/templates/controller-lease.yaml new file mode 100644 index 0000000000..960f61cea0 --- /dev/null +++ b/charts/nginx-ingress/templates/controller-lease.yaml @@ -0,0 +1,13 @@ +{{ if .Values.controller.reportIngressStatus.enableLeaderElection }} +apiVersion: coordination.k8s.io/v1 +kind: Lease +metadata: + name: {{ include "nginx-ingress.leaderElectionName" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "nginx-ingress.labels" . | nindent 4 }} +{{- if .Values.controller.reportIngressStatus.annotations }} + annotations +{{ toYaml .Values.controller.reportIngressStatus.annotations | indent 4 }} +{{- end }} +{{- end }} diff --git a/charts/nginx-ingress/templates/controller-role.yaml b/charts/nginx-ingress/templates/controller-role.yaml index e902381775..cb75d99cc3 100644 --- a/charts/nginx-ingress/templates/controller-role.yaml +++ b/charts/nginx-ingress/templates/controller-role.yaml @@ -43,7 +43,7 @@ rules: resources: - leases resourceNames: - - {{ .Values.controller.reportIngressStatus.leaderElectionLockName }} + - {{ include "nginx-ingress.leaderElectionName" . }} verbs: - get - update diff --git a/charts/nginx-ingress/values.yaml b/charts/nginx-ingress/values.yaml index 002102bfb1..ebece1f3a6 100644 --- a/charts/nginx-ingress/values.yaml +++ b/charts/nginx-ingress/values.yaml @@ -496,7 +496,8 @@ controller: enableLeaderElection: true ## Specifies the name to be used as the lock for leader election. controller.reportIngressStatus.enableLeaderElection must be set to true. - leaderElectionLockName: "nginx-ingress-leader" + ## The default is autogenerated. + leaderElectionLockName: "" ## The annotations of the leader election configmap. annotations: {}