You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by ad...@apache.org on 2026/04/15 16:25:04 UTC
(polaris) branch main updated: feat(helm): add termination and lifecycle options (#4198)
This is an automated email from the ASF dual-hosted git repository.
adutra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git
The following commit(s) were added to refs/heads/main by this push:
new 173779f0a7 feat(helm): add termination and lifecycle options (#4198)
173779f0a7 is described below
commit 173779f0a7905d64eeea6a8b60ebdb9bbaf94370
Author: fivetran-ashokborra <12...@users.noreply.github.com>
AuthorDate: Wed Apr 15 21:54:59 2026 +0530
feat(helm): add termination and lifecycle options (#4198)
---
helm/polaris/templates/deployment.yaml | 7 ++++
helm/polaris/tests/deployment_test.yaml | 44 ++++++++++++++++++++++
helm/polaris/values.schema.json | 12 ++++++
helm/polaris/values.yaml | 18 +++++++++
.../in-dev/unreleased/helm-chart/reference.md | 2 +
5 files changed, 83 insertions(+)
diff --git a/helm/polaris/templates/deployment.yaml b/helm/polaris/templates/deployment.yaml
index 7b3a6cd951..b14fc82366 100644
--- a/helm/polaris/templates/deployment.yaml
+++ b/helm/polaris/templates/deployment.yaml
@@ -72,12 +72,19 @@ spec:
initContainers:
{{- tpl (toYaml .Values.extraInitContainers) . | nindent 8 }}
{{- end }}
+ {{- if ne .Values.terminationGracePeriodSeconds nil }}
+ terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
+ {{- end }}
containers:
- name: {{ .Chart.Name }}
{{- if .Values.containerSecurityContext }}
securityContext:
{{- tpl (toYaml .Values.containerSecurityContext) . | nindent 12 }}
{{- end }}
+ {{- if .Values.containerLifecycle }}
+ lifecycle:
+ {{- tpl (toYaml .Values.containerLifecycle) . | nindent 12 }}
+ {{- end }}
image: "{{ tpl .Values.image.repository . }}:{{ tpl .Values.image.tag . | default .Chart.Version }}"
imagePullPolicy: {{ tpl .Values.image.pullPolicy . }}
{{ if or .Values.storage.secret.name .Values.persistence.relationalJdbc.secret.name .Values.persistence.nosql.secret.name .Values.oidc.client.secret.name .Values.extraEnv -}}
diff --git a/helm/polaris/tests/deployment_test.yaml b/helm/polaris/tests/deployment_test.yaml
index d2afd89f21..79deb56e1d 100644
--- a/helm/polaris/tests/deployment_test.yaml
+++ b/helm/polaris/tests/deployment_test.yaml
@@ -338,6 +338,50 @@ tests:
runAsNonRoot: false
runAsUser: 1234
+ # spec.template.spec.containers[0].lifecycle
+ - it: should not set container lifecycle by default
+ template: deployment.yaml
+ asserts:
+ - notExists:
+ path: spec.template.spec.containers[0].lifecycle
+ - it: should set container lifecycle with preStop hook
+ template: deployment.yaml
+ set:
+ containerLifecycle:
+ preStop:
+ exec:
+ command: ["/bin/sh", "-c", "sleep 60"]
+ asserts:
+ - isSubset:
+ path: spec.template.spec.containers[0].lifecycle
+ content:
+ preStop:
+ exec:
+ command: ["/bin/sh", "-c", "sleep 60"]
+
+ # spec.template.spec.terminationGracePeriodSeconds
+ - it: should not set terminationGracePeriodSeconds by default
+ template: deployment.yaml
+ asserts:
+ - notExists:
+ path: spec.template.spec.terminationGracePeriodSeconds
+ - it: should set terminationGracePeriodSeconds
+ template: deployment.yaml
+ set:
+ terminationGracePeriodSeconds: 90
+ asserts:
+ - equal:
+ path: spec.template.spec.terminationGracePeriodSeconds
+ value: 90
+ - it: should set terminationGracePeriodSeconds to zero
+ template: deployment.yaml
+ set:
+ terminationGracePeriodSeconds: 0
+ asserts:
+ - equal:
+ path: spec.template.spec.terminationGracePeriodSeconds
+ value: 0
+
# spec.template.spec.containers[0].image
- it: should set container image
template: deployment.yaml
diff --git a/helm/polaris/values.schema.json b/helm/polaris/values.schema.json
index 54c1a72b8c..7b061cd9e1 100644
--- a/helm/polaris/values.schema.json
+++ b/helm/polaris/values.schema.json
@@ -134,6 +134,10 @@
"type": "string"
}
},
+ "containerLifecycle": {
+ "description": "Lifecycle hooks for the polaris container. See [Container Lifecycle Hooks](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/). Use this to configure a preStop hook for graceful shutdown, e.g.: containerLifecycle: preStop: exec: command: [\"/bin/sh\", \"-c\", \"sleep 30\"]",
+ "type": "object"
+ },
"containerSecurityContext": {
"description": "Security context for the polaris container. See [Security Context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/).",
"type": "object"
@@ -1352,6 +1356,14 @@
}
}
},
+ "terminationGracePeriodSeconds": {
+ "description": "Duration in seconds the pod needs to terminate gracefully. Must be greater than the preStop hook duration. See [Termination of Pods](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination). When using a preStop hook, set this to at least the preStop sleep time plus the expected request completion time.",
+ "type": [
+ "integer",
+ "null"
+ ],
+ "minimum": 0
+ },
"tolerations": {
"description": "A list of tolerations to apply to polaris pods. See [Taints and Tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/).",
"type": "array",
diff --git a/helm/polaris/values.yaml b/helm/polaris/values.yaml
index 4fcbd0c63e..220b1ed9aa 100644
--- a/helm/polaris/values.yaml
+++ b/helm/polaris/values.yaml
@@ -141,6 +141,24 @@ containerSecurityContext:
seccompProfile:
type: RuntimeDefault
+# @schema type: object
+# -- Lifecycle hooks for the polaris container. See [Container Lifecycle Hooks](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/).
+# Use this to configure a preStop hook for graceful shutdown, e.g.:
+# containerLifecycle:
+# preStop:
+# exec:
+# command: ["/bin/sh", "-c", "sleep 30"]
+# @section -- Pod Configuration
+containerLifecycle: {}
+
+# @schema type: [integer, "null"]
+# @schema minimum: 0
+# -- (int) Duration in seconds the pod needs to terminate gracefully. Must be greater than the preStop hook duration.
+# See [Termination of Pods](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination).
+# When using a preStop hook, set this to at least the preStop sleep time plus the expected request completion time.
+# @section -- Pod Configuration
+terminationGracePeriodSeconds: ~
+
# Polaris main service settings.
service:
# @schema enum: [ExternalName, ClusterIP, NodePort, LoadBalancer]
diff --git a/site/content/in-dev/unreleased/helm-chart/reference.md b/site/content/in-dev/unreleased/helm-chart/reference.md
index 1918b876f6..ccad5994f9 100644
--- a/site/content/in-dev/unreleased/helm-chart/reference.md
+++ b/site/content/in-dev/unreleased/helm-chart/reference.md
@@ -62,6 +62,8 @@ weight: 900
| podDisruptionBudget.annotations | object | `{}` | Annotations to add to the pod disruption budget. |
| podSecurityContext | object | `{"fsGroup":10001,"seccompProfile":{"type":"RuntimeDefault"}}` | Security context for the polaris pod. See [Security Context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/). |
| containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"runAsNonRoot":true,"runAsUser":10000,"seccompProfile":{"type":"RuntimeDefault"}}` | Security context for the polaris container. See [Security Context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/). |
+| containerLifecycle | object | `{}` | Lifecycle hooks for the polaris container. See [Container Lifecycle Hooks](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/). Use this to configure a preStop hook for graceful shutdown, e.g.: containerLifecycle: preStop: exec: command: ["/bin/sh", "-c", "sleep 30"] |
+| terminationGracePeriodSeconds | int | `nil` | Duration in seconds the pod needs to terminate gracefully. Must be greater than the preStop hook duration. See [Termination of Pods](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination). When using a preStop hook, set this to at least the preStop sleep time plus the expected request completion time. |
### Service