From 399f867f269b48a572481a3c418be566b00568d5 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Thu, 28 Jan 2021 23:42:03 +0500 Subject: [PATCH] Add method to retrieve single volume configuration based on input --- .../common/templates/lib/storage/_volume.tpl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 library/common/templates/lib/storage/_volume.tpl diff --git a/library/common/templates/lib/storage/_volume.tpl b/library/common/templates/lib/storage/_volume.tpl new file mode 100644 index 0000000000..2e15fa98d4 --- /dev/null +++ b/library/common/templates/lib/storage/_volume.tpl @@ -0,0 +1,17 @@ +{{/* +Retrieve volume configuration +*/}} +{{- define "common.volumeConfig" -}} +{{- $values := . -}} +{{- if hasKey $values "name" }} +- name: {{ $values.name }} +{{- if $values.emptyDirVolumes -}} + emptyDir: {} +{{- else -}} + hostPath: + path: {{ template "common.configuredHostPath" $values }} +{{- end -}} +{{- else -}} +{{- fail "Name must be specified for Volume Configuration" -}} +{{- end -}} +{{- end -}}