diff --git a/docs/pages/reference/helm-reference/teleport-cluster.mdx b/docs/pages/reference/helm-reference/teleport-cluster.mdx index 0b40976475fd0..8efdc24c88293 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 a8396be8ef300..640e3ebfe0307 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 6a45645081158..3fbd87c064952 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 diff --git a/examples/chart/teleport-cluster/values.schema.json b/examples/chart/teleport-cluster/values.schema.json index 2314004580ed8..3169457288067 100644 --- a/examples/chart/teleport-cluster/values.schema.json +++ b/examples/chart/teleport-cluster/values.schema.json @@ -353,6 +353,11 @@ "type": "string", "default": "" }, + "storageClassName": { + "$id": "#/properties/persistence/properties/storageClassName", + "type": "string", + "default": "" + }, "volumeSize": { "$id": "#/properties/persistence/properties/volumeSize", "type": "string",