Skip to content

[helm] Add volume management, custom labels, environment variables and custom existing secret #108

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

Merged
merged 6 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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/ext-postgres-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions charts/ext-postgres-operator/templates/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ spec:
{{- end }}
labels:
{{- include "chart.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "chart.serviceAccountName" . }}
securityContext:
Expand All @@ -32,7 +35,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 "" }}
Expand All @@ -42,3 +49,19 @@ 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 }}
{{- end }}
{{- if .Values.volumes }}
volumes:
{{- toYaml .Values.volumes | nindent 8 }}
{{- end }}
nodeSelector:
{{- toYaml .Values.nodeSelector | nindent 8 }}
tolerations:
{{- toYaml .Values.tolerations | nindent 8 }}
3 changes: 3 additions & 0 deletions charts/ext-postgres-operator/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if (not .Values.existingSecret) }}
---
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -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 }}
20 changes: 20 additions & 0 deletions charts/ext-postgres-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ serviceAccount:

podAnnotations: {}

# Additionnal labels to add to the pod.
podLabels: {}

podSecurityContext: {}
# fsGroup: 2000

Expand Down Expand Up @@ -55,3 +58,20 @@ postgres:
cloud_provider: ""
# 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: {}

tolerations: []