From 90dceab16cc9bfdddd24e0879103a5953047f53f Mon Sep 17 00:00:00 2001 From: Paul de Nonancourt Date: Thu, 9 Feb 2023 17:55:20 +0100 Subject: [PATCH 1/6] Add volume management to Helm chart --- charts/ext-postgres-operator/Chart.yaml | 2 +- charts/ext-postgres-operator/templates/operator.yaml | 8 ++++++++ charts/ext-postgres-operator/values.yaml | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/charts/ext-postgres-operator/Chart.yaml b/charts/ext-postgres-operator/Chart.yaml index a43e231e..aded9bb2 100644 --- a/charts/ext-postgres-operator/Chart.yaml +++ b/charts/ext-postgres-operator/Chart.yaml @@ -7,7 +7,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.2.1 +version: 1.2.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/ext-postgres-operator/templates/operator.yaml b/charts/ext-postgres-operator/templates/operator.yaml index 1ea766b2..f9819b28 100644 --- a/charts/ext-postgres-operator/templates/operator.yaml +++ b/charts/ext-postgres-operator/templates/operator.yaml @@ -42,3 +42,11 @@ spec: fieldPath: metadata.name - name: OPERATOR_NAME value: {{ include "chart.fullname" . }} + {{- if .Values.volumeMounts }} + volumeMounts: + {{- toYaml .Values.volumeMounts | nindent 12 }} + {{- end }} + {{- if .Values.volumes }} + volumes: + {{- toYaml .Values.volumes | nindent 8 }} + {{- end }} diff --git a/charts/ext-postgres-operator/values.yaml b/charts/ext-postgres-operator/values.yaml index c2286321..603c225a 100644 --- a/charts/ext-postgres-operator/values.yaml +++ b/charts/ext-postgres-operator/values.yaml @@ -55,3 +55,7 @@ postgres: cloud_provider: "" # default database to use default_database: "postgres" + +volumes: [] + +volumeMounts: [] From f614cf306ea490c55b623045a9142d071bbabd15 Mon Sep 17 00:00:00 2001 From: Paul de Nonancourt Date: Thu, 9 Feb 2023 18:24:58 +0100 Subject: [PATCH 2/6] Add possibility to specifiy existing secret in Helm chart --- charts/ext-postgres-operator/templates/operator.yaml | 4 ++++ charts/ext-postgres-operator/templates/secret.yaml | 3 +++ charts/ext-postgres-operator/values.yaml | 2 ++ 3 files changed, 9 insertions(+) diff --git a/charts/ext-postgres-operator/templates/operator.yaml b/charts/ext-postgres-operator/templates/operator.yaml index f9819b28..2eaefbbe 100644 --- a/charts/ext-postgres-operator/templates/operator.yaml +++ b/charts/ext-postgres-operator/templates/operator.yaml @@ -32,7 +32,11 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} envFrom: - secretRef: + {{- if .Values.existingSecret }} + name: {{ .Values.existingSecret }} + {{- else }} name: {{ include "chart.fullname" . }} + {{- end }} env: - name: WATCH_NAMESPACE value: {{ .Values.watchNamespace | default "" }} diff --git a/charts/ext-postgres-operator/templates/secret.yaml b/charts/ext-postgres-operator/templates/secret.yaml index 0c416323..a245cbe4 100644 --- a/charts/ext-postgres-operator/templates/secret.yaml +++ b/charts/ext-postgres-operator/templates/secret.yaml @@ -1,3 +1,5 @@ +{{- if (not .Values.existingSecret) }} +--- apiVersion: v1 kind: Secret metadata: @@ -15,3 +17,4 @@ data: POSTGRES_URI_ARGS: {{ .Values.postgres.uri_args | b64enc | quote }} POSTGRES_CLOUD_PROVIDER: {{ .Values.postgres.cloud_provider | b64enc | quote }} POSTGRES_DEFAULT_DATABASE: {{ .Values.postgres.default_database | b64enc | quote }} +{{- end }} diff --git a/charts/ext-postgres-operator/values.yaml b/charts/ext-postgres-operator/values.yaml index 603c225a..57ba152b 100644 --- a/charts/ext-postgres-operator/values.yaml +++ b/charts/ext-postgres-operator/values.yaml @@ -59,3 +59,5 @@ postgres: volumes: [] volumeMounts: [] + +existingSecret: "" From 4830c80309b99d4cbccf34fb370c502346a5d405 Mon Sep 17 00:00:00 2001 From: Paul de Nonancourt Date: Mon, 13 Feb 2023 14:31:07 +0100 Subject: [PATCH 3/6] Add labels to pod in Helm chart --- charts/ext-postgres-operator/templates/operator.yaml | 1 + charts/ext-postgres-operator/values.yaml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/charts/ext-postgres-operator/templates/operator.yaml b/charts/ext-postgres-operator/templates/operator.yaml index 2eaefbbe..1ed0ee28 100644 --- a/charts/ext-postgres-operator/templates/operator.yaml +++ b/charts/ext-postgres-operator/templates/operator.yaml @@ -18,6 +18,7 @@ spec: {{- end }} labels: {{- include "chart.selectorLabels" . | nindent 8 }} + {{- toYaml .Values.podLabels | nindent 8 }} spec: serviceAccountName: {{ include "chart.serviceAccountName" . }} securityContext: diff --git a/charts/ext-postgres-operator/values.yaml b/charts/ext-postgres-operator/values.yaml index 57ba152b..fe5b435a 100644 --- a/charts/ext-postgres-operator/values.yaml +++ b/charts/ext-postgres-operator/values.yaml @@ -24,6 +24,8 @@ serviceAccount: podAnnotations: {} +podLabels: {} + podSecurityContext: {} # fsGroup: 2000 From 7034f4b84598da56fac2908f95abf22b97cb2c9e Mon Sep 17 00:00:00 2001 From: Paul de Nonancourt Date: Mon, 13 Feb 2023 14:50:09 +0100 Subject: [PATCH 4/6] Add env variables --- charts/ext-postgres-operator/templates/operator.yaml | 8 +++++++- charts/ext-postgres-operator/values.yaml | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/charts/ext-postgres-operator/templates/operator.yaml b/charts/ext-postgres-operator/templates/operator.yaml index 1ed0ee28..60b92038 100644 --- a/charts/ext-postgres-operator/templates/operator.yaml +++ b/charts/ext-postgres-operator/templates/operator.yaml @@ -18,7 +18,9 @@ spec: {{- end }} labels: {{- include "chart.selectorLabels" . | nindent 8 }} - {{- toYaml .Values.podLabels | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} spec: serviceAccountName: {{ include "chart.serviceAccountName" . }} securityContext: @@ -47,6 +49,10 @@ spec: fieldPath: metadata.name - name: OPERATOR_NAME value: {{ include "chart.fullname" . }} + {{- range $key, $value := .Values.env }} + - name: {{ $key }} + value: {{ $value }} + {{- end }} {{- if .Values.volumeMounts }} volumeMounts: {{- toYaml .Values.volumeMounts | nindent 12 }} diff --git a/charts/ext-postgres-operator/values.yaml b/charts/ext-postgres-operator/values.yaml index fe5b435a..08e9a443 100644 --- a/charts/ext-postgres-operator/values.yaml +++ b/charts/ext-postgres-operator/values.yaml @@ -63,3 +63,5 @@ volumes: [] volumeMounts: [] existingSecret: "" + +env: {} From 0fce755e4f703682bd835f0454c70839cce55bd0 Mon Sep 17 00:00:00 2001 From: Paul de Nonancourt Date: Mon, 13 Feb 2023 15:20:00 +0100 Subject: [PATCH 5/6] Add possibility to specify nodeSelector and tolerations in Helm chart --- charts/ext-postgres-operator/templates/operator.yaml | 4 ++++ charts/ext-postgres-operator/values.yaml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/charts/ext-postgres-operator/templates/operator.yaml b/charts/ext-postgres-operator/templates/operator.yaml index 60b92038..2c46ba34 100644 --- a/charts/ext-postgres-operator/templates/operator.yaml +++ b/charts/ext-postgres-operator/templates/operator.yaml @@ -61,3 +61,7 @@ spec: volumes: {{- toYaml .Values.volumes | nindent 8 }} {{- end }} + nodeSelector: + {{- toYaml .Values.nodeSelector | nindent 8 }} + tolerations: + {{- toYaml .Values.tolerations | nindent 8 }} diff --git a/charts/ext-postgres-operator/values.yaml b/charts/ext-postgres-operator/values.yaml index 08e9a443..50ed1be3 100644 --- a/charts/ext-postgres-operator/values.yaml +++ b/charts/ext-postgres-operator/values.yaml @@ -65,3 +65,7 @@ volumeMounts: [] existingSecret: "" env: {} + +nodeSelector: {} + +tolerations: [] From 57af77cebd27a11cadae3ea727025b13d3cf8e44 Mon Sep 17 00:00:00 2001 From: Paul de Nonancourt Date: Tue, 14 Feb 2023 15:28:51 +0100 Subject: [PATCH 6/6] Add documentation on new fields --- charts/ext-postgres-operator/values.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/charts/ext-postgres-operator/values.yaml b/charts/ext-postgres-operator/values.yaml index 50ed1be3..42bcadc3 100644 --- a/charts/ext-postgres-operator/values.yaml +++ b/charts/ext-postgres-operator/values.yaml @@ -24,6 +24,7 @@ serviceAccount: podAnnotations: {} +# Additionnal labels to add to the pod. podLabels: {} podSecurityContext: {} @@ -58,12 +59,17 @@ postgres: # default database to use default_database: "postgres" +# Volumes to add to the pod. volumes: [] +# Volumes to mount onto the pod. volumeMounts: [] +# Existing secret where values to connect to Postgres are defined. +# If not set a new secret will be created, filled with information under the postgres key above. existingSecret: "" +# Additionnal environment variables to add to the pod (map of key / value) env: {} nodeSelector: {}