From 84b2ec2215807f522a6069fc12da519b2fe75ffd Mon Sep 17 00:00:00 2001 From: Igor Soares Date: Wed, 19 Feb 2025 09:26:17 -0300 Subject: [PATCH 1/2] Include more template options for helm and source controllers Options added to the helm-controller deployment: * readinessProbe.timeoutSeconds * livenessProbe.timeoutSeconds * terminationGracePeriodSeconds Options added to the source-controller deployment: * readinessProbe.timeoutSeconds * livenessProbe.timeoutSeconds Added as a global option and included in both controllers: * logEncoding In addition, the container.additionalArgs option was modified to allow output redirection for both controllers. Signed-off-by: Igor Soares --- charts/flux2/templates/helm-controller.yaml | 25 +++++++------------ charts/flux2/templates/source-controller.yaml | 21 ++++++---------- 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/charts/flux2/templates/helm-controller.yaml b/charts/flux2/templates/helm-controller.yaml index 0811c15..85c4c15 100644 --- a/charts/flux2/templates/helm-controller.yaml +++ b/charts/flux2/templates/helm-controller.yaml @@ -38,21 +38,8 @@ spec: {{- toYaml .Values.helmController.initContainers | nindent 8}} {{- end}} containers: - - args: - {{- if .Values.multitenancy.enabled }} - - --no-cross-namespace-refs=true - - --default-service-account={{ .Values.multitenancy.defaultServiceAccount | default "default" }} - {{- end}} - {{- if .Values.notificationController.create }} - - --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.{{ .Values.clusterDomain | default "cluster.local" }}. - {{- end}} - - --watch-all-namespaces={{ .Values.watchAllNamespaces }} - - --log-level={{ .Values.logLevel | default "info" }} - - --log-encoding=json - - --enable-leader-election - {{- range .Values.helmController.container.additionalArgs }} - - {{ . }} - {{- end}} + - command: ["/bin/sh"] + args: ["-c", "helm-controller {{- if .Values.multitenancy.enabled }} --no-cross-namespace-refs=true --default-service-account={{ .Values.multitenancy.defaultServiceAccount | default "default" }} {{- end}} {{- if .Values.notificationController.create }} --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.{{ .Values.clusterDomain | default "cluster.local" }}. {{- end}} --watch-all-namespaces={{ .Values.watchAllNamespaces }} --log-level={{ .Values.logLevel | default "info" }} --log-encoding={{ .Values.logEncoding | default "json" }} --enable-leader-election {{ .Values.helmController.container.additionalArgs }}"] env: - name: RUNTIME_NAMESPACE valueFrom: @@ -71,6 +58,9 @@ spec: httpGet: path: /healthz port: healthz + {{- if and .Values.helmController.livenessProbe .Values.helmController.livenessProbe.timeoutSeconds }} + timeoutSeconds: {{ .Values.helmController.livenessProbe.timeoutSeconds }} + {{- end }} name: manager ports: - containerPort: 8080 @@ -82,6 +72,9 @@ spec: httpGet: path: /readyz port: healthz + {{- if and .Values.helmController.readinessProbe .Values.helmController.readinessProbe.timeoutSeconds }} + timeoutSeconds: {{ .Values.helmController.readinessProbe.timeoutSeconds }} + {{- end }} {{- with .Values.helmController.resources }} resources: {{ toYaml . | nindent 10 }} {{- end }} @@ -114,7 +107,7 @@ spec: {{- if .Values.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.imagePullSecrets | nindent 6 }} {{- end }} - terminationGracePeriodSeconds: 600 + terminationGracePeriodSeconds: {{ .Values.helmController.terminationGracePeriodSeconds | default 600 }} volumes: - emptyDir: {} name: temp diff --git a/charts/flux2/templates/source-controller.yaml b/charts/flux2/templates/source-controller.yaml index 46c7cfe..2bd2eea 100644 --- a/charts/flux2/templates/source-controller.yaml +++ b/charts/flux2/templates/source-controller.yaml @@ -36,19 +36,8 @@ spec: {{- toYaml .Values.sourceController.initContainers | nindent 8}} {{- end}} containers: - - args: - {{- if .Values.notificationController.create }} - - --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.{{ .Values.clusterDomain | default "cluster.local" }}. - {{- end}} - - --watch-all-namespaces={{ .Values.watchAllNamespaces }} - - --log-level={{ .Values.logLevel | default "info" }} - - --log-encoding=json - - --enable-leader-election - - --storage-path=/data - - --storage-adv-addr=source-controller.$(RUNTIME_NAMESPACE).svc.{{ .Values.clusterDomain | default "cluster.local" }}. - {{- range .Values.sourceController.container.additionalArgs }} - - {{ . }} - {{- end}} + - command: ["/bin/sh"] + args: ["-c", "source-controller {{- if .Values.notificationController.create }} --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.{{ .Values.clusterDomain | default "cluster.local" }}. {{- end}} --watch-all-namespaces={{ .Values.watchAllNamespaces }} --log-level={{ .Values.logLevel | default "info" }} --log-encoding={{ .Values.logEncoding | default "json" }} --enable-leader-election --storage-path=/data --storage-adv-addr=source-controller.$(RUNTIME_NAMESPACE).svc.{{ .Values.clusterDomain | default "cluster.local" }}. {{ .Values.sourceController.container.additionalArgs }}"] env: - name: RUNTIME_NAMESPACE valueFrom: @@ -67,6 +56,9 @@ spec: httpGet: path: /healthz port: healthz + {{- if and .Values.sourceController.livenessProbe .Values.sourceController.livenessProbe.timeoutSeconds }} + timeoutSeconds: {{ .Values.sourceController.livenessProbe.timeoutSeconds }} + {{- end }} name: manager ports: - containerPort: 9090 @@ -82,6 +74,9 @@ spec: httpGet: path: / port: http + {{- if and .Values.sourceController.readinessProbe .Values.sourceController.readinessProbe.timeoutSeconds }} + timeoutSeconds: {{ .Values.sourceController.readinessProbe.timeoutSeconds }} + {{- end }} {{- with .Values.sourceController.resources }} resources: {{ toYaml . | nindent 10 }} {{- end }} -- 2.34.1