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

Commit

Permalink
[6.8] [apm-server] Add option loadBalancerIP to service (#1075) (#1092)
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas Decaux <ebuildy@gmail.com>
  • Loading branch information
jmlrt and ebuildy authored Mar 9, 2021
1 parent d463738 commit 2cc10d0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apm-server/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ metadata:
{{- end }}
spec:
type: {{ .Values.service.type }}
{{- if .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
{{- with .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml . | indent 4 }}
{{- end }}
ports:
- port: {{ .Values.service.port }}
{{- with .Values.service.nodePort }}
Expand Down
14 changes: 14 additions & 0 deletions apm-server/tests/apmserver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ def test_defaults():
assert c["image"].startswith("docker.elastic.co/apm/apm-server:")
assert c["ports"][0]["containerPort"] == 8200

# Make sure that the default 'loadBalancerIP' string is empty
assert "loadBalancerIP" not in r["service"][name]["spec"]

assert "hostAliases" not in r["deployment"][name]["spec"]["template"]["spec"]


Expand Down Expand Up @@ -376,3 +379,14 @@ def test_hostaliases():
r = helm_template(config)
hostAliases = r["deployment"][name]["spec"]["template"]["spec"]["hostAliases"]
assert {"ip": "127.0.0.1", "hostnames": ["foo.local", "bar.local"]} in hostAliases


def test_adding_loadBalancerIP():
config = """
service:
loadBalancerIP: 12.5.11.79
"""

r = helm_template(config)

assert r["service"][name]["spec"]["loadBalancerIP"] == "12.5.11.79"
1 change: 1 addition & 0 deletions apm-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ ingress:

service:
type: ClusterIP
loadBalancerIP: ""
port: 8200
nodePort: ""
annotations: {}
Expand Down

0 comments on commit 2cc10d0

Please sign in to comment.