diff --git a/charts/airflow/docs/faq/configuration/airflow-configs.md b/charts/airflow/docs/faq/configuration/airflow-configs.md index d23bc024f4..85ee6db9fb 100644 --- a/charts/airflow/docs/faq/configuration/airflow-configs.md +++ b/charts/airflow/docs/faq/configuration/airflow-configs.md @@ -74,6 +74,10 @@ web: ## the name of an existing Secret containing a `webserver_config.py` key ## NOTE: if set, takes precedence over `web.webserverConfig.stringOverride` #existingSecret: "my-airflow-webserver-config" + + ## if the `webserver_config.py` file is mounted + ## NOTE: set to false if you wish to mount your own `webserver_config.py` file + #enabled: false ``` > 🟦 __Tip__ 🟦 diff --git a/charts/airflow/templates/config/secret-webserver-config.yaml b/charts/airflow/templates/config/secret-webserver-config.yaml index c38952c835..c1aaa6b75d 100644 --- a/charts/airflow/templates/config/secret-webserver-config.yaml +++ b/charts/airflow/templates/config/secret-webserver-config.yaml @@ -1,4 +1,4 @@ -{{- if not .Values.web.webserverConfig.existingSecret }} +{{- if and (.Values.web.webserverConfig.enabled) (not .Values.web.webserverConfig.existingSecret) }} apiVersion: v1 kind: Secret metadata: diff --git a/charts/airflow/templates/webserver/webserver-deployment.yaml b/charts/airflow/templates/webserver/webserver-deployment.yaml index 4e536dab7f..605b012cb3 100644 --- a/charts/airflow/templates/webserver/webserver-deployment.yaml +++ b/charts/airflow/templates/webserver/webserver-deployment.yaml @@ -42,7 +42,9 @@ spec: annotations: checksum/secret-config-envs: {{ include (print $.Template.BasePath "/config/secret-config-envs.yaml") . | sha256sum }} checksum/secret-local-settings: {{ include (print $.Template.BasePath "/config/secret-local-settings.yaml") . | sha256sum }} + {{- if and (.Values.web.webserverConfig.enabled) (not .Values.web.webserverConfig.existingSecret) }} checksum/config-webserver-config: {{ include (print $.Template.BasePath "/config/secret-webserver-config.yaml") . | sha256sum }} + {{- end }} {{- if .Values.airflow.podAnnotations }} {{- toYaml .Values.airflow.podAnnotations | nindent 8 }} {{- end }} @@ -136,10 +138,12 @@ spec: {{- end }} volumeMounts: {{- $volumeMounts | indent 12 }} + {{- if .Values.web.webserverConfig.enabled }} - name: webserver-config mountPath: /opt/airflow/webserver_config.py subPath: webserver_config.py readOnly: true + {{- end }} {{- if .Values.dags.gitSync.enabled }} {{- include "airflow.container.git_sync" . | indent 8 }} {{- end }} @@ -148,6 +152,7 @@ spec: {{- end }} volumes: {{- $volumes | indent 8 }} + {{- if .Values.web.webserverConfig.enabled }} - name: webserver-config secret: {{- if .Values.web.webserverConfig.existingSecret }} @@ -155,4 +160,5 @@ spec: {{- else }} secretName: {{ include "airflow.fullname" . }}-webserver-config {{- end }} - defaultMode: 0644 \ No newline at end of file + defaultMode: 0644 + {{- end }} diff --git a/charts/airflow/values.yaml b/charts/airflow/values.yaml index 9b7b987d96..de72da3001 100644 --- a/charts/airflow/values.yaml +++ b/charts/airflow/values.yaml @@ -664,6 +664,11 @@ web: ######################################## ## webserverConfig: + ## if the `webserver_config.py` file is mounted + ## - set to false if you wish to mount your own `webserver_config.py` file + ## + enabled: true + ## the full content of the `webserver_config.py` file (as a string) ## - docs for Flask-AppBuilder security configs: ## https://flask-appbuilder.readthedocs.io/en/latest/security.html