diff --git a/templates/server-statefulset.yaml b/templates/server-statefulset.yaml index 09ad457..cd9e008 100644 --- a/templates/server-statefulset.yaml +++ b/templates/server-statefulset.yaml @@ -160,4 +160,7 @@ spec: resources: requests: storage: {{ .Values.server.storage }} + {{- if .Values.server.storageClass }} + storageClassName: {{ .Values.server.storageClass }} + {{- end }} {{- end }} diff --git a/test/unit/server-statefulset.bats b/test/unit/server-statefulset.bats index 32bb0b5..edce616 100755 --- a/test/unit/server-statefulset.bats +++ b/test/unit/server-statefulset.bats @@ -196,3 +196,27 @@ load _helpers yq -r '.spec.template.spec.containers[0].command | map(select(test("/consul/userconfig/foo"))) | length' | tee /dev/stderr) [ "${actual}" = "1" ] } + +#-------------------------------------------------------------------- +# updateStrategy + +@test "server/StatefulSet: no storageClass on claim by default" { + cd `chart_dir` + local actual=$(helm template \ + -x templates/server-statefulset.yaml \ + . | tee /dev/stderr | + yq -r '.spec.volumeClaimTemplates[0].spec.storageClassName' | tee /dev/stderr) + [ "${actual}" = "null" ] +} + + +@test "server/StatefulSet: can set storageClass" { + cd `chart_dir` + local actual=$(helm template \ + -x templates/server-statefulset.yaml \ + --set 'server.storageClass=foo' \ + . | tee /dev/stderr | + yq -r '.spec.volumeClaimTemplates[0].spec.storageClassName' | tee /dev/stderr) + [ "${actual}" = "foo" ] +} + diff --git a/values.yaml b/values.yaml index 03f38a1..925277d 100644 --- a/values.yaml +++ b/values.yaml @@ -29,7 +29,13 @@ server: image: null replicas: 3 bootstrapExpect: 3 # Should <= replicas count + + # storage and storageClass are the settings for configuring stateful + # storage for the server pods. storage should be set to the disk size of + # the attached volume. storageClass is the class of storage which defaults + # to null (the Kube cluster will pick the default). storage: 10Gi + storageClass: null # connect will enable Connect on all the servers, initializing a CA # for Connect-related connections. Other customizations can be done