diff --git a/elasticsearch/README.md b/elasticsearch/README.md index a4948bda4..31068040c 100644 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -124,6 +124,7 @@ support multiple versions with minimal changes. | Parameter | Description | Default | |------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------| +| `annotations` | Configurable [annotations][] applied to the Elasticsearch Statefulset | `{}` | `antiAffinityTopologyKey` | The [anti-affinity][] topology key. By default this will prevent multiple Elasticsearch 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` | | `clusterHealthCheckParams` | The [Elasticsearch cluster health status params][] that will be used by readiness [probe][] command | `wait_for_status=green&timeout=1s` | diff --git a/elasticsearch/templates/statefulset.yaml b/elasticsearch/templates/statefulset.yaml index 64fd42330..33563e5ed 100644 --- a/elasticsearch/templates/statefulset.yaml +++ b/elasticsearch/templates/statefulset.yaml @@ -13,6 +13,9 @@ metadata: {{- end }} annotations: esMajorVersion: "{{ include "elasticsearch.esMajorVersion" . }}" + {{- range $key, $value := .Values.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} spec: serviceName: {{ template "elasticsearch.uname" . }}-headless selector: diff --git a/elasticsearch/tests/elasticsearch_test.py b/elasticsearch/tests/elasticsearch_test.py index 00e9abd80..13d4181ac 100644 --- a/elasticsearch/tests/elasticsearch_test.py +++ b/elasticsearch/tests/elasticsearch_test.py @@ -522,6 +522,19 @@ def test_adding_tolerations(): == "key1" ) +def test_adding_annotations(): + config = """ +annotations: + key: value +""" + r = helm_template(config) + assert ( + r["statefulset"][uname]["metadata"]["annotations"][ + "key" + ] + == "value" + ) + def test_adding_pod_annotations(): config = """ diff --git a/elasticsearch/values.yaml b/elasticsearch/values.yaml index 4143d619c..152126625 100644 --- a/elasticsearch/values.yaml +++ b/elasticsearch/values.yaml @@ -82,6 +82,8 @@ imagePullPolicy: "IfNotPresent" podAnnotations: {} # iam.amazonaws.com/role: es-cluster +annotations: {} + # additionals labels labels: {}