diff --git a/docs/pages/kubernetes-access/helm/reference.mdx b/docs/pages/kubernetes-access/helm/reference.mdx index 45f101380aeee..e4804f5232545 100644 --- a/docs/pages/kubernetes-access/helm/reference.mdx +++ b/docs/pages/kubernetes-access/helm/reference.mdx @@ -951,6 +951,29 @@ A list of `initContainers` which will be run before the main Teleport container +## `postStart` + +[Kubernetes reference](https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/) + +A `postStart` lifecycle handler to be configured on the main Teleport container. + + + + ```yaml + postStart: + command: + - echo + - foo + ``` + + + ```shell + --set "postStart.command[0]=echo" \ + --set "postStart.command[1]=foo" + ``` + + + ## `resources` | Type | Default value | Can be used in `custom` mode? | diff --git a/examples/chart/teleport-cluster/templates/deployment.yaml b/examples/chart/teleport-cluster/templates/deployment.yaml index de52516bf6fff..ef0c1a342d067 100644 --- a/examples/chart/teleport-cluster/templates/deployment.yaml +++ b/examples/chart/teleport-cluster/templates/deployment.yaml @@ -136,6 +136,12 @@ spec: initialDelaySeconds: 5 # wait 5s for agent to register periodSeconds: 5 # poll health every 5s failureThreshold: 12 # consider agent unhealthy after 60s (12 * 5s) +{{- if .Values.postStart.command }} + lifecycle: + postStart: + exec: + command: {{ toYaml .Values.postStart.command | nindent 14 }} +{{- end }} {{- if .Values.resources }} resources: {{- toYaml .Values.resources | nindent 10 }} diff --git a/examples/chart/teleport-cluster/values.schema.json b/examples/chart/teleport-cluster/values.schema.json index 66b2b99acb49f..bba1e40846576 100644 --- a/examples/chart/teleport-cluster/values.schema.json +++ b/examples/chart/teleport-cluster/values.schema.json @@ -318,6 +318,20 @@ "type": "array", "default": [] }, + "postStart": { + "$id": "#/properties/postStart", + "type": "object", + "required": [ + "command" + ], + "properties": { + "command": { + "$id": "#properties/postStart/command", + "type": "array", + "default": [] + } + } + }, "kubeClusterName": { "$id": "#/properties/kubeClusterName", "type": "string", diff --git a/examples/chart/teleport-cluster/values.yaml b/examples/chart/teleport-cluster/values.yaml index 892fac1deff82..8d1c85358963d 100644 --- a/examples/chart/teleport-cluster/values.yaml +++ b/examples/chart/teleport-cluster/values.yaml @@ -203,6 +203,11 @@ initContainers: [] # image: "alpine" # args: ["echo test"] +# If set, will run the command as a postStart handler +# https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ +postStart: + command: [] + # Resources to request for each pod in the deployment # https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ resources: {}