From f11c1b7cd218729df27ac4c7d14c61493f681cda Mon Sep 17 00:00:00 2001 From: Nithya Date: Mon, 26 Apr 2021 22:14:21 +0530 Subject: [PATCH 1/2] [logstash] Add option loadBalancerIP to service (#1099) --- logstash/templates/service.yaml | 7 +++++++ logstash/tests/logstash_test.py | 12 ++++++++++++ logstash/values.yaml | 1 + 3 files changed, 20 insertions(+) diff --git a/logstash/templates/service.yaml b/logstash/templates/service.yaml index 6540c8c61..d3a61bc7a 100644 --- a/logstash/templates/service.yaml +++ b/logstash/templates/service.yaml @@ -13,6 +13,13 @@ metadata: {{ toYaml .Values.service.annotations | indent 4 }} spec: type: {{ .Values.service.type }} +{{- if .Values.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} +{{- end }} +{{- with .Values.service.loadBalancerSourceRanges }} + loadBalancerSourceRanges: +{{ toYaml . | indent 4 }} +{{- end }} selector: app: "{{ template "logstash.fullname" . }}" chart: "{{ .Chart.Name }}" diff --git a/logstash/tests/logstash_test.py b/logstash/tests/logstash_test.py index 6c76501cb..fadd35327 100755 --- a/logstash/tests/logstash_test.py +++ b/logstash/tests/logstash_test.py @@ -881,6 +881,8 @@ def test_adding_a_service(): "protocol": "TCP", "targetPort": 5044, } + # Make sure that the default 'loadBalancerIP' string is empty + assert "loadBalancerIP" not in s["spec"] def test_setting_fullnameOverride(): @@ -935,3 +937,13 @@ def test_hostaliases(): r = helm_template(config) hostAliases = r["statefulset"][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" diff --git a/logstash/values.yaml b/logstash/values.yaml index bfb2b748a..d20c4d630 100755 --- a/logstash/values.yaml +++ b/logstash/values.yaml @@ -253,6 +253,7 @@ lifecycle: {} service: {} # annotations: {} # type: ClusterIP +# loadBalancerIP: "" # ports: # - name: beats # port: 5044 From f4bacf8ab1b3c22ec49a4b39402f8ea76ff90243 Mon Sep 17 00:00:00 2001 From: Julien Mailleret <8582351+jmlrt@users.noreply.github.com> Date: Mon, 10 May 2021 13:28:44 +0200 Subject: [PATCH 2/2] Update logstash/tests/logstash_test.py --- logstash/tests/logstash_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/logstash/tests/logstash_test.py b/logstash/tests/logstash_test.py index fadd35327..3f44ceb9c 100755 --- a/logstash/tests/logstash_test.py +++ b/logstash/tests/logstash_test.py @@ -938,6 +938,7 @@ def test_hostaliases(): hostAliases = r["statefulset"][name]["spec"]["template"]["spec"]["hostAliases"] assert {"ip": "127.0.0.1", "hostnames": ["foo.local", "bar.local"]} in hostAliases + def test_adding_loadBalancerIP(): config = """ service: