Skip to content

Commit

Permalink
adjust deplyoment to use secret (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
MxEh-TT committed May 27, 2024
1 parent 7a3e2b2 commit 98a6c32
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 7 deletions.
12 changes: 6 additions & 6 deletions charts/test-guide/templates/config-file.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ stringData:
# Database connection
database.driver={{ .Values.db.driver }}
database.url={{ .Values.db.url }}
database.user={{ if .Values.useSecretsForCredentials }}{{ .Values.secrets.dbCredentials.name }}{{ else }}{{ .Values.db.user }}{{ end }}
database.password={{ if .Values.useSecretsForCredentials }}{{ .Values.secrets.dbCredentials.passwordKey }}{{ else }}{{ .Values.db.password }}{{ end }}
database.user: ${DB_USER}
database.password: ${DB_PASSWORD}
{{ if .Values.dbMonitoring -}}
# Monitoring database connection
database.monitoring.driver={{ .Values.dbMonitoring.driver }}
database.monitoring.url={{ .Values.dbMonitoring.url }}
database.monitoring.user={{ if .Values.useSecretsForCredentials }}{{ .Values.secrets.dbMonitoringCredentials.name }}{{ else }}{{ .Values.dbMonitoring.user }}{{ end }}
database.monitoring.password={{ if .Values.useSecretsForCredentials }}{{ .Values.secrets.dbMonitoringCredentials.passwordKey }}{{ else }}{{ .Values.dbMonitoring.password }}{{ end }}
database.monitoring.user=${DB_MONITORING_USER}
database.monitoring.password=${DB_MONITORING_PASSWORD}
{{- end }}
{{ if .Values.dbArtifact -}}
# Artifact database connection
database.artifact.driver={{ .Values.dbArtifact.driver }}
database.artifact.url={{ .Values.dbArtifact.url }}
database.artifact.user={{ if .Values.useSecretsForCredentials }}{{ .Values.secrets.dbArtifactCredentials.name }}{{ else }}{{ .Values.dbArtifact.user }}{{ end }}
database.artifact.password={{ if .Values.useSecretsForCredentials }}{{ .Values.secrets.dbArtifactCredentials.passwordKey }}{{ else }}{{ .Values.dbArtifact.password }}{{ end }}
database.artifact.user=${DB_ARTIFACT_USER}
database.artifact.password=${DB_ARTIFACT_PASSWORD}
{{- end }}
# Demo initialization
Expand Down
58 changes: 57 additions & 1 deletion charts/test-guide/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,63 @@ spec:
timeoutSeconds: 5
failureThreshold: 5
env:
{{- toYaml .Values.env | nindent 12 }}
- name: DB_USER
valueFrom:
{{- if .Values.useSecretsForCredentials }}
secretKeyRef:
name: {{ .Values.secrets.dbCredentials.name }}
key: {{ .Values.secrets.dbCredentials.userKey }}
{{- else }}
value: {{ .Values.db.user }}
{{- end }}
- name: DB_PASSWORD
valueFrom:
{{- if .Values.useSecretsForCredentials }}
secretKeyRef:
name: {{ .Values.secrets.dbCredentials.name }}
key: {{ .Values.secrets.dbCredentials.passwordKey }}
{{- else }}
value: {{ .Values.db.password }}
{{- end }}
- name: DB_MONITORING_USER
valueFrom:
{{- if .Values.useSecretsForCredentials }}
secretKeyRef:
name: {{ .Values.secrets.dbMonitoringCredentials.name }}
key: {{ .Values.secrets.dbMonitoringCredentials.userKey }}
{{- else }}
value: {{ .Values.dbMonitoring.user }}
{{- end }}
- name: DB_MONITORING_PASSWORD
valueFrom:
{{- if .Values.useSecretsForCredentials }}
secretKeyRef:
name: {{ .Values.secrets.dbCredentials.name }}
key: {{ .Values.secrets.dbMonitoringCredentials.passwordKey }}
{{- else }}
value: {{ .Values.dbMonitoring.password }}
{{- end }}
- name: DB_ARTIFACT_USER
valueFrom:
{{- if .Values.useSecretsForCredentials }}
secretKeyRef:
name: {{ .Values.secrets.dbArtifactCredentials.name }}
key: {{ .Values.secrets.dbArtifactCredentials.userKey }}
{{- else }}
value: {{ .Values.dbArtifact.user }}
{{- end }}
- name: DB_ARTIFACT_PASSWORD
valueFrom:
{{- if .Values.useSecretsForCredentials }}
secretKeyRef:
name: {{ .Values.secrets.dbArtifactCredentials.name }}
key: {{ .Values.secrets.dbArtifactCredentials.passwordKey }}
{{- else }}
value: {{ .Values.dbArtifact.password }}
{{- end }}
{{- with .Values.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
Expand Down

0 comments on commit 98a6c32

Please sign in to comment.