From a00fdac0413695ed8e50df27f3b173ae33bc15c5 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 12 Feb 2020 23:32:49 +0100 Subject: [PATCH 1/6] use existing secret to read external redis and postgres passwords from --- bitnami/airflow/README.md | 41 ++++++++++++++++++- .../templates/deployment-scheduler.yaml | 6 +++ bitnami/airflow/templates/deployment-web.yaml | 6 +++ .../airflow/templates/metrics-deployment.yaml | 3 ++ .../airflow/templates/secret-externaldb.yaml | 2 + .../templates/secret-externalredis.yaml | 2 + .../airflow/templates/statefulset-worker.yaml | 6 +++ bitnami/airflow/values-production.yaml | 4 ++ bitnami/airflow/values.yaml | 5 +++ 9 files changed, 73 insertions(+), 2 deletions(-) diff --git a/bitnami/airflow/README.md b/bitnami/airflow/README.md index 90acb3a272121e..3d426d6a24e6c5 100644 --- a/bitnami/airflow/README.md +++ b/bitnami/airflow/README.md @@ -44,7 +44,7 @@ The command removes all the Kubernetes components associated with the chart and ## Parameters -The following tables lists the configurable parameters of the Kafka chart and their default values. +The following tables lists the configurable parameters of the Airflow chart and their default values. | Parameter | Description | Default | | ----------------------------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ | @@ -106,7 +106,7 @@ The following tables lists the configurable parameters of the Kafka chart and th | `service.type` | Kubernetes Service type | `ClusterIP` | | `service.port` | Airflow Web port | `8080` | | `service.nodePort` | Kubernetes Service nodePort | `nil` | -| `service.loadBalancerIP` | loadBalancerIP for Kafka Service | `nil` | +| `service.loadBalancerIP` | loadBalancerIP for Airflow Service | `nil` | | `service.annotations` | Service annotations | `` | | `ingress.enabled` | Enable ingress controller resource | `false` | | `ingress.certManager` | Add annotations for cert-manager | `false` | @@ -144,11 +144,13 @@ The following tables lists the configurable parameters of the Kafka chart and th | `externalDatabase.password` | External PostgreSQL password | `nil` | | `externalDatabase.database` | External PostgreSQL database name | `nil` | | `externalDatabase.port` | External PostgreSQL port | `nil` | +| `externalDatabase.existingSecret` | Name of an existing secret containing the postgres password ('db-password' key) | `nil` | | `redis.enabled` | Switch to enable or disable the Redis helm chart | `true` | | `externalRedis.host` | External Redis host | `nil` | | `externalRedis.port` | External Redis port | `nil` | | `externalRedis.password` | External Redis password | `nil` | | `externalRedis.username` | External Redis username (not required on most Redis implementations) | `nil` | +| `externalRedis.existingSecret` | Name of an existing secret containing the Redis password ('redis-password' key) | `nil` | | `metrics.enabled` | Start a side-car prometheus exporter | `false` | | `metrics.image.registry` | Airflow exporter image registry | `docker.io` | | `metrics.image.repository` | Airflow exporter image name | `bitnami/airflow-exporter` | @@ -256,6 +258,41 @@ airflow.clonePluginsFromGit.branch=v1.0.9-branch airflow.clonePluginsFromGit.path=plugins ``` +### Existing Secrets + +You can use an existing secret to configure your Airflow auth, external Postgres, and extern Redis passwords: + +```console +postgresql.enabled=false +externalDatabase.host=my.external.postgres.host +externalDatabase.user=bn_airflow +externalDatabase.database=bitnami_airflow +externalDatabase.existingSecret=all-my-secrets + +redis.enabled=false +externalRedis.host=my.external.redis.host +externalRedis.existingSecret=all-my-secrets + +airflow.auth.existingSecret=all-my-secrets +``` + +The expected secret resource looks as follows: + +```yaml +apiVersion: v1 +kind: Secret +metadata: + name: all-my-secrets +type: Opaque +data: + airflow-password: "Smo1QTJLdGxXMg==" + airflow-fernetKey: "YVRZeVJVWnlXbU4wY1dOalVrdE1SV3cxWWtKeFIzWkVRVTVrVjNaTFR6WT0=" + db-password: "cG9zdGdyZXMK" + redis-password: "cmVkaXMK" +``` + +This is useful if you plan on using [Bitnami's sealed secrets](https://github.com/bitnami-labs/sealed-secrets) to manage your passwords. + ## Persistence The Bitnami Airflow chart relies on the PostgreSQL chart persistence. This means that Airflow does not persist anything. diff --git a/bitnami/airflow/templates/deployment-scheduler.yaml b/bitnami/airflow/templates/deployment-scheduler.yaml index c802af131965ee..ce8342235a3704 100644 --- a/bitnami/airflow/templates/deployment-scheduler.yaml +++ b/bitnami/airflow/templates/deployment-scheduler.yaml @@ -128,6 +128,9 @@ spec: {{- if .Values.postgresql.enabled }} name: {{ template "airflow.postgresql.fullname" . }} key: postgresql-password + {{- else if .Values.externalDatabase.existingSecret}} + name: {{ .Values.externalDatabase.existingSecret }} + key: db-password {{- else }} name: {{ printf "%s-%s" .Release.Name "externaldb" }} key: db-password @@ -166,6 +169,9 @@ spec: {{- if .Values.redis.enabled }} name: {{ template "airflow.redis.secretName" . }} key: redis-password + {{- else if .Values.externalRedis.existingSecret}} + name: {{ .Values.externalRedis.existingSecret }} + key: redis-password {{- else }} name: {{ printf "%s-%s" .Release.Name "externalredis" }} key: redis-password diff --git a/bitnami/airflow/templates/deployment-web.yaml b/bitnami/airflow/templates/deployment-web.yaml index 4cfcf2dc161dba..b305884b1dc0f4 100644 --- a/bitnami/airflow/templates/deployment-web.yaml +++ b/bitnami/airflow/templates/deployment-web.yaml @@ -128,6 +128,9 @@ spec: {{- if .Values.postgresql.enabled }} name: {{ template "airflow.postgresql.fullname" . }} key: postgresql-password + {{- else if .Values.externalDatabase.existingSecret}} + name: {{ .Values.externalDatabase.existingSecret }} + key: db-password {{- else }} name: {{ printf "%s-%s" .Release.Name "externaldb" }} key: db-password @@ -166,6 +169,9 @@ spec: {{- if .Values.redis.enabled }} name: {{ template "airflow.redis.secretName" . }} key: redis-password + {{- else if .Values.externalRedis.existingSecret}} + name: {{ .Values.externalRedis.existingSecret }} + key: redis-password {{- else }} name: {{ printf "%s-%s" .Release.Name "externalredis" }} key: redis-password diff --git a/bitnami/airflow/templates/metrics-deployment.yaml b/bitnami/airflow/templates/metrics-deployment.yaml index a36fb5f0105d79..ae1441aa7a7ae3 100644 --- a/bitnami/airflow/templates/metrics-deployment.yaml +++ b/bitnami/airflow/templates/metrics-deployment.yaml @@ -54,6 +54,9 @@ spec: {{- if .Values.postgresql.enabled }} name: {{ template "airflow.postgresql.fullname" . }} key: postgresql-password + {{- else if .Values.externalDatabase.existingSecret}} + name: {{ .Values.externalDatabase.existingSecret }} + key: db-password {{- else }} name: {{ printf "%s-%s" .Release.Name "externaldb" }} key: db-password diff --git a/bitnami/airflow/templates/secret-externaldb.yaml b/bitnami/airflow/templates/secret-externaldb.yaml index cf583987025850..919889f618c8fd 100644 --- a/bitnami/airflow/templates/secret-externaldb.yaml +++ b/bitnami/airflow/templates/secret-externaldb.yaml @@ -1,4 +1,5 @@ {{- if not .Values.postgresql.enabled }} +{{- if not .Values.externalDatabase.existingSecret }} apiVersion: v1 kind: Secret metadata: @@ -11,4 +12,5 @@ metadata: type: Opaque data: db-password: {{ .Values.externalDatabase.password | b64enc | quote }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/bitnami/airflow/templates/secret-externalredis.yaml b/bitnami/airflow/templates/secret-externalredis.yaml index 0b5b42e72470e2..963f4734df5d90 100644 --- a/bitnami/airflow/templates/secret-externalredis.yaml +++ b/bitnami/airflow/templates/secret-externalredis.yaml @@ -1,4 +1,5 @@ {{- if not .Values.redis.enabled }} +{{- if not .Values.externalRedis.existingSecret }} apiVersion: v1 kind: Secret metadata: @@ -11,4 +12,5 @@ metadata: type: Opaque data: redis-password: {{ .Values.externalRedis.password | b64enc | quote }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/bitnami/airflow/templates/statefulset-worker.yaml b/bitnami/airflow/templates/statefulset-worker.yaml index c34b7d27ce36bc..fc2dbf33aae201 100644 --- a/bitnami/airflow/templates/statefulset-worker.yaml +++ b/bitnami/airflow/templates/statefulset-worker.yaml @@ -130,6 +130,9 @@ spec: {{- if .Values.postgresql.enabled }} name: {{ template "airflow.postgresql.fullname" . }} key: postgresql-password + {{- else if .Values.externalDatabase.existingSecret}} + name: {{ .Values.externalDatabase.existingSecret }} + key: db-password {{- else }} name: {{ printf "%s-%s" .Release.Name "externaldb" }} key: db-password @@ -168,6 +171,9 @@ spec: {{- if .Values.redis.enabled }} name: {{ template "airflow.redis.secretName" . }} key: redis-password + {{- else if .Values.externalRedis.existingSecret}} + name: {{ .Values.externalRedis.existingSecret }} + key: redis-password {{- else }} name: {{ printf "%s-%s" .Release.Name "externalredis" }} key: redis-password diff --git a/bitnami/airflow/values-production.yaml b/bitnami/airflow/values-production.yaml index 7a2430b1189904..868e7dc453971d 100644 --- a/bitnami/airflow/values-production.yaml +++ b/bitnami/airflow/values-production.yaml @@ -328,6 +328,8 @@ externalDatabase: database: bitnami_airflow ## Database port number port: 5432 + ## Name of an existing secret resource containing the Postgres password in a 'db-password' key + existingSecret: "" ## ## Redis chart configuration @@ -354,6 +356,8 @@ externalRedis: ## and it should be enough with the password ## # username: "" + ## Name of an existing secret resource containing the Redis password in a 'redis-password' key + existingSecret: "" ## Prometheus Exporter / Metrics ## diff --git a/bitnami/airflow/values.yaml b/bitnami/airflow/values.yaml index 16974fc6bcc475..8c253083a43608 100644 --- a/bitnami/airflow/values.yaml +++ b/bitnami/airflow/values.yaml @@ -324,6 +324,8 @@ externalDatabase: user: bn_airflow ## Database password password: "" + ## Name of an existing secret resource containing the DB password in a 'db-password' key + existingSecret: "" ## Database name database: bitnami_airflow ## Database port number @@ -349,6 +351,9 @@ externalRedis: ## Redis password ## password: "" + ## Name of an existing secret resource containing the Redis password in a 'redis-password' key + ## + existingSecret: "" ## Redis username ## Most Redis implementnations do not require a username to authenticate ## and it should be enough with the password From 88695b881a651bb896360f1d305e8aa6df26d373 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 12 Feb 2020 23:34:46 +0100 Subject: [PATCH 2/6] bumped chart version --- bitnami/airflow/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitnami/airflow/Chart.yaml b/bitnami/airflow/Chart.yaml index 2d874053d1d13f..bb129c53a2a853 100644 --- a/bitnami/airflow/Chart.yaml +++ b/bitnami/airflow/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: airflow -version: 4.3.1 +version: 4.4.0 appVersion: 1.10.9 description: Apache Airflow is a platform to programmatically author, schedule and monitor workflows. keywords: From 2ca88f1b472b796e506d9bef21486cb6aaa79b3f Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 16 Feb 2020 02:50:36 +0100 Subject: [PATCH 3/6] implemented airflow.redis.secretName and airflow.postgresql.secretName template --- bitnami/airflow/templates/_helpers.tpl | 34 ++++++++++++++++--- .../templates/deployment-scheduler.yaml | 18 +--------- bitnami/airflow/templates/deployment-web.yaml | 18 +--------- .../airflow/templates/metrics-deployment.yaml | 10 +----- .../airflow/templates/statefulset-worker.yaml | 18 +--------- 5 files changed, 34 insertions(+), 64 deletions(-) diff --git a/bitnami/airflow/templates/_helpers.tpl b/bitnami/airflow/templates/_helpers.tpl index 63fae6c63087c4..d02f08e4d202dd 100644 --- a/bitnami/airflow/templates/_helpers.tpl +++ b/bitnami/airflow/templates/_helpers.tpl @@ -215,13 +215,39 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- printf "%s-%s-master" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} -Create a template for the redis secret -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +{{/* +Get the Redis credentials secret. */}} {{- define "airflow.redis.secretName" -}} -{{- $name := default "redis" .Values.redis.nameOverride -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- if .Values.redis.enabled -}} + {{/* Create a template for the redis secret + We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). + */}} + {{- $name := default "redis" .Values.redis.nameOverride -}} + {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- else }} + {{- if .Values.externalRedis.existingSecret -}} + {{- printf "%s" .Values.externalRedis.existingSecret -}} + {{- else -}} + {{ printf "%s-%s" .Release.Name "externalredis" }} + {{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Get the Postgresql credentials secret. +*/}} +{{- define "airflow.postgresql.secretName" -}} +{{- if .Values.postgresql.enabled -}} + {{- printf "%s" (include "airflow.postgresql.fullname" .) -}} +{{- else }} + {{- if .Values.externalDatabase.existingSecret -}} + {{- printf "%s" .Values.externalDatabase.existingSecret -}} + {{- else -}} + {{ printf "%s-%s" .Release.Name "externaldb" }} + {{- end -}} {{- end -}} +{{- end -}} {{/* Get the secret name diff --git a/bitnami/airflow/templates/deployment-scheduler.yaml b/bitnami/airflow/templates/deployment-scheduler.yaml index ce8342235a3704..ba785d2b229cec 100644 --- a/bitnami/airflow/templates/deployment-scheduler.yaml +++ b/bitnami/airflow/templates/deployment-scheduler.yaml @@ -125,16 +125,8 @@ spec: - name: AIRFLOW_DATABASE_PASSWORD valueFrom: secretKeyRef: - {{- if .Values.postgresql.enabled }} - name: {{ template "airflow.postgresql.fullname" . }} + name: {{ template "airflow.postgresql.secretName" . }} key: postgresql-password - {{- else if .Values.externalDatabase.existingSecret}} - name: {{ .Values.externalDatabase.existingSecret }} - key: db-password - {{- else }} - name: {{ printf "%s-%s" .Release.Name "externaldb" }} - key: db-password - {{- end }} - name: AIRFLOW_DATABASE_HOST {{- if .Values.postgresql.enabled }} value: {{ template "airflow.postgresql.fullname" . }} @@ -166,16 +158,8 @@ spec: - name: REDIS_PASSWORD valueFrom: secretKeyRef: - {{- if .Values.redis.enabled }} name: {{ template "airflow.redis.secretName" . }} key: redis-password - {{- else if .Values.externalRedis.existingSecret}} - name: {{ .Values.externalRedis.existingSecret }} - key: redis-password - {{- else }} - name: {{ printf "%s-%s" .Release.Name "externalredis" }} - key: redis-password - {{- end }} - name: AIRFLOW_EXECUTOR value: "CeleryExecutor" - name: AIRFLOW_FERNET_KEY diff --git a/bitnami/airflow/templates/deployment-web.yaml b/bitnami/airflow/templates/deployment-web.yaml index b305884b1dc0f4..778c7a08d25f53 100644 --- a/bitnami/airflow/templates/deployment-web.yaml +++ b/bitnami/airflow/templates/deployment-web.yaml @@ -125,16 +125,8 @@ spec: - name: AIRFLOW_DATABASE_PASSWORD valueFrom: secretKeyRef: - {{- if .Values.postgresql.enabled }} - name: {{ template "airflow.postgresql.fullname" . }} + name: {{ template "airflow.postgresql.secretName" . }} key: postgresql-password - {{- else if .Values.externalDatabase.existingSecret}} - name: {{ .Values.externalDatabase.existingSecret }} - key: db-password - {{- else }} - name: {{ printf "%s-%s" .Release.Name "externaldb" }} - key: db-password - {{- end }} - name: AIRFLOW_DATABASE_HOST {{- if .Values.postgresql.enabled }} value: {{ template "airflow.postgresql.fullname" . }} @@ -166,16 +158,8 @@ spec: - name: REDIS_PASSWORD valueFrom: secretKeyRef: - {{- if .Values.redis.enabled }} name: {{ template "airflow.redis.secretName" . }} key: redis-password - {{- else if .Values.externalRedis.existingSecret}} - name: {{ .Values.externalRedis.existingSecret }} - key: redis-password - {{- else }} - name: {{ printf "%s-%s" .Release.Name "externalredis" }} - key: redis-password - {{- end }} - name: AIRFLOW_EXECUTOR value: "CeleryExecutor" - name: AIRFLOW_USERNAME diff --git a/bitnami/airflow/templates/metrics-deployment.yaml b/bitnami/airflow/templates/metrics-deployment.yaml index ae1441aa7a7ae3..165357262f75ef 100644 --- a/bitnami/airflow/templates/metrics-deployment.yaml +++ b/bitnami/airflow/templates/metrics-deployment.yaml @@ -51,16 +51,8 @@ spec: - name: AIRFLOW_PROMETHEUS_DATABASE_PASSWORD valueFrom: secretKeyRef: - {{- if .Values.postgresql.enabled }} - name: {{ template "airflow.postgresql.fullname" . }} + name: {{ template "airflow.postgresql.secretName" . }} key: postgresql-password - {{- else if .Values.externalDatabase.existingSecret}} - name: {{ .Values.externalDatabase.existingSecret }} - key: db-password - {{- else }} - name: {{ printf "%s-%s" .Release.Name "externaldb" }} - key: db-password - {{- end }} - name: AIRFLOW_PROMETHEUS_DATABASE_NAME {{- if .Values.postgresql.enabled }} value: {{ .Values.postgresql.postgresqlDatabase }} diff --git a/bitnami/airflow/templates/statefulset-worker.yaml b/bitnami/airflow/templates/statefulset-worker.yaml index fc2dbf33aae201..547d7be2a35e9e 100644 --- a/bitnami/airflow/templates/statefulset-worker.yaml +++ b/bitnami/airflow/templates/statefulset-worker.yaml @@ -127,16 +127,8 @@ spec: - name: AIRFLOW_DATABASE_PASSWORD valueFrom: secretKeyRef: - {{- if .Values.postgresql.enabled }} - name: {{ template "airflow.postgresql.fullname" . }} + name: {{ template "airflow.postgresql.secretName" . }} key: postgresql-password - {{- else if .Values.externalDatabase.existingSecret}} - name: {{ .Values.externalDatabase.existingSecret }} - key: db-password - {{- else }} - name: {{ printf "%s-%s" .Release.Name "externaldb" }} - key: db-password - {{- end }} - name: AIRFLOW_DATABASE_HOST {{- if .Values.postgresql.enabled }} value: {{ template "airflow.postgresql.fullname" . }} @@ -168,16 +160,8 @@ spec: - name: REDIS_PASSWORD valueFrom: secretKeyRef: - {{- if .Values.redis.enabled }} name: {{ template "airflow.redis.secretName" . }} key: redis-password - {{- else if .Values.externalRedis.existingSecret}} - name: {{ .Values.externalRedis.existingSecret }} - key: redis-password - {{- else }} - name: {{ printf "%s-%s" .Release.Name "externalredis" }} - key: redis-password - {{- end }} - name: AIRFLOW_EXECUTOR value: "CeleryExecutor" - name: AIRFLOW_FERNET_KEY From 03e26fce20922c51da1ef842763346ee07afd531 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 16 Feb 2020 02:51:53 +0100 Subject: [PATCH 4/6] renamed 'db-password' key to 'postgresql-password' --- bitnami/airflow/README.md | 4 ++-- bitnami/airflow/templates/secret-externaldb.yaml | 2 +- bitnami/airflow/values-production.yaml | 2 +- bitnami/airflow/values.yaml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bitnami/airflow/README.md b/bitnami/airflow/README.md index 3d426d6a24e6c5..29f8c79741afe5 100644 --- a/bitnami/airflow/README.md +++ b/bitnami/airflow/README.md @@ -144,7 +144,7 @@ The following tables lists the configurable parameters of the Airflow chart and | `externalDatabase.password` | External PostgreSQL password | `nil` | | `externalDatabase.database` | External PostgreSQL database name | `nil` | | `externalDatabase.port` | External PostgreSQL port | `nil` | -| `externalDatabase.existingSecret` | Name of an existing secret containing the postgres password ('db-password' key) | `nil` | +| `externalDatabase.existingSecret` | Name of an existing secret containing the PostgreSQL password ('postgresql-password' key) | `nil` | | `redis.enabled` | Switch to enable or disable the Redis helm chart | `true` | | `externalRedis.host` | External Redis host | `nil` | | `externalRedis.port` | External Redis port | `nil` | @@ -287,7 +287,7 @@ type: Opaque data: airflow-password: "Smo1QTJLdGxXMg==" airflow-fernetKey: "YVRZeVJVWnlXbU4wY1dOalVrdE1SV3cxWWtKeFIzWkVRVTVrVjNaTFR6WT0=" - db-password: "cG9zdGdyZXMK" + postgresql-password: "cG9zdGdyZXMK" redis-password: "cmVkaXMK" ``` diff --git a/bitnami/airflow/templates/secret-externaldb.yaml b/bitnami/airflow/templates/secret-externaldb.yaml index 919889f618c8fd..af9d8712b4456e 100644 --- a/bitnami/airflow/templates/secret-externaldb.yaml +++ b/bitnami/airflow/templates/secret-externaldb.yaml @@ -11,6 +11,6 @@ metadata: app.kubernetes.io/managed-by: {{ .Release.Service }} type: Opaque data: - db-password: {{ .Values.externalDatabase.password | b64enc | quote }} + postgresql-password: {{ .Values.externalDatabase.password | b64enc | quote }} {{- end }} {{- end }} \ No newline at end of file diff --git a/bitnami/airflow/values-production.yaml b/bitnami/airflow/values-production.yaml index 868e7dc453971d..cf8e414766be25 100644 --- a/bitnami/airflow/values-production.yaml +++ b/bitnami/airflow/values-production.yaml @@ -328,7 +328,7 @@ externalDatabase: database: bitnami_airflow ## Database port number port: 5432 - ## Name of an existing secret resource containing the Postgres password in a 'db-password' key + ## Name of an existing secret resource containing the Postgres password in a 'postgresql-password' key existingSecret: "" ## diff --git a/bitnami/airflow/values.yaml b/bitnami/airflow/values.yaml index 8c253083a43608..8590be714512e2 100644 --- a/bitnami/airflow/values.yaml +++ b/bitnami/airflow/values.yaml @@ -324,7 +324,7 @@ externalDatabase: user: bn_airflow ## Database password password: "" - ## Name of an existing secret resource containing the DB password in a 'db-password' key + ## Name of an existing secret resource containing the DB password in a 'postgresql-password' key existingSecret: "" ## Database name database: bitnami_airflow From dddb0509043cd999821ebc70038fe785048f5264 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 16 Feb 2020 02:53:28 +0100 Subject: [PATCH 5/6] use airflow.secretName template to retrieve the app credentials in NOTES.txt --- bitnami/airflow/templates/NOTES.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bitnami/airflow/templates/NOTES.txt b/bitnami/airflow/templates/NOTES.txt index ddc6e3e31c97c1..62406f978f0a21 100644 --- a/bitnami/airflow/templates/NOTES.txt +++ b/bitnami/airflow/templates/NOTES.txt @@ -36,8 +36,8 @@ host. To configure Airflow with the URL of your service: export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "airflow.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}") export APP_PORT=80 {{- end }} - export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "airflow.fullname" . }} -o jsonpath="{.data.airflow-password}" | base64 --decode) - export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "airflow.postgresql.fullname" . }} -o jsonpath="{.data.postgresql-password}" | base64 --decode) + export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "airflow.secretName" . }} -o jsonpath="{.data.airflow-password}" | base64 --decode) + export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "airflow.postgresql.secretName" . }} -o jsonpath="{.data.postgresql-password}" | base64 --decode) export APP_REDIS_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "airflow.redis.secretName" . }} -o jsonpath="{.data.redis-password}" | base64 --decode) {{- end }} @@ -73,7 +73,7 @@ host. To configure Airflow with the URL of your service: 2. Get your Airflow login credentials by running: echo User: {{ .Values.airflow.auth.username }} - echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "airflow.fullname" . }} -o jsonpath="{.data.airflow-password}" | base64 --decode) + echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "airflow.secretName" . }} -o jsonpath="{.data.airflow-password}" | base64 --decode) {{- end }} From 305946b60c15bbba359ca3455828a29baa67c282 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 17 Feb 2020 12:51:36 +0100 Subject: [PATCH 6/6] combined conditional check for secret creation --- bitnami/airflow/templates/secret-externaldb.yaml | 4 +--- bitnami/airflow/templates/secret-externalredis.yaml | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bitnami/airflow/templates/secret-externaldb.yaml b/bitnami/airflow/templates/secret-externaldb.yaml index af9d8712b4456e..d2322c1b0bcb2a 100644 --- a/bitnami/airflow/templates/secret-externaldb.yaml +++ b/bitnami/airflow/templates/secret-externaldb.yaml @@ -1,5 +1,4 @@ -{{- if not .Values.postgresql.enabled }} -{{- if not .Values.externalDatabase.existingSecret }} +{{- if and (not .Values.postgresql.enabled) (not .Values.externalDatabase.existingSecret) }} apiVersion: v1 kind: Secret metadata: @@ -13,4 +12,3 @@ type: Opaque data: postgresql-password: {{ .Values.externalDatabase.password | b64enc | quote }} {{- end }} -{{- end }} \ No newline at end of file diff --git a/bitnami/airflow/templates/secret-externalredis.yaml b/bitnami/airflow/templates/secret-externalredis.yaml index 963f4734df5d90..e8496c6def282d 100644 --- a/bitnami/airflow/templates/secret-externalredis.yaml +++ b/bitnami/airflow/templates/secret-externalredis.yaml @@ -1,5 +1,4 @@ -{{- if not .Values.redis.enabled }} -{{- if not .Values.externalRedis.existingSecret }} +{{- if and (not .Values.redis.enabled) (not .Values.externalRedis.existingSecret) }} apiVersion: v1 kind: Secret metadata: @@ -13,4 +12,3 @@ type: Opaque data: redis-password: {{ .Values.externalRedis.password | b64enc | quote }} {{- end }} -{{- end }} \ No newline at end of file