From 8cb32a5d72fbfc42dc59124ee01e81a1b7a4c347 Mon Sep 17 00:00:00 2001 From: Dilassert Date: Thu, 24 Jun 2021 09:44:11 +0200 Subject: [PATCH] [kibana] adding extra volumes and extra volume mounts (#557) --- kibana/README.md | 2 ++ kibana/templates/deployment.yaml | 6 ++++++ kibana/tests/kibana_test.py | 23 +++++++++++++++++++++++ kibana/values.yaml | 11 +++++++++++ 4 files changed, 42 insertions(+) diff --git a/kibana/README.md b/kibana/README.md index 5f0f24543..6ee9eea4d 100644 --- a/kibana/README.md +++ b/kibana/README.md @@ -85,6 +85,8 @@ as a reference. They are also used in the automated testing of this chart. | `extraContainers` | Templatable string of additional containers to be passed to the `tpl` function | `""` | | `extraEnvs` | Extra [environment variables][] which will be appended to the `env:` definition for the container | see [values.yaml][] | | `extraInitContainers` | Templatable string of additional containers to be passed to the `tpl` function | `""` | +| `extraVolumeMounts` | Configuration for additionnal `volumeMounts` | see [values.yaml][] | +| `extraVolumes` | Configuration for additionnal `volumes` | see [values.yaml][] | | `fullnameOverride` | Overrides the full name of the resources. If not set the name will default to " `.Release.Name` - `.Values.nameOverride orChart.Name` " | `""` | | `healthCheckPath` | The path used for the readinessProbe to check that Kibana is ready. If you are setting `server.basePath` you will also need to update this to `/${basePath}/app/kibana` | `/app/kibana` | | `hostAliases` | Configurable [hostAliases][] | `[]` | diff --git a/kibana/templates/deployment.yaml b/kibana/templates/deployment.yaml index ba4400b78..71703271f 100644 --- a/kibana/templates/deployment.yaml +++ b/kibana/templates/deployment.yaml @@ -50,6 +50,9 @@ spec: configMap: name: {{ template "kibana.fullname" . }}-config {{- end }} + {{- if .Values.extraVolumes }} +{{ toYaml .Values.extraVolumes | indent 8 }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{ toYaml . | indent 8 }} @@ -152,6 +155,9 @@ spec: mountPath: /usr/share/kibana/config/{{ $path }} subPath: {{ $path }} {{- end -}} + {{- if .Values.extraVolumeMounts }} +{{ toYaml .Values.extraVolumeMounts | indent 10 }} + {{- end }} {{- if .Values.extraContainers }} # Currently some extra blocks accept strings # to continue with backwards compatibility this is being kept diff --git a/kibana/tests/kibana_test.py b/kibana/tests/kibana_test.py index 5a3f30b34..a7411f358 100644 --- a/kibana/tests/kibana_test.py +++ b/kibana/tests/kibana_test.py @@ -107,6 +107,29 @@ def test_adding_env_from(): assert secretRef == {"name": "secret-name"} +def test_adding_an_extra_volume_with_volume_mount(): + config = """ +extraVolumes: + - name: extras + emptyDir: {} +extraVolumeMounts: + - name: extras + mountPath: /usr/share/extras + readOnly: true +""" + r = helm_template(config) + extraVolume = r["deployment"][name]["spec"]["template"]["spec"]["volumes"] + assert {"name": "extras", "emptyDir": {}} in extraVolume + extraVolumeMounts = r["deployment"][name]["spec"]["template"]["spec"]["containers"][ + 0 + ]["volumeMounts"] + assert { + "name": "extras", + "mountPath": "/usr/share/extras", + "readOnly": True, + } in extraVolumeMounts + + def test_adding_image_pull_secrets(): config = """ imagePullSecrets: diff --git a/kibana/values.yaml b/kibana/values.yaml index 9f59286ac..f62775654 100755 --- a/kibana/values.yaml +++ b/kibana/values.yaml @@ -86,6 +86,17 @@ priorityClassName: "" httpPort: 5601 +extraVolumes: + [] + # - name: extras + # emptyDir: {} + +extraVolumeMounts: + [] + # - name: extras + # mountPath: /usr/share/extras + # readOnly: true + # extraContainers: "" # - name: dummy-init # image: busybox