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

Add Statefulset Annotations #1770

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
1 change: 1 addition & 0 deletions elasticsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down
3 changes: 3 additions & 0 deletions elasticsearch/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions elasticsearch/tests/elasticsearch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """
Expand Down
2 changes: 2 additions & 0 deletions elasticsearch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ imagePullPolicy: "IfNotPresent"
podAnnotations: {}
# iam.amazonaws.com/role: es-cluster

annotations: {}

# additionals labels
labels: {}

Expand Down