Skip to content

Commit

Permalink
feat(sql): allow providing username from secret for sql setup jobs (#380
Browse files Browse the repository at this point in the history
)

See #291
  • Loading branch information
Gerrit-K authored Nov 16, 2023
1 parent 1c5990f commit 6311fce
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/datahub/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Helm chart for LinkedIn DataHub
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.
version: 0.3.9
version: 0.3.10
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 0.11.0
Expand Down
10 changes: 9 additions & 1 deletion charts/datahub/templates/mysql-setup-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,15 @@ spec:
imagePullPolicy: {{ .Values.mysqlSetupJob.image.pullPolicy | default "IfNotPresent" }}
env:
- name: MYSQL_USERNAME
value: {{ .Values.mysqlSetupJob.username | default .Values.global.sql.datasource.username | quote }}
{{- $usernameValue := (.Values.mysqlSetupJob).username | default .Values.global.sql.datasource.username }}
{{- if and (kindIs "string" $usernameValue) $usernameValue }}
value: {{ $usernameValue | quote }}
{{- else }}
valueFrom:
secretKeyRef:
name: "{{ ($usernameValue).secretRef | default .Values.global.sql.datasource.username.secretRef }}"
key: "{{ ($usernameValue).secretKey | default .Values.global.sql.datasource.username.secretKey }}"
{{- end }}
- name: MYSQL_PASSWORD
{{- $passwordValue := (.Values.mysqlSetupJob.password).value | default .Values.global.sql.datasource.password.value }}
{{- if $passwordValue }}
Expand Down
10 changes: 9 additions & 1 deletion charts/datahub/templates/postgresql-setup-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,15 @@ spec:
imagePullPolicy: {{ .Values.postgresqlSetupJob.image.pullPolicy | default "Always" }}
env:
- name: POSTGRES_USERNAME
value: {{ .Values.postgresqlSetupJob.username | default .Values.global.sql.datasource.username | quote }}
{{- $usernameValue := (.Values.postgresqlSetupJob).username | default .Values.global.sql.datasource.username }}
{{- if and (kindIs "string" $usernameValue) $usernameValue }}
value: {{ $usernameValue | quote }}
{{- else }}
valueFrom:
secretKeyRef:
name: "{{ ($usernameValue).secretRef | default .Values.global.sql.datasource.username.secretRef }}"
key: "{{ ($usernameValue).secretKey | default .Values.global.sql.datasource.username.secretKey }}"
{{- end }}
- name: POSTGRES_PASSWORD
{{- $passwordValue := (.Values.postgresqlSetupJob.password).value | default .Values.global.sql.datasource.password.value }}
{{- if $passwordValue }}
Expand Down

0 comments on commit 6311fce

Please sign in to comment.