Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v9] Backport: helm: Buddy merge for #11368 (Enable persistence in custom mode) #12218

Merged
merged 4 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 32 additions & 10 deletions docs/pages/kubernetes-access/helm/reference/teleport-cluster.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

<Tabs>
<TabItem label="values.yaml">
```yaml
persistence:
enabled: true
```
</TabItem>
<TabItem label="--set">
```code
$ --set persistence.enabled=true
```
</TabItem>
</Tabs>

### `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.

<Tabs>
<TabItem label="values.yaml">
```yaml
standalone:
persistence:
existingClaimName: my-existing-pvc-name
```
</TabItem>
<TabItem label="--set">
```code
$ --set standalone.existingClaimName=my-existing-pvc-name
$ --set persistence.existingClaimName=my-existing-pvc-name
```
</TabItem>
</Tabs>

### `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.

<Admonition type="note">
`volumeSize` will be ignored if `existingClaimName` is set.
Expand All @@ -448,13 +470,13 @@ You can set `volumeSize` to request a different size of persistent volume when i
<Tabs>
<TabItem label="values.yaml">
```yaml
standalone:
persistence:
volumeSize: 50Gi
```
</TabItem>
<TabItem label="--set">
```code
--set standalone.volumeSize=50Gi
--set persistence.volumeSize=50Gi
```
</TabItem>
</Tabs>
Expand Down
9 changes: 9 additions & 0 deletions examples/chart/teleport-cluster/.lint/custom-customsize.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
clusterName: test-custom-cluster
chartMode: custom
persistence:
enabled: true
volumeSize: 50Gi
acme: true
acmeEmail: [email protected]
labels:
env: custom
9 changes: 9 additions & 0 deletions examples/chart/teleport-cluster/.lint/custom-existingpvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
clusterName: test-custom-cluster
chartMode: custom
persistence:
enabled: true
existingClaimName: teleport-storage
acme: true
acmeEmail: [email protected]
labels:
env: custom
4 changes: 4 additions & 0 deletions examples/chart/teleport-cluster/.lint/persistence-legacy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
clusterName: test-persistence-cluster
standalone:
existingClaimName: ""
volumeSize: 10Gi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
clusterName: test-standalone-cluster
chartMode: standalone
standalone:
persistence:
enabled: true
volumeSize: 50Gi
acme: true
acmeEmail: [email protected]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
clusterName: test-standalone-cluster
chartMode: standalone
standalone:
persistence:
enabled: true
existingClaimName: teleport-storage
acme: true
acmeEmail: [email protected]
Expand Down
5 changes: 3 additions & 2 deletions examples/chart/teleport-cluster/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down
5 changes: 3 additions & 2 deletions examples/chart/teleport-cluster/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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 }}
25 changes: 25 additions & 0 deletions examples/chart/teleport-cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 6 additions & 4 deletions examples/chart/teleport-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down