From febaab96faaa1a24506ccb3fe162c0a1330d0acf Mon Sep 17 00:00:00 2001 From: Maciek Misztal Date: Thu, 20 Sep 2018 21:35:08 +0200 Subject: [PATCH 1/2] #7 added an optional storageClass to the server-statefuset --- templates/server-statefulset.yaml | 3 +++ values.yaml | 1 + 2 files changed, 4 insertions(+) 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/values.yaml b/values.yaml index 03f38a1..1404bdc 100644 --- a/values.yaml +++ b/values.yaml @@ -30,6 +30,7 @@ server: replicas: 3 bootstrapExpect: 3 # Should <= replicas count storage: 10Gi + #storageClass: default # <= name of the storage class to use # connect will enable Connect on all the servers, initializing a CA # for Connect-related connections. Other customizations can be done From 85538787e7cc17ab7b2f3ae5e78515a02dfd1fc7 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 22 Sep 2018 09:57:36 -0700 Subject: [PATCH 2/2] Unit tests for storageClass --- test/unit/server-statefulset.bats | 24 ++++++++++++++++++++++++ values.yaml | 7 ++++++- 2 files changed, 30 insertions(+), 1 deletion(-) 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 1404bdc..925277d 100644 --- a/values.yaml +++ b/values.yaml @@ -29,8 +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: default # <= name of the storage class to use + storageClass: null # connect will enable Connect on all the servers, initializing a CA # for Connect-related connections. Other customizations can be done