From e3ade9cc56383f94c787eefad48835009f575466 Mon Sep 17 00:00:00 2001 From: qizhicheng Date: Wed, 24 Apr 2024 19:23:40 +0800 Subject: [PATCH 1/2] make livenessprobe and readnessprobe configurable --- charts/dify/Chart.yaml | 2 +- charts/dify/templates/deployment.yaml | 70 +++++++-------------------- charts/dify/values.yaml | 66 +++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 53 deletions(-) diff --git a/charts/dify/Chart.yaml b/charts/dify/Chart.yaml index 6de45f6..8bc8ced 100644 --- a/charts/dify/Chart.yaml +++ b/charts/dify/Chart.yaml @@ -20,7 +20,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.3.3 +version: 0.3.4 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/dify/templates/deployment.yaml b/charts/dify/templates/deployment.yaml index 6ea277e..557da01 100644 --- a/charts/dify/templates/deployment.yaml +++ b/charts/dify/templates/deployment.yaml @@ -72,24 +72,14 @@ spec: - name: http containerPort: {{ .Values.api.containerPort }} protocol: TCP + {{- with .Values.api.livenessProbe }} livenessProbe: - httpGet: - path: /health - port: http - initialDelaySeconds: 30 - timeoutSeconds: 5 - periodSeconds: 30 - successThreshold: 1 - failureThreshold: 2 + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.api.readinessProbe }} readinessProbe: - httpGet: - path: /health - port: http - initialDelaySeconds: 10 - timeoutSeconds: 5 - periodSeconds: 5 - successThreshold: 1 - failureThreshold: 10 + {{- toYaml . | nindent 12 }} + {{- end }} resources: {{- toYaml .Values.api.resources | nindent 12 }} {{- with .Values.volumes }} @@ -237,30 +227,14 @@ spec: - name: http containerPort: {{ .Values.frontend.containerPort }} protocol: TCP + {{- with .Values.frontend.livenessProbe }} livenessProbe: - httpGet: - path: /apps - port: http - httpHeaders: - - name: accept-language - value: en - initialDelaySeconds: 30 - timeoutSeconds: 5 - periodSeconds: 30 - successThreshold: 1 - failureThreshold: 2 + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.frontend.readinessProbe}} readinessProbe: - httpGet: - path: /apps - port: http - httpHeaders: - - name: accept-language - value: en - initialDelaySeconds: 30 - timeoutSeconds: 5 - periodSeconds: 5 - successThreshold: 1 - failureThreshold: 10 + {{- toYaml . | nindent 12 }} + {{- end }} resources: {{- toYaml .Values.frontend.resources | nindent 12 }} {{- with .Values.frontend.nodeSelector }} @@ -337,22 +311,14 @@ spec: - name: http containerPort: {{ .Values.sandbox.containerPort }} protocol: TCP + {{- with .Values.sandbox.livenessProbe }} livenessProbe: - tcpSocket: - port: http - initialDelaySeconds: 30 - timeoutSeconds: 5 - periodSeconds: 30 - successThreshold: 1 - failureThreshold: 2 + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.sandbox.readinessProbe}} readinessProbe: - tcpSocket: - port: http - initialDelaySeconds: 1 - timeoutSeconds: 5 - periodSeconds: 5 - successThreshold: 1 - failureThreshold: 10 + {{- toYaml . | nindent 12 }} + {{- end }} resources: {{- toYaml .Values.sandbox.resources | nindent 12 }} {{- with .Values.sandbox.nodeSelector }} diff --git a/charts/dify/values.yaml b/charts/dify/values.yaml index 331ba1e..2179eaa 100644 --- a/charts/dify/values.yaml +++ b/charts/dify/values.yaml @@ -113,6 +113,31 @@ frontend: tolerations: [] affinity: {} + livenessProbe: + httpGet: + path: /apps + port: http + httpHeaders: + - name: accept-language + value: en + initialDelaySeconds: 3 + timeoutSeconds: 5 + periodSeconds: 30 + successThreshold: 1 + failureThreshold: 2 + readinessProbe: + httpGet: + path: /apps + port: http + httpHeaders: + - name: accept-language + value: en + initialDelaySeconds: 3 + timeoutSeconds: 5 + periodSeconds: 30 + successThreshold: 1 + failureThreshold: 2 + api: replicaCount: 1 @@ -184,6 +209,25 @@ api: affinity: {} + livenessProbe: + httpGet: + path: /health + port: http + initialDelaySeconds: 30 + timeoutSeconds: 5 + periodSeconds: 30 + successThreshold: 1 + failureThreshold: 2 + readinessProbe: + httpGet: + path: /health + port: http + initialDelaySeconds: 10 + timeoutSeconds: 5 + periodSeconds: 5 + successThreshold: 1 + failureThreshold: 10 + worker: replicaCount: 1 @@ -234,6 +278,10 @@ worker: affinity: {} + # livenessprobe for worker, default no probe + livenessProbe: {} + readinessProbe: {} + sandbox: replicaCount: 1 # please change to avoid abuse @@ -298,6 +346,24 @@ sandbox: affinity: {} + + readinessProbe: + tcpSocket: + port: http + initialDelaySeconds: 1 + timeoutSeconds: 5 + periodSeconds: 5 + successThreshold: 1 + failureThreshold: 10 + livenessProbe: + tcpSocket: + port: http + initialDelaySeconds: 30 + timeoutSeconds: 5 + periodSeconds: 30 + successThreshold: 1 + failureThreshold: 2 + ##### dependencies ##### redis: From 87d114a903c8cfe575a704e33fad5c93c3a38445 Mon Sep 17 00:00:00 2001 From: qizhicheng Date: Wed, 24 Apr 2024 19:27:36 +0800 Subject: [PATCH 2/2] Add livenessProbe and readinessProbe configuration to worker deployment --- charts/dify/templates/deployment.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/charts/dify/templates/deployment.yaml b/charts/dify/templates/deployment.yaml index 557da01..245e747 100644 --- a/charts/dify/templates/deployment.yaml +++ b/charts/dify/templates/deployment.yaml @@ -156,6 +156,14 @@ spec: volumeMounts: {{- toYaml . | nindent 10 }} {{- end }} + {{- with .Values.worker.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.worker.readinessProbe }} + readinessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} resources: {{- toYaml .Values.worker.resources | nindent 12 }} {{- with .Values.volumes }}