From 91c199f2edeef00a2a67dddf51d363ebe87fd902 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Fri, 28 May 2021 23:06:40 +0200 Subject: [PATCH] Fix hostPathMounts and add install test (#527) * Fix hostPathMounts and add install test * whoops fix --- charts/library/common-test/Chart.yaml | 2 +- .../common-test/ci/basic-values-storage.yaml | 66 +++++++++++++++++++ charts/library/common/Chart.yaml | 2 +- .../templates/classes/_mountPermissions.tpl | 2 +- .../templates/lib/controller/_volumes.tpl | 2 +- 5 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 charts/library/common-test/ci/basic-values-storage.yaml diff --git a/charts/library/common-test/Chart.yaml b/charts/library/common-test/Chart.yaml index 7df02189db9..674e7f4e49b 100644 --- a/charts/library/common-test/Chart.yaml +++ b/charts/library/common-test/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 kubeVersion: ">=1.16.0-0" name: common-test -version: 3.0.1 +version: 3.0.2 # upstream_version: appVersion: none description: Helper chart to test different use cases of the common library diff --git a/charts/library/common-test/ci/basic-values-storage.yaml b/charts/library/common-test/ci/basic-values-storage.yaml new file mode 100644 index 00000000000..3666f5f2fcf --- /dev/null +++ b/charts/library/common-test/ci/basic-values-storage.yaml @@ -0,0 +1,66 @@ +image: + repository: b4bz/homer + tag: latest + pullPolicy: IfNotPresent + +service: + main: + ports: + main: + port: 8080 + +ingress: + main: + enabled: true + + +persistence: + config: + enabled: true + mountPath: /config + emptyDir: + enabled: true + accessMode: ReadWriteOnce + size: 1Gi + skipuninstall: false + + + +hostPathMounts: + - name: "hpmmountempty" + enabled: true + emptyDir: + enabled: true + mountPath: "/test1" + hostPath: "" + readOnly: false + - name: "hpmmountnonempty" + enabled: true + emptyDir: + enabled: false + mountPath: "/test2" + hostPath: "/tmp" + readOnly: false + - name: "hpmmountpermissions" + enabled: true + setPermissions: true + emptyDir: + enabled: false + mountPath: "/test3" + hostPath: "/tmp" + readOnly: false + - enabled: true + setPermissions: true + emptyDir: + enabled: false + mountPath: "/test4" + hostPath: "/tmp" + readOnly: false + +probes: + liveness: + enabled: true + readiness: + enabled: true + startup: + enabled: true diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index 7afd6b130a3..56f65e5b89a 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -19,4 +19,4 @@ name: common sources: - https://github.com/truecharts/apps/tree/master/library/common type: library -version: 5.1.0 +version: 5.1.1 diff --git a/charts/library/common/templates/classes/_mountPermissions.tpl b/charts/library/common/templates/classes/_mountPermissions.tpl index e53b8c96aa7..0f5b708d02c 100644 --- a/charts/library/common/templates/classes/_mountPermissions.tpl +++ b/charts/library/common/templates/classes/_mountPermissions.tpl @@ -18,7 +18,7 @@ before chart installation. {{- $hostPathMounts := dict -}} {{- range $name, $mount := .Values.hostPathMounts -}} {{- if and $mount.enabled $mount.setPermissions -}} - {{- $name = default $name $mount.name -}} + {{- $name = default ( $name| toString ) $mount.name -}} {{- $_ := set $hostPathMounts $name $mount -}} {{- end -}} {{- end }} diff --git a/charts/library/common/templates/lib/controller/_volumes.tpl b/charts/library/common/templates/lib/controller/_volumes.tpl index 5cbf4f4ac91..c85a685f5e9 100644 --- a/charts/library/common/templates/lib/controller/_volumes.tpl +++ b/charts/library/common/templates/lib/controller/_volumes.tpl @@ -72,7 +72,7 @@ Creates Volumes for hostPaths which can be directly mounted to a container {{ if $hpm.name }} {{ $name = $hpm.name }} {{ end }} -- name: {{ printf "hostpathmounts-%s" $name }} +- name: hostpathmounts-{{ $name }} {{- /* Always prefer an emptyDir next if that is set */}} {{- $emptyDir := false -}} {{- if $hpm.emptyDir -}}