From cbba1d6e82f6fec0365b1f5b5a4adbcea7f44acb Mon Sep 17 00:00:00 2001 From: June Xu Date: Sun, 15 Dec 2024 23:36:17 -0800 Subject: [PATCH] Add code executor pdb + prestop hook for backend --- charts/retool/Chart.yaml | 2 +- charts/retool/templates/deployment_backend.yaml | 6 ++++++ .../templates/deployment_code_executor.yaml | 16 ++++++++++++++++ charts/retool/values.yaml | 3 +++ values.yaml | 3 +++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/charts/retool/Chart.yaml b/charts/retool/Chart.yaml index 07dbe48..afeef81 100644 --- a/charts/retool/Chart.yaml +++ b/charts/retool/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: retool description: A Helm chart for Kubernetes type: application -version: 6.2.15 +version: 6.2.16 maintainers: - name: Retool Engineering email: engineering+helm@retool.com diff --git a/charts/retool/templates/deployment_backend.yaml b/charts/retool/templates/deployment_backend.yaml index 4c1ce43..4741089 100644 --- a/charts/retool/templates/deployment_backend.yaml +++ b/charts/retool/templates/deployment_backend.yaml @@ -270,6 +270,12 @@ spec: successThreshold: {{ .Values.readinessProbe.successThreshold }} periodSeconds: {{ .Values.readinessProbe.periodSeconds }} {{- end }} +{{- if .Values.preStopHook.enabled }} + lifecycle: + preStop: + exec: + command: ["sleep", "30"] +{{- end }} {{- if .Values.startupProbe.enabled }} startupProbe: httpGet: diff --git a/charts/retool/templates/deployment_code_executor.yaml b/charts/retool/templates/deployment_code_executor.yaml index 39974f2..abd71f7 100644 --- a/charts/retool/templates/deployment_code_executor.yaml +++ b/charts/retool/templates/deployment_code_executor.yaml @@ -145,3 +145,19 @@ spec: targetPort: 3004 name: http-server {{- end }} +--- +{{- if .Values.podDisruptionBudget }} +{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.Version -}} +apiVersion: policy/v1 +{{- else -}} +apiVersion: policy/v1beta1 +{{- end }} +kind: PodDisruptionBudget +metadata: + name: {{ template "retool.codeExecutor.name" . }} +spec: + {{ toYaml .Values.podDisruptionBudget }} + selector: + matchLabels: + {{- include "retool.codeExecutor.selectorLabels" . | nindent 6 }} +{{- end }} diff --git a/charts/retool/values.yaml b/charts/retool/values.yaml index 984baf6..7edb9b5 100644 --- a/charts/retool/values.yaml +++ b/charts/retool/values.yaml @@ -220,6 +220,9 @@ readinessProbe: periodSeconds: 10 successThreshold: 5 +preStopHook: + enabled: true + # To avoid increasing livenessProbe initialDelaySeconds the good practice is to use a startupProbe. startupProbe: enabled: false diff --git a/values.yaml b/values.yaml index 984baf6..7edb9b5 100644 --- a/values.yaml +++ b/values.yaml @@ -220,6 +220,9 @@ readinessProbe: periodSeconds: 10 successThreshold: 5 +preStopHook: + enabled: true + # To avoid increasing livenessProbe initialDelaySeconds the good practice is to use a startupProbe. startupProbe: enabled: false