diff --git a/chart/templates/flower/flower-deployment.yaml b/chart/templates/flower/flower-deployment.yaml index ed049c1b7231c..cb162414174f5 100644 --- a/chart/templates/flower/flower-deployment.yaml +++ b/chart/templates/flower/flower-deployment.yaml @@ -127,9 +127,15 @@ spec: {{- end }} {{- include "standard_airflow_environment" . | indent 10 }} {{- include "custom_airflow_environment" . | indent 10 }} +{{- if .Values.flower.extraContainers }} +{{- toYaml .Values.flower.extraContainers | nindent 8 }} +{{- end }} volumes: - name: config configMap: name: {{ template "airflow_config" . }} +{{- if .Values.flower.extraVolumes }} +{{ toYaml .Values.flower.extraVolumes | indent 8 }} +{{- end }} {{- end }} {{- end }} diff --git a/chart/tests/test_flower.py b/chart/tests/test_flower.py index b98bddd5a32d7..6ab2ff7e0220f 100644 --- a/chart/tests/test_flower.py +++ b/chart/tests/test_flower.py @@ -204,6 +204,37 @@ def test_flower_resources_are_not_added_by_default(self): ) assert jmespath.search("spec.template.spec.containers[0].resources", docs[0]) == {} + def test_should_add_extra_containers(self): + docs = render_chart( + values={ + "flower": { + "extraContainers": [ + {"name": "test-container", "image": "test-registry/test-repo:test-tag"} + ], + }, + }, + show_only=["templates/flower/flower-deployment.yaml"], + ) + + assert { + "name": "test-container", + "image": "test-registry/test-repo:test-tag", + } == jmespath.search("spec.template.spec.containers[-1]", docs[0]) + + def test_should_add_extra_volumes(self): + docs = render_chart( + values={ + "flower": { + "extraVolumes": [{"name": "myvolume", "emptyDir": {}}], + }, + }, + show_only=["templates/flower/flower-deployment.yaml"], + ) + + assert {"name": "myvolume", "emptyDir": {}} == jmespath.search( + "spec.template.spec.volumes[-1]", docs[0] + ) + class TestFlowerService: @pytest.mark.parametrize( diff --git a/chart/values.schema.json b/chart/values.schema.json index 1b1feccf54f25..a72e44c713149 100644 --- a/chart/values.schema.json +++ b/chart/values.schema.json @@ -1899,6 +1899,16 @@ } } }, + "extraContainers": { + "description": "Launch additional containers into the flower pods.", + "type": "array", + "default": [] + }, + "extraVolumes": { + "description": "Mount additional volumes into the flower pods.", + "type": "array", + "default": [] + }, "nodeSelector": { "description": "Select certain nodes for Flower pods.", "type": "object", diff --git a/chart/values.yaml b/chart/values.yaml index 651e8034ae95e..19d697fed1501 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -741,6 +741,11 @@ flower: annotations: {} loadBalancerIP: ~ + # Launch additional containers into the flower pods. + extraContainers: [] + # Mount additional volumes into the flower pods. + extraVolumes: [] + # Select certain nodes for airflow flower pods. nodeSelector: {} affinity: {}