This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch v1-10-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 1bd745e1ca4897e419c3bfd8735e9fed46f15e1b Author: Daniel Imberman <[email protected]> AuthorDate: Thu Nov 12 20:58:13 2020 -0800 Mount airflow.cfg to pod_template_file (#12311) * Mount airflow.cfg to pod_template_file k8sexecutor workers were launching without an airflow.cfg, this was preventing logs from being sent to distributed logging systems. * consistent naming (cherry picked from commit ce06be4752708b35b074832b0f227177cad055fd) --- chart/files/pod-template-file.kubernetes-helm-yaml | 15 +++++++++++---- chart/tests/test_pod_template_file.py | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/chart/files/pod-template-file.kubernetes-helm-yaml b/chart/files/pod-template-file.kubernetes-helm-yaml index b4ec9a5..5c4fb92 100644 --- a/chart/files/pod-template-file.kubernetes-helm-yaml +++ b/chart/files/pod-template-file.kubernetes-helm-yaml @@ -40,6 +40,16 @@ spec: volumeMounts: - mountPath: {{ template "airflow_logs" . }} name: airflow-logs + - name: config + mountPath: {{ template "airflow_config_path" . }} + subPath: airflow.cfg + readOnly: true +{{- if .Values.scheduler.airflowLocalSettings }} + - name: config + mountPath: {{ template "airflow_local_setting_path" . }} + subPath: airflow_local_settings.py + readOnly: true +{{- end }} {{- if .Values.dags.gitSync.knownHosts }} - mountPath: /etc/git-secret/known_hosts name: {{ .Values.dags.gitSync.knownHosts }} @@ -92,7 +102,4 @@ spec: {{- end }} - configMap: name: {{ include "airflow_config" . }} - name: airflow-config - - configMap: - name: {{ include "airflow_config" . }} - name: airflow-local-settings + name: config diff --git a/chart/tests/test_pod_template_file.py b/chart/tests/test_pod_template_file.py index 3c61733..fb0dd45 100644 --- a/chart/tests/test_pod_template_file.py +++ b/chart/tests/test_pod_template_file.py @@ -185,6 +185,27 @@ class PodTemplateFileTest(unittest.TestCase): self.assertEqual("dummy_image:latest", jmespath.search("spec.containers[0].image", docs[0])) self.assertEqual("base", jmespath.search("spec.containers[0].name", docs[0])) + def test_mount_airflow_cfg(self): + docs = render_chart( + values={}, + show_only=["templates/pod-template-file.yaml"], + ) + + self.assertRegex(docs[0]["kind"], "Pod") + self.assertDictEqual( + {'configMap': {'name': 'RELEASE-NAME-airflow-config'}, 'name': 'airflow-config'}, + jmespath.search("spec.volumes[1]", docs[0]), + ) + self.assertDictEqual( + { + 'name': 'config', + 'mountPath': '/opt/airflow/airflow.cfg', + 'subPath': 'airflow.cfg', + 'readOnly': True, + }, + jmespath.search("spec.containers[0].volumeMounts[1]", docs[0]), + ) + def test_should_create_valid_affinity_and_node_selector(self): docs = render_chart( values={
