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

Logstash: Add option to configure PVC labels in StatefulSets #1656

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions logstash/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ spec:
volumeClaimTemplates:
- metadata:
name: {{ template "logstash.fullname" . }}
{{- if .Values.persistence.labels.enabled }}
labels:
app: "{{ template "logstash.fullname" . }}"
chart: "{{ .Chart.Name }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
{{- range $key, $value := .Values.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
{{- with .Values.persistence.annotations }}
annotations:
{{ toYaml . | indent 8 }}
Expand Down
13 changes: 13 additions & 0 deletions logstash/tests/logstash_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,19 @@ def test_adding_persistence():
assert v["spec"]["resources"]["requests"]["storage"] == "1Gi"


def test_adding_persistence_label_in_volumeclaimtemplate():
config = """
persistence:
enabled: true
labels:
enabled: true
"""
r = helm_template(config)
v = r["statefulset"][name]["spec"]["volumeClaimTemplates"][0]["metadata"]["labels"]
sts = r["statefulset"][name]["metadata"]["labels"]
assert v == sts


def test_adding_storageclass_annotation_to_volumeclaimtemplate():
config = """
persistence:
Expand Down
3 changes: 3 additions & 0 deletions logstash/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ podSecurityPolicy:

persistence:
enabled: false
# Add default labels for the volumeClaimTemplate fo the StatefulSet
labels:
enabled: false
annotations: {}

extraVolumes:
Expand Down