Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'additionalEnvVars' to the chart #303

Merged
merged 4 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/cloudnative-pg/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ name: cloudnative-pg
description: CloudNativePG Operator Helm Chart
icon: https://raw.githubusercontent.com/cloudnative-pg/artwork/main/cloudnativepg-logo.svg
type: application
version: "0.21.2"
version: "0.22.0"
Stevenpc3 marked this conversation as resolved.
Show resolved Hide resolved
# 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
# follow Semantic Versioning, they should reflect the version the application is using.
Expand Down
1 change: 1 addition & 0 deletions charts/cloudnative-pg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ CloudNativePG Operator Helm Chart
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| additionalArgs | list | `[]` | Additinal arguments to be added to the operator's args list. |
| additionalEnvVars | list | `[]` | Array containing extra environment variables which can be templated. See [values.yaml](./values.yaml) for examples.
| affinity | object | `{}` | Affinity for the operator to be installed. |
| commonAnnotations | object | `{}` | Annotations to be added to all other resources. |
| config | object | `{"create":true,"data":{},"name":"cnpg-controller-manager-config","secret":false}` | Operator configuration. |
Expand Down
14 changes: 14 additions & 0 deletions charts/cloudnative-pg/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,17 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Renders a value that contains template
Usage:
{{ include "cloudnative-pg.extraEnv" ( dict "value" .Values.example.value "context" $ ) }}
*/}}
{{- define "cloudnative-pg.extraEnv" -}}
{{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }}
{{- if contains "{{" (toJson .value) }}
{{- tpl $value .context }}
{{- else }}
{{- $value }}
{{- end }}
{{- end -}}
3 changes: 3 additions & 0 deletions charts/cloudnative-pg/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ spec:
fieldPath: metadata.namespace
- name: MONITORING_QUERIES_CONFIGMAP
value: "{{ .Values.monitoringQueriesConfigMap.name }}"
{{- if .Values.additionalEnvVars }}
{{- include "cloudnative-pg.extraEnv" (dict "value" .Values.additionalEnvVars "context" . ) | nindent 8 }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
livenessProbe:
Expand Down
8 changes: 8 additions & 0 deletions charts/cloudnative-pg/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ config:
# -- Additinal arguments to be added to the operator's args list.
additionalArgs: []

# -- Array containing extra environment variables which can be templated.
# For example:
# - name: WATCH_NAMESPACE
# value: "{{ .Release.Namespace }}"
Stevenpc3 marked this conversation as resolved.
Show resolved Hide resolved
# - name: MY_VAR
# value: "mySpecialKey"
additionalEnvVars: []
Stevenpc3 marked this conversation as resolved.
Show resolved Hide resolved

serviceAccount:
# -- Specifies whether the service account should be created.
create: true
Expand Down