diff --git a/helm/install/templates/_helpers.tpl b/helm/install/templates/_helpers.tpl index 9cd9b55d..83467e27 100644 --- a/helm/install/templates/_helpers.tpl +++ b/helm/install/templates/_helpers.tpl @@ -98,3 +98,37 @@ imagePullSecrets: value: {{ $object.image | quote }} {{- end }} {{- end }} + + +{{- define "install.defaultEnv" -}} +- name: CRUNCHY_DEBUG + value: {{ .Values.debug | ne false | quote }} +- name: PGO_NAMESPACE + valueFrom: { fieldRef: { apiVersion: v1, fieldPath: metadata.namespace } } +{{- if .Values.singleNamespace }} +- name: PGO_TARGET_NAMESPACE + valueFrom: { fieldRef: { apiVersion: v1, fieldPath: metadata.namespace } } +{{- end }} +{{- if .Values.workers }} +- name: PGO_WORKERS + value: {{ .Values.workers | quote }} +{{- end }} +{{- include "install.relatedImages" . }} +{{- if .Values.disable_check_for_upgrades }} +- name: CHECK_FOR_UPGRADES + value: "false" +{{- end }} +{{- if .Values.features }} +{{- $value := .Values.features }} +- name: PGO_FEATURE_GATES +{{- $out := "" -}} +{{- if eq (kindOf $value) "map" -}} +{{- range $key, $val := $value -}} + {{- $out = (print $out $key "=" $val ",") -}} +{{- end }} +{{- end }} + value: "{{ trimSuffix "," $out }}" +{{- end }} +{{- end }}{{/* define */}} + + diff --git a/helm/install/templates/manager.yaml b/helm/install/templates/manager.yaml index 5052e9ea..b352e7c2 100644 --- a/helm/install/templates/manager.yaml +++ b/helm/install/templates/manager.yaml @@ -24,22 +24,13 @@ spec: - name: operator image: {{ required ".Values.controllerImages.cluster is required" .Values.controllerImages.cluster | quote }} env: - - name: CRUNCHY_DEBUG - value: {{ .Values.debug | ne false | quote }} - - name: PGO_NAMESPACE - valueFrom: { fieldRef: { apiVersion: v1, fieldPath: metadata.namespace } } - {{- if .Values.singleNamespace }} - - name: PGO_TARGET_NAMESPACE - valueFrom: { fieldRef: { apiVersion: v1, fieldPath: metadata.namespace } } + {{- if .Values.envOverride }} + {{- toYaml .Values.envOverride | nindent 10 }} + {{- else -}} + {{- include "install.defaultEnv" . | nindent 10 }} {{- end }} - {{- if .Values.workers }} - - name: PGO_WORKERS - value: {{ .Values.workers | quote }} - {{- end }} - {{- include "install.relatedImages" . | indent 8 }} - {{- if .Values.disable_check_for_upgrades }} - - name: CHECK_FOR_UPGRADES - value: "false" + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 10 }} {{- end }} {{- if .Values.resources.controller }} resources: diff --git a/helm/install/values.yaml b/helm/install/values.yaml index 27deed09..e808a6df 100644 --- a/helm/install/values.yaml +++ b/helm/install/values.yaml @@ -50,3 +50,29 @@ resources: # postgres-operator.crunchydata.com, will cause an error # customPodLabels: # example.com: custom-label + +# Enable feature gates for PGO, by explicitly seting the value for the flags +# features: +# AutoGrowVolumes: true +# Feature2: false +# Feature3: somevalue + +# Define extra environment variables for the chart, which will get added to the container's env +# extraEnv: +# - name: MY_VAR +# value: "myvalue" +# - name: MY_CONFIGMAP_VAR +# valueFrom: +# configMapKeyRef: +# name: s3-settings +# key: bucket +# - name: MY_SECRET_VAR +# valueFrom: +# secretKeyRef: +# name: s3-secret +# key: key + +# Override environment variables entirely !!DANGEROUS!! +# envOverride: +# - name: PG_DEBUG +# value: "true" \ No newline at end of file