From c929c9bcfe27bfa68082b65af2cc930684174314 Mon Sep 17 00:00:00 2001 From: hightoxicity Date: Tue, 5 Oct 2021 08:42:34 +0200 Subject: [PATCH] Allow to specify kibana deploy annotations --- kibana/README.md | 1 + kibana/templates/deployment.yaml | 6 ++++++ kibana/tests/kibana_test.py | 14 ++++++++++++++ kibana/values.yaml | 2 ++ 4 files changed, 23 insertions(+) diff --git a/kibana/README.md b/kibana/README.md index 8578a50f2..6c3e22c13 100644 --- a/kibana/README.md +++ b/kibana/README.md @@ -80,6 +80,7 @@ as a reference. They are also used in the automated testing of this chart. | Parameter | Description | Default | |-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------| | `affinity` | Configurable [affinity][] | `{}` | +| `annotations` | Configurable [annotations][] on the deployment object | `{}` | `elasticsearchHosts` | The URLs used to connect to Elasticsearch | `http://elasticsearch-master:9200` | | `envFrom` | Templatable string to be passed to the [environment from variables][] which will be appended to the `envFrom:` definition for the container | `[]` | | `extraContainers` | Templatable string of additional containers to be passed to the `tpl` function | `""` | diff --git a/kibana/templates/deployment.yaml b/kibana/templates/deployment.yaml index 71703271f..0cc4ab10b 100644 --- a/kibana/templates/deployment.yaml +++ b/kibana/templates/deployment.yaml @@ -3,6 +3,12 @@ kind: Deployment metadata: name: {{ template "kibana.fullname" . }} labels: {{ include "kibana.labels" . | nindent 4 }} + {{- if .Values.annotations }} + annotations: + {{- range $anKey, $anVal := .Values.annotations }} + {{ $anKey }}: {{ $anVal | quote }} + {{- end }} + {{- end }} spec: replicas: {{ .Values.replicas }} strategy: diff --git a/kibana/tests/kibana_test.py b/kibana/tests/kibana_test.py index a7411f358..9751ccd6b 100644 --- a/kibana/tests/kibana_test.py +++ b/kibana/tests/kibana_test.py @@ -94,6 +94,20 @@ def test_overriding_the_port(): assert r["service"][name]["spec"]["ports"][0]["targetPort"] == 5602 +def test_adding_annotations(): + config = """ +annotations: + iam.amazonaws.com/role: es-role +""" + r = helm_template(config) + assert ( + r["deployment"][name]["metadata"]["annotations"][ + "iam.amazonaws.com/role" + ] + == "es-role" + ) + + def test_adding_env_from(): config = """ envFrom: diff --git a/kibana/values.yaml b/kibana/values.yaml index f62775654..97921b99b 100755 --- a/kibana/values.yaml +++ b/kibana/values.yaml @@ -3,6 +3,8 @@ elasticsearchHosts: "http://elasticsearch-master:9200" replicas: 1 +annotations: {} + # Extra environment variables to append to this nodeGroup # This will be appended to the current 'env:' key. You can use any of the kubernetes env # syntax here