Storage Tweaking and bugfixing (#506)

* first work for allowing ramdisk usage

* add bump tooling.
Fixes: #157

* bump minor versions due to adding ramdisk emptydir to persistence

* allow disabling persistent storage

* actually push major as it is breaking in theory

* cleanup hpm example code

* Allow custom storageClass and fix bug using the wrong storageClass

* try fixing gabs

* cleanup

* update tests

* revert some permission job changes

* reverse some of the 3.0 common incompatible bitwarden changes
This commit is contained in:
Kjeld Schouten-Lebbing
2021-05-24 21:17:29 +02:00
committed by GitHub
parent 7e49c3c179
commit a837947884
95 changed files with 1524 additions and 1143 deletions
+1 -1
View File
@@ -19,4 +19,4 @@ name: common
sources:
- https://github.com/truecharts/apps/tree/master/library/common
type: library
version: 4.1.6
version: 5.0.0
@@ -48,6 +48,7 @@ spec:
{{- range $_, $hpm := $hostPathMounts }}
chown -R {{ printf "%d:%d %s" (int $user) (int $group) $hpm.mountPath }}
{{- end }}
{{- with (include "common.controller.volumeMounts" . | trim) }}
volumeMounts:
{{- range $name, $hpm := $hostPathMounts }}
- name: {{ printf "hostpathmounts-%s" $name }}
@@ -59,12 +60,31 @@ spec:
volumes:
{{- range $name, $hpm := $hostPathMounts }}
- name: {{ printf "hostpathmounts-%s" $name }}
{{- if $hpm.emptyDir }}
{{- /* Always prefer an emptyDir next if that is set */}}
{{- $emptyDir := false -}}
{{- if $hpm.emptyDir -}}
{{- if $hpm.emptyDir.enabled -}}
{{- $emptyDir = true -}}
{{- end -}}
{{- end -}}
{{- if $emptyDir }}
{{- if or $hpm.emptyDir.medium $hpm.emptyDir.sizeLimit }}
emptyDir:
{{- with $hpm.emptyDir.medium }}
medium: "{{ . }}"
{{- end }}
{{- with $hpm.emptyDir.sizeLimit }}
sizeLimit: "{{ . }}"
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
{{- else }}
hostPath:
path: {{ required "hostPath not set" $hpm.hostPath }}
{{- end }}
{{ end }}
{{ end }}
{{- end }}
{{- end -}}
{{- end -}}
@@ -72,10 +72,27 @@ Creates Volumes for hostPaths which can be directly mounted to a container
{{ if $hpm.name }}
{{ $name = $hpm.name }}
{{ end }}
- name: hostpathmounts-{{ $name }}
{{ if $hpm.emptyDir }}
- name: {{ printf "hostpathmounts-%s" $name }}
{{- /* Always prefer an emptyDir next if that is set */}}
{{- $emptyDir := false -}}
{{- if $hpm.emptyDir -}}
{{- if $hpm.emptyDir.enabled -}}
{{- $emptyDir = true -}}
{{- end -}}
{{- end -}}
{{- if $emptyDir }}
{{- if or $hpm.emptyDir.medium $hpm.emptyDir.sizeLimit }}
emptyDir:
{{- with $hpm.emptyDir.medium }}
medium: "{{ . }}"
{{- end }}
{{- with $hpm.emptyDir.sizeLimit }}
sizeLimit: "{{ . }}"
{{- end }}
{{- else }}
emptyDir: {}
{{- else -}}
{{- end }}
{{- else }}
hostPath:
path: {{ required "hostPath not set" $hpm.hostPath }}
{{ end }}
@@ -305,6 +305,11 @@ func (suite *ContainerTestSuite) TestPersistenceHostpathMounts() {
hostPath: /tmp
mountPath: /config
subPath: mySubPath
- name: cache
enabled: true
mountPath: /cache
emptyDir:
enabled: true
`
tests := map[string]struct {
values *string
@@ -312,6 +317,7 @@ func (suite *ContainerTestSuite) TestPersistenceHostpathMounts() {
expectedMountPath string
expectedSubPath string
}{
"EmptyDir": {values: &values, volumeToTest: "cache", expectedMountPath: "/cache"},
"WithMountPath": {values: &values, volumeToTest: "hostpathmounts-data", expectedMountPath: "/data"},
"WithSubPath": {values: &values, volumeToTest: "hostpathmounts-config", expectedMountPath: "/config", expectedSubPath: "mySubPath"},
}
+4 -2
View File
@@ -263,7 +263,8 @@ func (suite *PodTestSuite) TestHostPathVolumes() {
hostPath: "/tmp1"
- name: config
enabled: true
emptyDir: true
emptyDir:
enabled: true
mountPath: "/data"
`
tests := map[string]struct {
@@ -305,7 +306,8 @@ func (suite *PodTestSuite) TestHostPathVolumePaths() {
hostPath: "/tmp1"
- name: config
enabled: true
emptyDir: true
emptyDir:
enabled: true
mountPath: "/data"
`
tests := map[string]struct {
+3 -1
View File
@@ -355,7 +355,9 @@ persistence:
hostPathMounts: []
# - name: "data"
# enabled: false
# emptyDir: false
# emptyDir:
# enabled: false
# medium: ""
# mountPath: "/data"
# subPath: some-subpath
# hostPath: ""