From 2c06d0311d248544343993f20ff2d45a2bc84d5e Mon Sep 17 00:00:00 2001 From: Murphy Chen Date: Wed, 5 Jul 2023 16:50:25 +0800 Subject: [PATCH] fat: support config replicaCount (#555) * support config replicaCount * add helm check * apply reviewer's suggestion * add a checks.txt --- helm/tailing-sidecar-operator/templates/checks.txt | 4 ++++ helm/tailing-sidecar-operator/templates/resources.yaml | 2 +- helm/tailing-sidecar-operator/values.yaml | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 helm/tailing-sidecar-operator/templates/checks.txt diff --git a/helm/tailing-sidecar-operator/templates/checks.txt b/helm/tailing-sidecar-operator/templates/checks.txt new file mode 100644 index 00000000..b81b537c --- /dev/null +++ b/helm/tailing-sidecar-operator/templates/checks.txt @@ -0,0 +1,4 @@ +{{/* Check if leader election is set to true when replicaCount > 1 */}} +{{- if and (gt (.Values.operator.replicaCount | toString) "1") (not .Values.operator.leaderElection.enabled) }} +{{- fail "\nValues.operator.leaderElection should be set to true when replicaCount > 1" -}} +{{- end }} \ No newline at end of file diff --git a/helm/tailing-sidecar-operator/templates/resources.yaml b/helm/tailing-sidecar-operator/templates/resources.yaml index 5184211a..ddca7c2e 100644 --- a/helm/tailing-sidecar-operator/templates/resources.yaml +++ b/helm/tailing-sidecar-operator/templates/resources.yaml @@ -431,7 +431,7 @@ metadata: name: {{ include "tailing-sidecar-operator.fullname" . }} namespace: {{ .Release.Namespace }} spec: - replicas: 1 + replicas: {{ .Values.operator.replicaCount }} selector: matchLabels: {{- include "tailing-sidecar-operator.selectorLabels" . | nindent 6 }} diff --git a/helm/tailing-sidecar-operator/values.yaml b/helm/tailing-sidecar-operator/values.yaml index fe50f469..8819f4e5 100644 --- a/helm/tailing-sidecar-operator/values.yaml +++ b/helm/tailing-sidecar-operator/values.yaml @@ -23,6 +23,9 @@ operator: renewDeadline: "107s" retryPeriod: "26s" + # Number of sidecar operator Pods to run (requires enable leader election if replicaCount > 1) + replicaCount: 1 + livenessProbe: {} # initialDelaySeconds: 1 # periodSeconds: 20