Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

added loadBalancerIP option to service #539

Merged
merged 1 commit into from
Mar 24, 2020
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
1 change: 1 addition & 0 deletions elasticsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ helm install --name elasticsearch elastic/elasticsearch --set imageTag=7.6.1
| `transportPort` | The transport port that Kubernetes will use for the service. If you change this you will also need to set [transport port configuration](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-transport.html#_transport_settings) in `extraEnvs` | `9300` |
| `service.labels` | Labels to be added to non-headless service | `{}` |
| `service.labelsHeadless` | Labels to be added to headless service | `{}` |
| `service.loadBalancerIP` | Some cloud providers allow you to specify the loadBalancerIP. If the loadBalancerIP field is not specified, the IP is dynamically assigned. If you specify a loadBalancerIP but your cloud provider does not support the feature, the loadbalancerIP field is ignored. [LoadBalancer options](https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) | `""` |
| `service.type` | Type of elasticsearch service. [Service Types](https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types) | `ClusterIP` |
| `service.nodePort` | Custom [nodePort](https://kubernetes.io/docs/concepts/services-networking/service/#nodeport) port that can be set if you are using `service.type: nodePort`. | `` |
| `service.annotations` | Annotations that Kubernetes will use for the service. This will configure load balancer if `service.type` is `LoadBalancer` [Annotations](https://kubernetes.io/docs/concepts/services-networking/service/#ssl-support-on-aws) | `{}` |
Expand Down
3 changes: 3 additions & 0 deletions elasticsearch/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ spec:
- name: {{ .Values.service.transportPortName | default "transport" }}
protocol: TCP
port: {{ .Values.transportPort }}
{{- if .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
{{- with .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml . | indent 4 }}
Expand Down
17 changes: 17 additions & 0 deletions elasticsearch/tests/elasticsearch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,23 @@ def test_adding_a_nodePort():
assert r["service"][uname]["spec"]["ports"][0]["nodePort"] == 30001


def test_adding_a_loadBalancerIP():
config = ""

r = helm_template(config)

assert "loadBalancerIP" not in r["service"][uname]["spec"]

config = """
service:
loadBalancerIP: 12.4.19.81
"""

r = helm_template(config)

assert r["service"][uname]["spec"]["loadBalancerIP"] == "12.4.19.81"


def test_adding_a_label_on_non_headless_service():
config = ""

Expand Down
1 change: 1 addition & 0 deletions elasticsearch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ service:
annotations: {}
httpPortName: http
transportPortName: transport
loadBalancerIP: ""
loadBalancerSourceRanges: []

updateStrategy: RollingUpdate
Expand Down