From d1d73963fa22edf397052a535afa3a13457fa0d8 Mon Sep 17 00:00:00 2001 From: Alejandro Ruiz Date: Thu, 30 Nov 2023 16:56:04 +0100 Subject: [PATCH] Make leader election configurable via chart values and change defaults --- charts/fleet/templates/deployment.yaml | 36 ++++++++++++++++++++++++++ charts/fleet/values.yaml | 6 +++++ 2 files changed, 42 insertions(+) diff --git a/charts/fleet/templates/deployment.yaml b/charts/fleet/templates/deployment.yaml index 53a371c068..b31a1d6ddd 100644 --- a/charts/fleet/templates/deployment.yaml +++ b/charts/fleet/templates/deployment.yaml @@ -39,6 +39,18 @@ spec: - name: FLEET_CPU_PPROF_PERIOD value: {{ quote .Values.cpuPprof.period }} {{- end }} + {{- if .Values.leaderElection.leaseDuration }} + - name: CATTLE_ELECTION_LEASE_DURATION + value: {{.Values.leaderElection.leaseDuration}} + {{- end }} + {{- if .Values.leaderElection.retryPeriod }} + - name: CATTLE_ELECTION_RETRY_PERIOD + value: {{.Values.leaderElection.retryPeriod}} + {{- end }} + {{- if .Values.leaderElection.renewDeadline }} + - name: CATTLE_ELECTION_RENEW_DEADLINE + value: {{.Values.leaderElection.renewDeadline}} + {{- end }} {{- if .Values.debug }} - name: CATTLE_DEV_MODE value: "true" @@ -80,6 +92,18 @@ spec: - name: CATTLE_DEV_MODE value: "true" {{- end }} + {{- if .Values.leaderElection.leaseDuration }} + - name: CATTLE_ELECTION_LEASE_DURATION + value: {{.Values.leaderElection.leaseDuration}} + {{- end }} + {{- if .Values.leaderElection.retryPeriod }} + - name: CATTLE_ELECTION_RETRY_PERIOD + value: {{.Values.leaderElection.retryPeriod}} + {{- end }} + {{- if .Values.leaderElection.renewDeadline }} + - name: CATTLE_ELECTION_RENEW_DEADLINE + value: {{.Values.leaderElection.renewDeadline}} + {{- end }} image: '{{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}' name: fleet-cleanup imagePullPolicy: "{{ .Values.image.imagePullPolicy }}" @@ -108,6 +132,18 @@ spec: - name: CATTLE_DEV_MODE value: "true" {{- end }} + {{- if .Values.leaderElection.leaseDuration }} + - name: CATTLE_ELECTION_LEASE_DURATION + value: {{.Values.leaderElection.leaseDuration}} + {{- end }} + {{- if .Values.leaderElection.retryPeriod }} + - name: CATTLE_ELECTION_RETRY_PERIOD + value: {{.Values.leaderElection.retryPeriod}} + {{- end }} + {{- if .Values.leaderElection.renewDeadline }} + - name: CATTLE_ELECTION_RENEW_DEADLINE + value: {{.Values.leaderElection.renewDeadline}} + {{- end }} image: '{{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}' name: fleet-agentmanagement imagePullPolicy: "{{ .Values.image.imagePullPolicy }}" diff --git a/charts/fleet/values.yaml b/charts/fleet/values.yaml index 8c3a9c596c..e360407915 100644 --- a/charts/fleet/values.yaml +++ b/charts/fleet/values.yaml @@ -81,3 +81,9 @@ propagateDebugSettingsToAgents: true migrations: clusterRegistrationCleanup: true + +## Leader election configuration +leaderElection: + leaseDuration: 30s + retryPeriod: 10s + renewDeadline: 25s