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

[6.8] [apm-server] Add option loadBalancerIP to service (#1075) #1092

Merged
merged 1 commit into from
Mar 9, 2021
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
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