diff --git a/charts/postgres-operator/templates/_helpers.tpl b/charts/postgres-operator/templates/_helpers.tpl index cb8c69c2b..ba33f24f5 100644 --- a/charts/postgres-operator/templates/_helpers.tpl +++ b/charts/postgres-operator/templates/_helpers.tpl @@ -59,6 +59,18 @@ Create chart name and version as used by the chart label. {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{/* +Render an extra object, given as a map or as a string, with Helm templating support. +Expects a dict with "value" (the object) and "context" (the root context). +*/}} +{{- define "postgres-operator.renderObject" -}} +{{- if typeIs "string" .value -}} +{{- tpl .value .context -}} +{{- else -}} +{{- tpl (toYaml .value) .context -}} +{{- end -}} +{{- end -}} + {{/* Flatten nested config options when ConfigMap is used as ConfigTarget */}} diff --git a/charts/postgres-operator/templates/extra-objects.yaml b/charts/postgres-operator/templates/extra-objects.yaml new file mode 100644 index 000000000..6f22828a3 --- /dev/null +++ b/charts/postgres-operator/templates/extra-objects.yaml @@ -0,0 +1,4 @@ +{{ range .Values.extraObjects }} +--- +{{ include "postgres-operator.renderObject" (dict "value" . "context" $) }} +{{ end }} diff --git a/charts/postgres-operator/values.yaml b/charts/postgres-operator/values.yaml index 7b383f63a..1f9e7f746 100644 --- a/charts/postgres-operator/values.yaml +++ b/charts/postgres-operator/values.yaml @@ -570,3 +570,8 @@ controllerID: # The name of the controller ID to use. # If not set and create is true, a name is generated using the fullname template name: + +# Extra Kubernetes manifests to deploy alongside the operator. +# Each entry is a full manifest, either as a map or as a string (templated with tpl, +# so Helm templating like {{ .Release.Namespace }} can be used). +extraObjects: []