Skip to content

Commit

Permalink
Chart: Add loadBalancerSourceRanges in webserver and flower services (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
Diogo-Costa authored Aug 20, 2021
1 parent 22e87b3 commit 00dc3c4
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chart/templates/flower/flower-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,9 @@ spec:
{{- if .Values.flower.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.flower.service.loadBalancerIP }}
{{- end }}
{{- if .Values.flower.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- toYaml .Values.flower.service.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
4 changes: 4 additions & 0 deletions chart/templates/webserver/webserver-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ spec:
{{- if .Values.webserver.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.webserver.service.loadBalancerIP }}
{{- end }}
{{- if .Values.webserver.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- toYaml .Values.webserver.service.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
2 changes: 2 additions & 0 deletions chart/tests/test_flower.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def test_overrides(self):
"type": "LoadBalancer",
"loadBalancerIP": "127.0.0.1",
"annotations": {"foo": "bar"},
"loadBalancerSourceRanges": ["10.123.0.0/16"],
}
},
},
Expand All @@ -290,6 +291,7 @@ def test_overrides(self):
assert "LoadBalancer" == jmespath.search("spec.type", docs[0])
assert {"name": "flower-ui", "port": 9000} in jmespath.search("spec.ports", docs[0])
assert "127.0.0.1" == jmespath.search("spec.loadBalancerIP", docs[0])
assert ["10.123.0.0/16"] == jmespath.search("spec.loadBalancerSourceRanges", docs[0])

@pytest.mark.parametrize(
"ports, expected_ports",
Expand Down
2 changes: 2 additions & 0 deletions chart/tests/test_webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ def test_overrides(self):
"type": "LoadBalancer",
"loadBalancerIP": "127.0.0.1",
"annotations": {"foo": "bar"},
"loadBalancerSourceRanges": ["10.123.0.0/16"],
}
},
},
Expand All @@ -462,6 +463,7 @@ def test_overrides(self):
assert "LoadBalancer" == jmespath.search("spec.type", docs[0])
assert {"name": "airflow-ui", "port": 9000} in jmespath.search("spec.ports", docs[0])
assert "127.0.0.1" == jmespath.search("spec.loadBalancerIP", docs[0])
assert ["10.123.0.0/16"] == jmespath.search("spec.loadBalancerSourceRanges", docs[0])

@parameterized.expand(
[
Expand Down
16 changes: 16 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,14 @@
"null"
],
"default": null
},
"loadBalancerSourceRanges": {
"description": "Webserver Service loadBalancerSourceRanges.",
"type": "array",
"default": [],
"examples": [
"10.123.0.0/16"
]
}
}
},
Expand Down Expand Up @@ -1995,6 +2003,14 @@
"null"
],
"default": null
},
"loadBalancerSourceRanges": {
"description": "Flower Service loadBalancerSourceRanges.",
"type": "array",
"default": [],
"examples": [
"10.123.0.0/16"
]
}
}
},
Expand Down
8 changes: 8 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,10 @@ webserver:
# port: 80
# targetPort: 8888
loadBalancerIP: ~
## Limit load balancer source ips to list of CIDRs
# loadBalancerSourceRanges:
# - "10.123.0.0/16"
loadBalancerSourceRanges: []

# Select certain nodes for airflow webserver pods.
nodeSelector: {}
Expand Down Expand Up @@ -781,6 +785,10 @@ flower:
# port: 8080
# targetPort: flower-ui
loadBalancerIP: ~
## Limit load balancer source ips to list of CIDRs
# loadBalancerSourceRanges:
# - "10.123.0.0/16"
loadBalancerSourceRanges: []

# Launch additional containers into the flower pods.
extraContainers: []
Expand Down

0 comments on commit 00dc3c4

Please sign in to comment.