From 8ed75a90d5ae2df5c5f8eff4a08e64b19fe04e4e Mon Sep 17 00:00:00 2001 From: Simon Gurcke Date: Thu, 27 Aug 2020 20:13:19 +1000 Subject: [PATCH] [logstash] Fix headless service ports spec (#776) Co-authored-by: Julien Mailleret <8582351+jmlrt@users.noreply.github.com> --- logstash/templates/service-headless.yaml | 9 +++++---- logstash/tests/logstash_test.py | 7 +++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/logstash/templates/service-headless.yaml b/logstash/templates/service-headless.yaml index 2bf840b34..157e4a66f 100644 --- a/logstash/templates/service-headless.yaml +++ b/logstash/templates/service-headless.yaml @@ -16,8 +16,9 @@ spec: selector: app: "{{ template "logstash.fullname" . }}" ports: - - name: http - port: {{ .Values.httpPort }} -{{- if .Values.extraPorts }} -{{- toYaml .Values.extraPorts | nindent 2 }} +{{- if .Values.service }} +{{ toYaml .Values.service.ports | indent 4 }} +{{- else }} + - name: http + port: {{ .Values.httpPort }} {{- end }} diff --git a/logstash/tests/logstash_test.py b/logstash/tests/logstash_test.py index 6b29dacdf..a96ce0a20 100755 --- a/logstash/tests/logstash_test.py +++ b/logstash/tests/logstash_test.py @@ -860,6 +860,13 @@ def test_adding_a_service(): "protocol": "TCP", "targetPort": 5044, } + h = r["service"][name + "-headless"] + assert h["spec"]["ports"][0] == { + "name": "beats", + "port": 5044, + "protocol": "TCP", + "targetPort": 5044, + } def test_setting_fullnameOverride():