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

[logstash] add headless service for statefulset #695

Merged
merged 4 commits into from
Jun 29, 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
23 changes: 23 additions & 0 deletions logstash/templates/service-headless.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
kind: Service
apiVersion: v1
metadata:
name: "{{ template "logstash.fullname" . }}-headless"
labels:
app: "{{ template "logstash.fullname" . }}"
chart: "{{ .Chart.Name }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
{{- if .Values.labels }}
{{ toYaml .Values.labels | indent 4 }}
{{- end }}
spec:
clusterIP: None
selector:
app: "{{ template "logstash.fullname" . }}"
ports:
- name: http
port: {{ .Values.httpPort }}
{{- if .Values.extraPorts }}
{{- toYaml .Values.extraPorts | nindent 2 }}
{{- end }}
6 changes: 2 additions & 4 deletions logstash/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ metadata:
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
{{- if .Values.service }}
serviceName: {{ template "logstash.fullname" . }}
{{- end }}
serviceName: {{ template "logstash.fullname" . }}-headless
selector:
matchLabels:
app: "{{ template "logstash.fullname" . }}"
Expand Down Expand Up @@ -151,7 +149,7 @@ spec:
- name: http
containerPort: {{ .Values.httpPort }}
{{- if .Values.extraPorts }}
{{- toYaml .Values.extraPorts | nindent 8 }}
{{- toYaml .Values.extraPorts | nindent 8 }}
{{- end }}
resources:
{{ toYaml .Values.resources | indent 10 }}
Expand Down
5 changes: 3 additions & 2 deletions logstash/tests/logstash_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ def test_defaults():
)

# Service
assert "serviceName" not in r["statefulset"][name]["spec"]
assert "service" not in r
assert r["statefulset"][name]["spec"]["serviceName"] == name + "-headless"
assert name + "-headless" in r["service"]
assert r["service"][name + "-headless"]["spec"]["ports"][0]["port"] == 9600

# Other
assert r["statefulset"][name]["spec"]["template"]["spec"]["securityContext"] == {
Expand Down