From 6dba24d0351ea731b1deb6b4f15e7f12a948dfef Mon Sep 17 00:00:00 2001 From: Wei Sun Date: Wed, 19 Aug 2020 09:43:10 +0800 Subject: [PATCH] [stable/airflow] enable database properties configuration for external database (#23560) Signed-off-by: Wei Sun --- stable/airflow/Chart.yaml | 2 +- stable/airflow/README.md | 2 ++ stable/airflow/UPGRADE.md | 10 ++++++++++ stable/airflow/templates/_helpers.tpl | 8 ++++---- stable/airflow/templates/configmap-env.yaml | 1 + stable/airflow/values.yaml | 3 +++ 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/stable/airflow/Chart.yaml b/stable/airflow/Chart.yaml index 7ef5784554c2..cf522762b7eb 100644 --- a/stable/airflow/Chart.yaml +++ b/stable/airflow/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: Airflow is a platform to programmatically author, schedule and monitor workflows name: airflow -version: 7.4.1 +version: 7.5.0 appVersion: 1.10.10 icon: https://airflow.apache.org/_images/pin_large.png home: https://airflow.apache.org/ diff --git a/stable/airflow/README.md b/stable/airflow/README.md index 3fdcb833c3d1..e26602ad19ba 100644 --- a/stable/airflow/README.md +++ b/stable/airflow/README.md @@ -39,6 +39,7 @@ kubectl exec \ > NOTE: for chart version numbers, see [Chart.yaml](Chart.yaml) or [helm hub](https://hub.helm.sh/charts/stable/airflow). For steps you must take when upgrading this chart, please review: +* [v7.4.X → v7.5.0](UPGRADE.md#v74x--v750) * [v7.3.X → v7.4.0](UPGRADE.md#v73x--v740) * [v7.2.X → v7.3.0](UPGRADE.md#v72x--v730) * [v7.1.X → v7.2.0](UPGRADE.md#v71x--v720) @@ -683,6 +684,7 @@ __Airflow Database (External) Values:__ | `externalDatabase.user` | the user of the external database | `airflow` | | `externalDatabase.passwordSecret` | the name of a pre-created secret containing the external database password | `""` | | `externalDatabase.passwordSecretKey` | the key within `externalDatabase.passwordSecret` containing the password string | `postgresql-password` | +| `externalDatabase.properties` | the connection properties e.g. "?sslmode=require" | `""` | __Airflow Redis (Internal) Values:__ diff --git a/stable/airflow/UPGRADE.md b/stable/airflow/UPGRADE.md index 3c552dae4eb7..64f851c355e2 100644 --- a/stable/airflow/UPGRADE.md +++ b/stable/airflow/UPGRADE.md @@ -1,5 +1,15 @@ # Upgrading Steps +## `v7.4.X` → `v7.5.0` + +__The following IMPROVEMENTS have been made:__ + +* Added an ability to setup external database connection propertites with the value `externalDatabase.properties` for TLS or other advanced parameters + +__The following values have been ADDED:__ + +* `externalDatabase.properties` + ## `v7.3.X` → `v7.4.0` __The following IMPROVEMENTS have been made:__ diff --git a/stable/airflow/templates/_helpers.tpl b/stable/airflow/templates/_helpers.tpl index b76bd48a647d..c4c9aa52d245 100644 --- a/stable/airflow/templates/_helpers.tpl +++ b/stable/airflow/templates/_helpers.tpl @@ -75,9 +75,9 @@ Construct the AIRFLOW__CORE__SQL_ALCHEMY_CONN connection string. {{- if .Values.postgresql.enabled -}} postgresql+psycopg2://${DATABASE_USER}:$( echo ${DATABASE_PASSWORD} | python3 -c "import urllib.parse; encoded_pass = urllib.parse.quote(input()); print(encoded_pass)" )@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_DB} {{- else if and (not .Values.postgresql.enabled) (eq "postgres" .Values.externalDatabase.type) -}} -postgresql+psycopg2://${DATABASE_USER}:$( echo ${DATABASE_PASSWORD} | python3 -c "import urllib.parse; encoded_pass = urllib.parse.quote(input()); print(encoded_pass)" )@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_DB} +postgresql+psycopg2://${DATABASE_USER}:$( echo ${DATABASE_PASSWORD} | python3 -c "import urllib.parse; encoded_pass = urllib.parse.quote(input()); print(encoded_pass)" )@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_DB}${DATABASE_PROPERTIES} {{- else if and (not .Values.postgresql.enabled) (eq "mysql" .Values.externalDatabase.type) -}} -mysql+mysqldb://${DATABASE_USER}:$( echo ${DATABASE_PASSWORD} | python3 -c "import urllib.parse; encoded_pass = urllib.parse.quote(input()); print(encoded_pass)" )@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_DB} +mysql+mysqldb://${DATABASE_USER}:$( echo ${DATABASE_PASSWORD} | python3 -c "import urllib.parse; encoded_pass = urllib.parse.quote(input()); print(encoded_pass)" )@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_DB}${DATABASE_PROPERTIES} {{- end -}} {{- end -}} @@ -88,9 +88,9 @@ Construct the AIRFLOW__CELERY__RESULT_BACKEND connection string. {{- if .Values.postgresql.enabled -}} db+postgresql://${DATABASE_USER}:$( echo ${DATABASE_PASSWORD} | python3 -c "import urllib.parse; encoded_pass = urllib.parse.quote(input()); print(encoded_pass)" )@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_DB} {{- else if and (not .Values.postgresql.enabled) (eq "postgres" .Values.externalDatabase.type) -}} -db+postgresql://${DATABASE_USER}:$( echo ${DATABASE_PASSWORD} | python3 -c "import urllib.parse; encoded_pass = urllib.parse.quote(input()); print(encoded_pass)" )@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_DB} +db+postgresql://${DATABASE_USER}:$( echo ${DATABASE_PASSWORD} | python3 -c "import urllib.parse; encoded_pass = urllib.parse.quote(input()); print(encoded_pass)" )@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_DB}${DATABASE_PROPERTIES} {{- else if and (not .Values.postgresql.enabled) (eq "mysql" .Values.externalDatabase.type) -}} -db+mysql://${DATABASE_USER}:$( echo ${DATABASE_PASSWORD} | python3 -c "import urllib.parse; encoded_pass = urllib.parse.quote(input()); print(encoded_pass)" )@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_DB} +db+mysql://${DATABASE_USER}:$( echo ${DATABASE_PASSWORD} | python3 -c "import urllib.parse; encoded_pass = urllib.parse.quote(input()); print(encoded_pass)" )@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_DB}${DATABASE_PROPERTIES} {{- end -}} {{- end -}} diff --git a/stable/airflow/templates/configmap-env.yaml b/stable/airflow/templates/configmap-env.yaml index c12109e1af10..09d871c6800c 100644 --- a/stable/airflow/templates/configmap-env.yaml +++ b/stable/airflow/templates/configmap-env.yaml @@ -22,6 +22,7 @@ data: DATABASE_PORT: "{{ .Values.externalDatabase.port }}" DATABASE_USER: "{{ .Values.externalDatabase.user }}" DATABASE_DB: "{{ .Values.externalDatabase.database }}" + DATABASE_PROPERTIES: "{{.Values.externalDatabase.properties}}" {{- end }} {{- if (eq .Values.airflow.executor "CeleryExecutor") }} diff --git a/stable/airflow/values.yaml b/stable/airflow/values.yaml index 26c64519bc65..ab854131f54c 100644 --- a/stable/airflow/values.yaml +++ b/stable/airflow/values.yaml @@ -1202,6 +1202,9 @@ externalDatabase: ## passwordSecretKey: "postgresql-password" + ## the connection properties for external database, e.g. "?sslmode=require" + properties: "" + ################################### # Database - Redis Chart # - https://github.com/helm/charts/tree/master/stable/redis