diff --git a/elasticsearch/README.md b/elasticsearch/README.md index 9a4bdd70f..818d2e4c9 100644 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -74,6 +74,7 @@ helm install --name elasticsearch elastic/elasticsearch --version 7.2.0 --set im | `imageTag` | The Elasticsearch docker image tag | `7.2.0` | | `imagePullPolicy` | The Kubernetes [imagePullPolicy](https://kubernetes.io/docs/concepts/containers/images/#updating-images) value | `IfNotPresent` | | `podAnnotations` | Configurable [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) applied to all Elasticsearch pods | `{}` | +| `labels` | Configurable [label](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) applied to all Elasticsearch pods | `{}` | | `esJavaOpts` | [Java options](https://www.elastic.co/guide/en/elasticsearch/reference/current/jvm-options.html) for Elasticsearch. This is where you should configure the [jvm heap size](https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html) | `-Xmx1g -Xms1g` | | `resources` | Allows you to set the [resources](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/) for the statefulset | `requests.cpu: 100m`
`requests.memory: 2Gi`
`limits.cpu: 1000m`
`limits.memory: 2Gi` | | `initResources` | Allows you to set the [resources](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/) for the initContainer in the statefulset | {} | diff --git a/elasticsearch/templates/statefulset.yaml b/elasticsearch/templates/statefulset.yaml index b085dade4..30dcec51e 100644 --- a/elasticsearch/templates/statefulset.yaml +++ b/elasticsearch/templates/statefulset.yaml @@ -8,6 +8,9 @@ metadata: release: {{ .Release.Name | quote }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" app: "{{ template "uname" . }}" + {{- range $key, $value := .Values.labels }} + {{ $key }}: {{ $value | quote }} + {{- end }} annotations: esMajorVersion: "{{ include "esMajorVersion" . }}" spec: diff --git a/elasticsearch/tests/elasticsearch_test.py b/elasticsearch/tests/elasticsearch_test.py index 66b514104..cdc08a79a 100755 --- a/elasticsearch/tests/elasticsearch_test.py +++ b/elasticsearch/tests/elasticsearch_test.py @@ -785,3 +785,11 @@ def test_set_container_security_context(): assert c['securityContext']['runAsNonRoot'] == True assert c['securityContext']['runAsUser'] == 1001 assert c['securityContext']['other'] == 'test' + +def test_adding_pod_labels(): + config = ''' +labels: + app.kubernetes.io/name: elasticsearch +''' + r = helm_template(config) + assert r['statefulset'][uname]['metadata']['labels']['app.kubernetes.io/name'] == 'elasticsearch' diff --git a/elasticsearch/values.yaml b/elasticsearch/values.yaml index 6e53ee60d..9caf0bcce 100755 --- a/elasticsearch/values.yaml +++ b/elasticsearch/values.yaml @@ -49,6 +49,9 @@ imagePullPolicy: "IfNotPresent" podAnnotations: {} # iam.amazonaws.com/role: es-cluster +# additionals labels +labels: {} + esJavaOpts: "-Xmx1g -Xms1g" resources: