From b0d954f1fcc431cf85513182741b4ec250485507 Mon Sep 17 00:00:00 2001 From: DilasserT <49373066+DilasserT@users.noreply.github.com> Date: Mon, 5 Jul 2021 20:17:51 +0200 Subject: [PATCH] [kibana] adding extra volumes and extra volume mounts (#557) (#1264) --- 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 9dbece640..f37bde360 100644 --- a/kibana/README.md +++ b/kibana/README.md @@ -87,6 +87,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 b39362288..5357ce36e 100755 --- a/kibana/values.yaml +++ b/kibana/values.yaml @@ -87,6 +87,17 @@ priorityClassName: "" httpPort: 5601 +extraVolumes: + [] + # - name: extras + # emptyDir: {} + +extraVolumeMounts: + [] + # - name: extras + # mountPath: /usr/share/extras + # readOnly: true + # extraContainers: "" # - name: dummy-init # image: busybox