Skip to content

Commit

Permalink
Chart: Support extraContainers and extraVolumes in flower (#1…
Browse files Browse the repository at this point in the history
…6515)

This allows for deploying sidecars in the flower pod.
  • Loading branch information
jedcunningham committed Jun 18, 2021
1 parent 0bdf89c commit a7738cf
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chart/templates/flower/flower-deployment.yaml
Expand Up @@ -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 }}
31 changes: 31 additions & 0 deletions chart/tests/test_flower.py
Expand Up @@ -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(
Expand Down
10 changes: 10 additions & 0 deletions chart/values.schema.json
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions chart/values.yaml
Expand Up @@ -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: {}
Expand Down

0 comments on commit a7738cf

Please sign in to comment.