From 32eec75f511d257310cb8b9b1d374100b262adc3 Mon Sep 17 00:00:00 2001 From: Dan T <96055340+Dan0x54@users.noreply.github.com> Date: Mon, 28 Apr 2025 10:44:11 +0000 Subject: [PATCH 1/4] Added support for tolerations / affinity --- helm/install/templates/manager.yaml | 38 ++++++++++++++++------------- helm/install/values.yaml | 6 +++++ 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/helm/install/templates/manager.yaml b/helm/install/templates/manager.yaml index 2491d32c..9b001109 100644 --- a/helm/install/templates/manager.yaml +++ b/helm/install/templates/manager.yaml @@ -20,21 +20,25 @@ spec: {{ toYaml .Values.imagePullSecrets | indent 8 }} {{- end }} containers: - - name: operator - image: "{{ .Values.image.image }}" - env: - - name: CRUNCHY_DEBUG - value: {{ if eq .Values.debug false }}"false"{{- else }}"true"{{- end }} - {{- range $image_name, $image_val := .Values.relatedImages }} - - name: RELATED_IMAGE_{{ $image_name | upper }} - value: "{{ $image_val.image }}" - {{- end }} - {{- if .Values.singleNamespace }} - - name: PGO_TARGET_NAMESPACE - valueFrom: { fieldRef: { apiVersion: v1, fieldPath: metadata.namespace } } - {{- end }} - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsNonRoot: true + - name: operator + image: "{{ .Values.image.image }}" + env: + - name: CRUNCHY_DEBUG + value: {{ if eq .Values.debug false }}"false"{{- else }}"true"{{- end }} + {{- range $image_name, $image_val := .Values.relatedImages }} + - name: RELATED_IMAGE_{{ $image_name | upper }} + value: "{{ $image_val.image }}" + {{- end }} + {{- if .Values.singleNamespace }} + - name: PGO_TARGET_NAMESPACE + valueFrom: { fieldRef: { apiVersion: v1, fieldPath: metadata.namespace } } + {{- end }} + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + runAsNonRoot: true serviceAccount: {{ include "install.serviceAccountName" . }} + tolerations: + {{- toYaml .Values.tolerations | nindent 8 }} + affinity: + {{- toYaml .Values.affinity | nindent 8 }} diff --git a/helm/install/values.yaml b/helm/install/values.yaml index da8f9e94..40a41420 100644 --- a/helm/install/values.yaml +++ b/helm/install/values.yaml @@ -33,3 +33,9 @@ debug: true # **only for installation**. This is an array that uses the image pull secret # format, i.e. "name: value" imagePullSecrets: [] + +# tolerations allows you to define pod tolerations for the operator pods. +tolerations: [] + +# affinity allows you to define pod affinity and anti-affinity rules for the operator pods. +affinity: {} From 3476fc652a28ceb49932916ea1fdf04350b6a91d Mon Sep 17 00:00:00 2001 From: Dan T <96055340+Dan0x54@users.noreply.github.com> Date: Mon, 28 Apr 2025 10:47:44 +0000 Subject: [PATCH 2/4] gh-242 reset indenting --- helm/install/templates/manager.yaml | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/helm/install/templates/manager.yaml b/helm/install/templates/manager.yaml index 9b001109..6244bf07 100644 --- a/helm/install/templates/manager.yaml +++ b/helm/install/templates/manager.yaml @@ -20,23 +20,23 @@ spec: {{ toYaml .Values.imagePullSecrets | indent 8 }} {{- end }} containers: - - name: operator - image: "{{ .Values.image.image }}" - env: - - name: CRUNCHY_DEBUG - value: {{ if eq .Values.debug false }}"false"{{- else }}"true"{{- end }} - {{- range $image_name, $image_val := .Values.relatedImages }} - - name: RELATED_IMAGE_{{ $image_name | upper }} - value: "{{ $image_val.image }}" - {{- end }} - {{- if .Values.singleNamespace }} - - name: PGO_TARGET_NAMESPACE - valueFrom: { fieldRef: { apiVersion: v1, fieldPath: metadata.namespace } } - {{- end }} - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsNonRoot: true + - name: operator + image: "{{ .Values.image.image }}" + env: + - name: CRUNCHY_DEBUG + value: {{ if eq .Values.debug false }}"false"{{- else }}"true"{{- end }} + {{- range $image_name, $image_val := .Values.relatedImages }} + - name: RELATED_IMAGE_{{ $image_name | upper }} + value: "{{ $image_val.image }}" + {{- end }} + {{- if .Values.singleNamespace }} + - name: PGO_TARGET_NAMESPACE + valueFrom: { fieldRef: { apiVersion: v1, fieldPath: metadata.namespace } } + {{- end }} + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + runAsNonRoot: true serviceAccount: {{ include "install.serviceAccountName" . }} tolerations: {{- toYaml .Values.tolerations | nindent 8 }} From 82ea6a5a2ce09c42bf72d200e8bedee0b87308f1 Mon Sep 17 00:00:00 2001 From: Dan T <96055340+Dan0x54@users.noreply.github.com> Date: Mon, 28 Apr 2025 10:56:49 +0000 Subject: [PATCH 3/4] Removed unrelated code --- helm/install/values.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/helm/install/values.yaml b/helm/install/values.yaml index 25264af6..a66d1efd 100644 --- a/helm/install/values.yaml +++ b/helm/install/values.yaml @@ -39,11 +39,6 @@ singleNamespace: false # debug allows you to enable or disable the "debug" level of logging. debug: true -# imagePullSecrets defines any image pull secrets to use -# **only for installation**. This is an array that uses the image pull secret -# format, i.e. "name: value" -imagePullSecrets: [] - # pgoControllerLeaseName sets the name of the Lease that holds the Leader Election # Lock, thereby enabling High Availability for the Operator. If this is unset, # Leader Election will be turned off. To utilize the Leader Election and make PGO From 0c07279b45a82d65f3995195ebadfa47f4b8599d Mon Sep 17 00:00:00 2001 From: Dan T <96055340+Dan0x54@users.noreply.github.com> Date: Tue, 6 May 2025 08:55:10 +0100 Subject: [PATCH 4/4] Added flow control --- helm/install/templates/manager.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/helm/install/templates/manager.yaml b/helm/install/templates/manager.yaml index 73cb57cb..7e7066fc 100644 --- a/helm/install/templates/manager.yaml +++ b/helm/install/templates/manager.yaml @@ -64,7 +64,11 @@ spec: port: 8081 initialDelaySeconds: 5 periodSeconds: 10 + {{- if .Values.tolerations }} tolerations: {{- toYaml .Values.tolerations | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} affinity: {{- toYaml .Values.affinity | nindent 8 }} + {{- end }}