From cc435030bcc086f20eb1fe2259c038e2a364dc31 Mon Sep 17 00:00:00 2001 From: adinhodovic Date: Fri, 7 Jul 2023 21:08:04 +0200 Subject: [PATCH 1/2] feat(chart/teleport-cluster): Allow setting storage class name for auth component --- .../reference/helm-reference/teleport-cluster.mdx | 15 +++++++++++++++ .../.lint/standalone-custom-storage-class.yaml | 9 +++++++++ .../teleport-cluster/templates/auth/pvc.yaml | 3 +++ .../teleport-cluster/tests/auth_pvc_test.yaml | 12 ++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 examples/chart/teleport-cluster/.lint/standalone-custom-storage-class.yaml diff --git a/docs/pages/reference/helm-reference/teleport-cluster.mdx b/docs/pages/reference/helm-reference/teleport-cluster.mdx index 3bb1dc20bddda..f387bed421224 100644 --- a/docs/pages/reference/helm-reference/teleport-cluster.mdx +++ b/docs/pages/reference/helm-reference/teleport-cluster.mdx @@ -848,6 +848,21 @@ The default is left blank, which will automatically create a `PersistentVolumeCl existingClaimName: my-existing-pvc-name ``` +### `persistence.storageClassName` + +| Type | Default value | +|--------|---------------| +| `string` | `nil` | + +`persistence.storageClassName` can be used to set the storage class for the `PersistentVolumeClaim`. + +`values.yaml` example: + + ```yaml + persistence: + storageClassName: ebs-ssd + ``` + ### `persistence.volumeSize` | Type | Default value | diff --git a/examples/chart/teleport-cluster/.lint/standalone-custom-storage-class.yaml b/examples/chart/teleport-cluster/.lint/standalone-custom-storage-class.yaml new file mode 100644 index 0000000000000..4cf5ade1846f6 --- /dev/null +++ b/examples/chart/teleport-cluster/.lint/standalone-custom-storage-class.yaml @@ -0,0 +1,9 @@ +clusterName: test-standalone-cluster +chartMode: standalone +persistence: + enabled: true + storageClassName: ebs-ssd +acme: true +acmeEmail: test@email.com +labels: + env: standalone diff --git a/examples/chart/teleport-cluster/templates/auth/pvc.yaml b/examples/chart/teleport-cluster/templates/auth/pvc.yaml index e954fa2946fa3..fab489bb9a025 100644 --- a/examples/chart/teleport-cluster/templates/auth/pvc.yaml +++ b/examples/chart/teleport-cluster/templates/auth/pvc.yaml @@ -13,6 +13,9 @@ metadata: spec: accessModes: - ReadWriteOnce + {{- if $auth.persistence.storageClassName }} + storageClassName: {{ $auth.persistence.storageClassName }} + {{- end }} resources: requests: storage: {{ required "persistence.volumeSize is required in chart values" $auth.persistence.volumeSize }} diff --git a/examples/chart/teleport-cluster/tests/auth_pvc_test.yaml b/examples/chart/teleport-cluster/tests/auth_pvc_test.yaml index 4653fd348909a..6a1600528208b 100644 --- a/examples/chart/teleport-cluster/tests/auth_pvc_test.yaml +++ b/examples/chart/teleport-cluster/tests/auth_pvc_test.yaml @@ -35,6 +35,18 @@ tests: path: spec.resources.requests.storage value: 50Gi + - it: uses a custom storage class when set + values: + - ../.lint/standalone-custom-storage-class.yaml + asserts: + - hasDocuments: + count: 1 + - isKind: + of: PersistentVolumeClaim + - equal: + path: spec.storageClassName + value: ebs-ssd + - it: does not create a PersistentVolumeClaim when chartMode=standalone and existingClaimName is not blank set: chartMode: standalone From b61cbc882eabb879f87f0737fb917c7951fe2201 Mon Sep 17 00:00:00 2001 From: adinhodovic Date: Fri, 7 Jul 2023 21:11:57 +0200 Subject: [PATCH 2/2] fix: Add value schema --- examples/chart/teleport-cluster/values.schema.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/chart/teleport-cluster/values.schema.json b/examples/chart/teleport-cluster/values.schema.json index 316dc9bad630f..f4b9f5b0dd504 100644 --- a/examples/chart/teleport-cluster/values.schema.json +++ b/examples/chart/teleport-cluster/values.schema.json @@ -352,6 +352,11 @@ "type": "string", "default": "" }, + "storageClassName": { + "$id": "#/properties/persistence/properties/storageClassName", + "type": "string", + "default": "" + }, "volumeSize": { "$id": "#/properties/persistence/properties/volumeSize", "type": "string",