schnie commented on a change in pull request #8777:
URL: https://github.com/apache/airflow/pull/8777#discussion_r434560575
##########
File path: chart/templates/secrets/result-backend-connection-secret.yaml
##########
@@ -0,0 +1,20 @@
+################################
+## Airflow Result Backend Secret
+#################################
+{{- if (and .Values.data.resultBackendConnection (not
.Values.data.resultBackendSecretName)) }}
+{{- $host := .Values.data.resultBackendConnection.host | default (printf
"%s-%s" .Release.Name "postgresql") }}
+kind: Secret
+apiVersion: v1
+metadata:
+ name: {{ .Release.Name }}-airflow-result-backend
+ labels:
+ release: {{ .Release.Name }}
+ chart: {{ .Chart.Name }}
+ heritage: {{ .Release.Service }}
+{{- with .Values.labels }}
+{{ toYaml . | indent 4 }}
+{{- end }}
+type: Opaque
+data:
+ connection: {{ (printf "db+postgresql://%s:%s@%s:%s/%s?sslmode=%s"
.Values.data.resultBackendConnection.user
.Values.data.resultBackendConnection.pass (ternary (printf "%s-%s"
.Release.Name "pgbouncer") $host .Values.pgbouncer.enabled) ((ternary
.Values.ports.pgbouncer .Values.data.resultBackendConnection.port
.Values.pgbouncer.enabled) | toString) (ternary (printf "%s-%s" .Release.Name
"result-backend") .Values.data.resultBackendConnection.db
.Values.pgbouncer.enabled) .Values.data.resultBackendConnection.sslmode) |
b64enc | quote }}
Review comment:
@thesuperzapper good eye. It's not the best, but it's simple. Instead of
this, users can also specify a secret name. On line 4 we have `{{- if (and
.Values.data.resultBackendConnection (not
.Values.data.resultBackendSecretName)) }}`. So this only is used when the
individual components are filled out in the values. If a user specifies
`.Values.data.resultBackendSecretName`, that will be used instead - looking for
a `connection` field I believe.
The goal was to be flexible here, so this pattern is also repeated for the
normal metadata secret, and in a few other places.
This also has support for falling back to a default local postgres per
install, if nothing is specified.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]