Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions chart/templates/scheduler/scheduler-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ spec:
imagePullSecrets:
- name: {{ template "registry_secret" . }}
{{- end }}
{{- if .Values.scheduler.hostAliases }}
hostAliases:
{{ toYaml .Values.scheduler.hostAliases | indent 8 }}
{{- end }}
initContainers:
{{- if .Values.scheduler.waitForMigrations.enabled }}
- name: wait-for-airflow-migrations
Expand Down
4 changes: 4 additions & 0 deletions chart/templates/webserver/webserver-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ spec:
{{- toYaml .Values.webserver.podAnnotations | nindent 8 }}
{{- end }}
spec:
{{- if .Values.webserver.hostAliases }}
hostAliases:
{{ toYaml .Values.webserver.hostAliases | indent 8 }}
{{- end }}
serviceAccountName: {{ include "webserver.serviceAccountName" . }}
{{- if .Values.webserver.priorityClassName }}
priorityClassName: {{ .Values.webserver.priorityClassName }}
Expand Down
44 changes: 44 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,28 @@
"x-docsSection": "Scheduler",
"additionalProperties": false,
"properties": {
"hostAliases": {
"description": "HostAliases for the scheduler pod.",
"items": {
"$ref": "#/definitions/io.k8s.api.core.v1.HostAlias"
},
"type": "array",
"default": [],
"examples": [
{
"ip": "127.0.0.1",
"hostnames": [
"foo.local"
]
},
{
"ip": "10.1.2.3",
"hostnames": [
"foo.remote"
]
}
]
},
"livenessProbe": {
"description": "Liveness probe configuration for scheduler container.",
"type": "object",
Expand Down Expand Up @@ -3108,6 +3130,28 @@
"x-docsSection": "Webserver",
"additionalProperties": false,
"properties": {
"hostAliases": {
"description": "HostAliases for the webserver pod.",
"items": {
"$ref": "#/definitions/io.k8s.api.core.v1.HostAlias"
},
"type": "array",
"default": [],
"examples": [
{
"ip": "127.0.0.1",
"hostnames": [
"foo.local"
]
},
{
"ip": "10.1.2.3",
"hostnames": [
"foo.remote"
]
}
]
},
"allowPodLogReading": {
"description": "Allow webserver to read k8s pod logs. Useful when you don't have an external log store.",
"type": "boolean",
Expand Down
17 changes: 17 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,15 @@ workers:

# Airflow scheduler settings
scheduler:
# hostAliases for the scheduler pod
hostAliases: []
# - ip: "127.0.0.1"
# hostnames:
# - "foo.local"
# - ip: "10.1.2.3"
# hostnames:
# - "foo.remote"

# If the scheduler stops heartbeating for 5 minutes (5*60s) kill the
# scheduler and let Kubernetes restart it
livenessProbe:
Expand Down Expand Up @@ -900,6 +909,14 @@ migrateDatabaseJob:

# Airflow webserver settings
webserver:
# hostAliases for the webserver pod
hostAliases: []
# - ip: "127.0.0.1"
# hostnames:
# - "foo.local"
# - ip: "10.1.2.3"
# hostnames:
# - "foo.remote"
allowPodLogReading: true
livenessProbe:
initialDelaySeconds: 15
Expand Down
13 changes: 13 additions & 0 deletions tests/charts/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,19 @@ def test_should_add_component_specific_annotations(self):
assert "annotations" in jmespath.search("metadata", docs[0])
assert jmespath.search("metadata.annotations", docs[0])["test_annotation"] == "test_annotation_value"

def test_scheduler_pod_hostaliases(self):
docs = render_chart(
values={
"scheduler": {
"hostAliases": [{"ip": "127.0.0.1", "hostnames": ["foo.local"]}],
},
},
show_only=["templates/scheduler/scheduler-deployment.yaml"],
)

assert "127.0.0.1" == jmespath.search("spec.template.spec.hostAliases[0].ip", docs[0])
assert "foo.local" == jmespath.search("spec.template.spec.hostAliases[0].hostnames[0]", docs[0])


class TestSchedulerNetworkPolicy:
def test_should_add_component_specific_labels(self):
Expand Down
13 changes: 13 additions & 0 deletions tests/charts/test_webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,19 @@ def test_should_add_component_specific_annotations(self):
assert "annotations" in jmespath.search("metadata", docs[0])
assert jmespath.search("metadata.annotations", docs[0])["test_annotation"] == "test_annotation_value"

def test_webserver_pod_hostaliases(self):
docs = render_chart(
values={
"webserver": {
"hostAliases": [{"ip": "127.0.0.1", "hostnames": ["foo.local"]}],
},
},
show_only=["templates/webserver/webserver-deployment.yaml"],
)

assert "127.0.0.1" == jmespath.search("spec.template.spec.hostAliases[0].ip", docs[0])
assert "foo.local" == jmespath.search("spec.template.spec.hostAliases[0].hostnames[0]", docs[0])


class TestWebserverService:
def test_default_service(self):
Expand Down