diff --git a/docs/pages/kubernetes-access/helm/reference/teleport-cluster.mdx b/docs/pages/kubernetes-access/helm/reference/teleport-cluster.mdx index 4f4f7b5aa4521..88acb41c300c0 100644 --- a/docs/pages/kubernetes-access/helm/reference/teleport-cluster.mdx +++ b/docs/pages/kubernetes-access/helm/reference/teleport-cluster.mdx @@ -407,39 +407,61 @@ Teleport's RBAC policies to define access rules for the cluster. | `gcp` | [Running an HA Teleport cluster using a Google Cloud GKE cluster](../guides/gcp.mdx) | | `custom` | [Running a Teleport cluster with a custom config](../guides/custom.mdx) | -## `standalone` +## `persistence` -### `standalone.existingClaimName` +### `persistence.enabled` + +| Type | Default value | Can be used in `custom` mode? | +| - | - | - | +| `bool` | `true` | ✅ | + +`persistence.enabled` can be used to enable data persistence using either a new or pre-existing `PersistentVolumeClaim`. + + + + ```yaml + persistence: + enabled: true + ``` + + + ```code + $ --set persistence.enabled=true + ``` + + + +### `persistence.existingClaimName` | Type | Default value | Can be used in `custom` mode? | | - | - | - | | `string` | `nil` | ✅ | -`standalone.existingClaimName` can be used to provide the name of a pre-existing `PersistentVolumeClaim` to use if desired. +`persistence.existingClaimName` can be used to provide the name of a pre-existing `PersistentVolumeClaim` to use if desired. -The default is left blank, which will automatically create a `PersistentVolumeClaim` to use for Teleport storage in `standalone` mode. +The default is left blank, which will automatically create a `PersistentVolumeClaim` to use for Teleport storage in `standalone` or `custom` mode. ```yaml - standalone: + persistence: existingClaimName: my-existing-pvc-name ``` ```code - $ --set standalone.existingClaimName=my-existing-pvc-name + $ --set persistence.existingClaimName=my-existing-pvc-name ``` -### `standalone.volumeSize` +### `persistence.volumeSize` | Type | Default value | Can be used in `custom` mode? | | - | - | - | | `string` | `10Gi` | ✅ | -You can set `volumeSize` to request a different size of persistent volume when installing the Teleport chart in `standalone` mode. +You can set `volumeSize` to request a different size of persistent volume when installing the Teleport chart in `standalone` or `custom` mode. `volumeSize` will be ignored if `existingClaimName` is set. @@ -448,13 +470,13 @@ You can set `volumeSize` to request a different size of persistent volume when i ```yaml - standalone: + persistence: volumeSize: 50Gi ``` ```code - --set standalone.volumeSize=50Gi + --set persistence.volumeSize=50Gi ``` diff --git a/examples/chart/teleport-cluster/.lint/custom-customsize.yaml b/examples/chart/teleport-cluster/.lint/custom-customsize.yaml new file mode 100644 index 0000000000000..90579e01a0228 --- /dev/null +++ b/examples/chart/teleport-cluster/.lint/custom-customsize.yaml @@ -0,0 +1,9 @@ +clusterName: test-custom-cluster +chartMode: custom +persistence: + enabled: true + volumeSize: 50Gi +acme: true +acmeEmail: test@email.com +labels: + env: custom diff --git a/examples/chart/teleport-cluster/.lint/custom-existingpvc.yaml b/examples/chart/teleport-cluster/.lint/custom-existingpvc.yaml new file mode 100644 index 0000000000000..731ba719fff4d --- /dev/null +++ b/examples/chart/teleport-cluster/.lint/custom-existingpvc.yaml @@ -0,0 +1,9 @@ +clusterName: test-custom-cluster +chartMode: custom +persistence: + enabled: true + existingClaimName: teleport-storage +acme: true +acmeEmail: test@email.com +labels: + env: custom diff --git a/examples/chart/teleport-cluster/.lint/persistence-legacy.yaml b/examples/chart/teleport-cluster/.lint/persistence-legacy.yaml new file mode 100644 index 0000000000000..0d9a124c524da --- /dev/null +++ b/examples/chart/teleport-cluster/.lint/persistence-legacy.yaml @@ -0,0 +1,4 @@ +clusterName: test-persistence-cluster +standalone: + existingClaimName: "" + volumeSize: 10Gi diff --git a/examples/chart/teleport-cluster/.lint/standalone-customsize.yaml b/examples/chart/teleport-cluster/.lint/standalone-customsize.yaml index e8acbe8cf9848..c994faa957b63 100644 --- a/examples/chart/teleport-cluster/.lint/standalone-customsize.yaml +++ b/examples/chart/teleport-cluster/.lint/standalone-customsize.yaml @@ -1,6 +1,7 @@ clusterName: test-standalone-cluster chartMode: standalone -standalone: +persistence: + enabled: true volumeSize: 50Gi acme: true acmeEmail: test@email.com diff --git a/examples/chart/teleport-cluster/.lint/standalone-existingpvc.yaml b/examples/chart/teleport-cluster/.lint/standalone-existingpvc.yaml index 345999323a716..89292ef56b656 100644 --- a/examples/chart/teleport-cluster/.lint/standalone-existingpvc.yaml +++ b/examples/chart/teleport-cluster/.lint/standalone-existingpvc.yaml @@ -1,6 +1,7 @@ clusterName: test-standalone-cluster chartMode: standalone -standalone: +persistence: + enabled: true existingClaimName: teleport-storage acme: true acmeEmail: test@email.com diff --git a/examples/chart/teleport-cluster/templates/deployment.yaml b/examples/chart/teleport-cluster/templates/deployment.yaml index 8ab4edf61cd6f..3f4141adac664 100644 --- a/examples/chart/teleport-cluster/templates/deployment.yaml +++ b/examples/chart/teleport-cluster/templates/deployment.yaml @@ -10,6 +10,7 @@ {{- if and .Values.acme .Values.tls.existingSecretName }} {{- fail "Cannot set both acme.enabled and tls.existingSecretName, choose one or the other" }} {{- end }} + {{- $persistence := (coalesce .Values.standalone .Values.persistence) -}} apiVersion: apps/v1 kind: Deployment metadata: @@ -230,9 +231,9 @@ spec: configMap: name: {{ .Release.Name }} - name: "data" - {{- if eq .Values.chartMode "standalone" }} + {{- if and (.Values.persistence.enabled) (or (eq .Values.chartMode "standalone") (eq .Values.chartMode "custom")) }} persistentVolumeClaim: - claimName: {{ if .Values.standalone.existingClaimName }}{{ .Values.standalone.existingClaimName }}{{ else }}{{ .Release.Name }}{{ end }} + claimName: {{ if $persistence.existingClaimName }}{{ $persistence.existingClaimName }}{{ else }}{{ .Release.Name }}{{ end }} {{- else }} emptyDir: {} {{- end }} diff --git a/examples/chart/teleport-cluster/templates/pvc.yaml b/examples/chart/teleport-cluster/templates/pvc.yaml index 7e01b3c36d12e..57df7e18fca2d 100644 --- a/examples/chart/teleport-cluster/templates/pvc.yaml +++ b/examples/chart/teleport-cluster/templates/pvc.yaml @@ -1,4 +1,5 @@ -{{- if and (eq .Values.chartMode "standalone") (not .Values.standalone.existingClaimName) }} +{{- $persistence := (coalesce .Values.standalone .Values.persistence) -}} +{{- if and (and (or (eq .Values.chartMode "standalone") (eq .Values.chartMode "custom")) (.Values.persistence.enabled)) (not $persistence.existingClaimName) }} apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -11,5 +12,5 @@ spec: - ReadWriteOnce resources: requests: - storage: {{ required "standalone.volumeSize is required in chart values" .Values.standalone.volumeSize }} + storage: {{ required "persistence.volumeSize is required in chart values" $persistence.volumeSize }} {{- end }} diff --git a/examples/chart/teleport-cluster/values.schema.json b/examples/chart/teleport-cluster/values.schema.json index 5176a882edb10..cedfdf45f83da 100644 --- a/examples/chart/teleport-cluster/values.schema.json +++ b/examples/chart/teleport-cluster/values.schema.json @@ -153,6 +153,31 @@ } } }, + "persistence": { + "$id": "#/properties/persistence", + "type": "object", + "required": [ + "enabled", + "volumeSize" + ], + "properties": { + "enabled": { + "$id": "#/properties/persistence/properties/enabled", + "type": "boolean", + "default": "true" + }, + "existingClaimName": { + "$id": "#/properties/persistence/properties/existingClaimName", + "type": "string", + "default": "" + }, + "volumeSize": { + "$id": "#/properties/persistence/properties/volumeSize", + "type": "string", + "default": "" + } + } + }, "aws": { "$id": "#/properties/aws", "type": "object", diff --git a/examples/chart/teleport-cluster/values.yaml b/examples/chart/teleport-cluster/values.yaml index 317b51c4909b7..6e07f2b880659 100644 --- a/examples/chart/teleport-cluster/values.yaml +++ b/examples/chart/teleport-cluster/values.yaml @@ -74,10 +74,12 @@ labels: {} # kubectl -n ${TELEPORT_NAMESPACE?} create configmap ${HELM_RELEASE_NAME?} --from-file=teleport.yaml chartMode: standalone -################################################################ -# Standalone-specific settings (only used in "standalone" mode) -################################################################ -standalone: +###################################################################### +# Persistence settings (only used in "standalone" and "custom" modes) +###################################################################### +persistence: + # Enable persistence using a PersistentVolumeClaim + enabled: true # Leave blank to automatically create a PersistentVolumeClaim for Teleport storage. # If you would like to use a pre-existing PersistentVolumeClaim, put its name here. existingClaimName: ""