From 93fd17bffd9914cab8ba2428e3736cd722eaadb2 Mon Sep 17 00:00:00 2001 From: Carlos Escura Date: Wed, 22 Apr 2020 18:27:53 +0200 Subject: [PATCH] [stable/airflow] fix: postgres to postgresql for all variables (#21748) * fix: postgres to postgresql for all variables * fix: postgres to postgresql for all variables * refactor: use recommended default function Signed-off-by: carlosescura * Bump Airflow chart version Signed-off-by: carlosescura * Revert README.md modification Signed-off-by: carlosescura * fix: Add new Postgresql variables to readme Signed-off-by: carlosescura --- stable/airflow/Chart.yaml | 2 +- stable/airflow/README.md | 7 ++++--- stable/airflow/templates/_helpers.tpl | 20 ++++++++++---------- stable/airflow/values.yaml | 4 ++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/stable/airflow/Chart.yaml b/stable/airflow/Chart.yaml index e38d105485..eace5e7ee2 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: 6.7.0 +version: 6.7.1 appVersion: 1.10.4 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 d0018288ec..5f94c74acb 100644 --- a/stable/airflow/README.md +++ b/stable/airflow/README.md @@ -244,7 +244,7 @@ By default, insecure username/password combinations are used. For a real production deployment, it's a good idea to create secure credentials before installing the Helm chart. For example, from the command line, run: ```bash -kubectl create secret generic airflow-postgres --from-literal=postgresql-password=$(openssl rand -base64 13) +kubectl create secret generic airflow-postgresql --from-literal=postgresql-password=$(openssl rand -base64 13) kubectl create secret generic airflow-redis --from-literal=redis-password=$(openssl rand -base64 13) ``` Next, you can use those secrets with the Helm chart: @@ -252,7 +252,7 @@ Next, you can use those secrets with the Helm chart: # values.yaml postgresql: - existingSecret: airflow-postgres + existingSecret: airflow-postgresql redis: existingSecret: airflow-redis @@ -557,7 +557,7 @@ The following table lists the configurable parameters of the Airflow chart and t | `postgresql.existingSecret` | The name of an existing secret with a key named `postgresql.existingSecretKey` to use as the password | `nil` | | `postgresql.existingSecretKey` | The name of the key containing the password in the secret named `postgresql.existingSecret` | `postgresql-password` | | `postgresql.uri` | full URL to custom postgres setup | (undefined) | -| `postgresql.postgresHost` | PostgreSQL Hostname | (undefined) | +| `postgresql.postgresqlHost` | PostgreSQL Hostname | (undefined) | | `postgresql.postgresqlUsername` | PostgreSQL User | `postgres` | | `postgresql.postgresqlPassword` | PostgreSQL Password | `airflow` | | `postgresql.postgresqlDatabase` | PostgreSQL Database name | `airflow` | @@ -592,6 +592,7 @@ There are a few config key changes, in order to upgrade from a 5.x chart, modify | 5.x.x | 6.x.x | Notes | |--------------------------------------|---------------------------------------|-----------------------------------------------------------| +|`postgresql.postgresHost` |`postgresql.postgresqlHost` | | |`postgresql.postgresUser` |`postgresql.postgresqlUsername` | | |`postgresql.postgresPassword` |`postgresql.postgresqlPassword` | | |`postgresql.postgresDatabase` |`postgresql.postgresqlDatabase` | | diff --git a/stable/airflow/templates/_helpers.tpl b/stable/airflow/templates/_helpers.tpl index b253a1e0d3..8a258f6f16 100644 --- a/stable/airflow/templates/_helpers.tpl +++ b/stable/airflow/templates/_helpers.tpl @@ -3,7 +3,7 @@ Expand the name of the chart. */}} {{- define "airflow.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- .Values.nameOverride | default .Chart.Name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* @@ -26,21 +26,21 @@ Create the name of the service account to use */}} {{- define "airflow.serviceAccountName" -}} {{- if .Values.serviceAccount.create -}} - {{ default (include "airflow.fullname" .) .Values.serviceAccount.name }} + {{ .Values.serviceAccount.name | default (include "airflow.fullname" .) }} {{- else -}} - {{ default "default" .Values.serviceAccount.name }} + {{ .Values.serviceAccount.name | default "default" }} {{- end -}} {{- end -}} {{/* -Create a default fully qualified postgresql name or use the `postgresHost` value if defined. +Create a default fully qualified postgresql name or use the `postgresqlHost` value if defined. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} {{- define "airflow.postgresql.fullname" -}} -{{- if .Values.postgresql.postgresHost }} - {{- .Values.postgresql.postgresHost -}} +{{- if .Values.postgresql.postgresqlHost }} + {{- .Values.postgresql.postgresqlHost -}} {{- else }} - {{- $name := default "postgresql" .Values.postgresql.nameOverride -}} + {{- $name := .Values.postgresql.nameOverride | default "postgresql" -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{- end -}} @@ -98,19 +98,19 @@ The key names for postgres and redis are fixed, which is consistent with the sub */}} {{- define "airflow.mapenvsecrets" }} - name: POSTGRES_USER - value: {{ default "postgres" .Values.postgresql.postgresUser | quote }} + value: {{ .Values.postgresql.postgresqlUsername | default "postgres" | quote }} {{- if or .Values.postgresql.existingSecret .Values.postgresql.enabled }} - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: - name: {{ default (include "airflow.postgresql.fullname" .) .Values.postgresql.existingSecret }} + name: {{ .Values.postgresql.existingSecret | default (include "airflow.postgresql.fullname" .) }} key: {{ .Values.postgresql.existingSecretKey }} {{- end }} {{- if or .Values.redis.existingSecret .Values.redis.enabled }} - name: REDIS_PASSWORD valueFrom: secretKeyRef: - name: {{ default (include "airflow.redis.fullname" .) .Values.redis.existingSecret }} + name: {{ .Values.redis.existingSecret | default (include "airflow.redis.fullname" .) }} key: {{ .Values.redis.existingSecretKey }} {{- end }} {{- if .Values.airflow.extraEnv }} diff --git a/stable/airflow/values.yaml b/stable/airflow/values.yaml index bb986d489d..90bf0827b9 100644 --- a/stable/airflow/values.yaml +++ b/stable/airflow/values.yaml @@ -650,9 +650,9 @@ postgresql: existingSecretKey: postgresql-password ## - ## If you are bringing your own PostgreSQL, you should set postgresHost and + ## If you are bringing your own PostgreSQL, you should set postgresqlHost and ## also probably service.port, postgresqlUsername, postgresqlPassword, and postgresqlDatabase - ## postgresHost: + ## postgresqlHost: ## ## PostgreSQL port service: