From eb6d76a413d6df563d7107ace0abf868adfd564b Mon Sep 17 00:00:00 2001 From: loli Date: Mon, 24 Apr 2023 19:36:00 +0200 Subject: [PATCH] logstash Add Statefulset Annotations --- logstash/README.md | 1 + logstash/templates/statefulset.yaml | 4 ++++ logstash/tests/logstash_test.py | 14 ++++++++++++++ logstash/values.yaml | 3 +++ 4 files changed, 22 insertions(+) mode change 100644 => 100755 logstash/README.md mode change 100644 => 100755 logstash/templates/statefulset.yaml mode change 100644 => 100755 logstash/tests/logstash_test.py mode change 100644 => 100755 logstash/values.yaml diff --git a/logstash/README.md b/logstash/README.md old mode 100644 new mode 100755 index bf6c30709..ac2414cfa --- a/logstash/README.md +++ b/logstash/README.md @@ -113,6 +113,7 @@ useful for the [http input plugin][], for instance. | Parameter | Description | Default | |---------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------| +| `annotations` | Configurable [annotations][] applied to the Elasticsearch Statefulset | `{}` | | `antiAffinityTopologyKey` | The [anti-affinity][] topology key]. By default this will prevent multiple Logstash nodes from running on the same Kubernetes node | `kubernetes.io/hostname` | | `antiAffinity` | Setting this to hard enforces the [anti-affinity][] rules. If it is set to soft it will be done "best effort". Other values will be ignored | `hard` | | `envFrom` | Templatable string to be passed to the [environment from variables][] which will be appended to the `envFrom:` definition for the container | `[]` | diff --git a/logstash/templates/statefulset.yaml b/logstash/templates/statefulset.yaml old mode 100644 new mode 100755 index 239fac33f..53e9bf6c5 --- a/logstash/templates/statefulset.yaml +++ b/logstash/templates/statefulset.yaml @@ -11,6 +11,10 @@ metadata: {{- range $key, $value := .Values.labels }} {{ $key }}: {{ $value | quote }} {{- end }} + annotations: + {{- range $key, $value := .Values.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} spec: serviceName: {{ template "logstash.fullname" . }}-headless selector: diff --git a/logstash/tests/logstash_test.py b/logstash/tests/logstash_test.py old mode 100644 new mode 100755 index 112f2ab6c..c495b89fa --- a/logstash/tests/logstash_test.py +++ b/logstash/tests/logstash_test.py @@ -546,6 +546,20 @@ def test_adding_tolerations(): ) +def test_adding_annotations(): + config = """ +annotations: + key: value +""" + r = helm_template(config) + assert ( + r["statefulset"][name]["metadata"]["annotations"][ + "key" + ] + == "value" + ) + + def test_adding_pod_annotations(): config = """ podAnnotations: diff --git a/logstash/values.yaml b/logstash/values.yaml old mode 100644 new mode 100755 index 026c13d03..ed52d63b4 --- a/logstash/values.yaml +++ b/logstash/values.yaml @@ -75,6 +75,9 @@ imageTag: "8.5.1" imagePullPolicy: "IfNotPresent" imagePullSecrets: [] +# Statefulset annotations +annotations: {} + podAnnotations: {} # additionals labels