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

Allow read database credentials from existing secret created by other operators #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 @@ -11,7 +11,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.3
version: 1.2.4

# 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
10 changes: 10 additions & 0 deletions charts/ext-postgres-operator/templates/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ .Values.postgresCredsExistingSecrets.username.secretName }}
key: {{ .Values.postgresCredsExistingSecrets.username.secretKey }}
- name: POSTGRES_PASS
valueFrom:
secretKeyRef:
name: {{ .Values.postgresCredsExistingSecrets.password.secretName }}
key: {{ .Values.postgresCredsExistingSecrets.password.secretKey }}
- name: OPERATOR_NAME
value: {{ include "chart.fullname" . }}
{{- range $key, $value := .Values.env }}
Expand Down
2 changes: 2 additions & 0 deletions charts/ext-postgres-operator/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ metadata:
type: Opaque
data:
POSTGRES_HOST: {{ .Values.postgres.host | b64enc | quote }}
{{- if (not .Values.postgresCredsExistingSecrets) }}
POSTGRES_USER: {{ .Values.postgres.user | b64enc | quote }}
POSTGRES_PASS: {{ .Values.postgres.password | b64enc | quote }}
{{- end }}
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 }}
Expand Down
8 changes: 8 additions & 0 deletions charts/ext-postgres-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ volumeMounts: []
# If not set a new secret will be created, filled with information under the postgres key above.
existingSecret: ""

postgresCredsExistingSecrets:
username:
secretName: ""
secretKey: ""
password:
secretName: ""
secretKey: ""

# Additionnal environment variables to add to the pod (map of key / value)
env: {}

Expand Down