Skip to content

Commit

Permalink
[stable/airflow] enable database properties configuration for externa…
Browse files Browse the repository at this point in the history
…l database (helm#23560)

Signed-off-by: Wei Sun <[email protected]>
  • Loading branch information
catweisun authored Aug 19, 2020
1 parent 141b43c commit 6dba24d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion stable/airflow/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
2 changes: 2 additions & 0 deletions stable/airflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:__

Expand Down
10 changes: 10 additions & 0 deletions stable/airflow/UPGRADE.md
Original file line number Diff line number Diff line change
@@ -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:__
Expand Down
8 changes: 4 additions & 4 deletions stable/airflow/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}

Expand All @@ -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 -}}

Expand Down
1 change: 1 addition & 0 deletions stable/airflow/templates/configmap-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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") }}
Expand Down
3 changes: 3 additions & 0 deletions stable/airflow/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6dba24d

Please sign in to comment.