From d39dc5177b6fc2a42504f125dbb50db5cc333ccb Mon Sep 17 00:00:00 2001 From: Alexey Fomenko Date: Wed, 21 Aug 2024 09:05:22 +0300 Subject: [PATCH] HPA: set maxReplicas from Values, add grace period Signed-off-by: Alexey Fomenko --- helm-charts/chatqna/templates/deployment.yaml | 3 +++ helm-charts/chatqna/templates/horizontalPorAutoscaler.yaml | 2 +- helm-charts/chatqna/values.yaml | 1 + helm-charts/common/embedding-usvc/templates/deployment.yaml | 3 +++ .../embedding-usvc/templates/horizontalPodAutoscaler.yaml | 2 +- helm-charts/common/embedding-usvc/values.yaml | 1 + helm-charts/common/reranking-usvc/templates/deployment.yaml | 3 +++ .../reranking-usvc/templates/horizontalPodAutoscaler.yaml | 2 +- helm-charts/common/reranking-usvc/values.yaml | 1 + 9 files changed, 15 insertions(+), 3 deletions(-) diff --git a/helm-charts/chatqna/templates/deployment.yaml b/helm-charts/chatqna/templates/deployment.yaml index 7f94009be..77fc8efa2 100644 --- a/helm-charts/chatqna/templates/deployment.yaml +++ b/helm-charts/chatqna/templates/deployment.yaml @@ -71,6 +71,9 @@ spec: # port: {{ .Values.port }} resources: {{- toYaml .Values.resources | nindent 12 }} + {{- if .Values.horizontalPodAutoscaler.enabled }} + terminationGracePeriodSeconds: 120 + {{- end }} volumes: - name: tmp emptyDir: {} diff --git a/helm-charts/chatqna/templates/horizontalPorAutoscaler.yaml b/helm-charts/chatqna/templates/horizontalPorAutoscaler.yaml index 1d8792f7a..655916b48 100644 --- a/helm-charts/chatqna/templates/horizontalPorAutoscaler.yaml +++ b/helm-charts/chatqna/templates/horizontalPorAutoscaler.yaml @@ -12,7 +12,7 @@ spec: kind: Deployment name: {{ include "chatqna.fullname" . }} minReplicas: 1 - maxReplicas: 6 + maxReplicas: {{ .Values.horizontalPodAutoscaler.maxReplicas }} metrics: - type: Object object: diff --git a/helm-charts/chatqna/values.yaml b/helm-charts/chatqna/values.yaml index 1edd830a4..f59517a06 100644 --- a/helm-charts/chatqna/values.yaml +++ b/helm-charts/chatqna/values.yaml @@ -8,6 +8,7 @@ replicaCount: 1 horizontalPodAutoscaler: enable: false + maxReplicas: 6 image: repository: opea/chatqna diff --git a/helm-charts/common/embedding-usvc/templates/deployment.yaml b/helm-charts/common/embedding-usvc/templates/deployment.yaml index 5e5503f1d..4b753c98d 100644 --- a/helm-charts/common/embedding-usvc/templates/deployment.yaml +++ b/helm-charts/common/embedding-usvc/templates/deployment.yaml @@ -65,6 +65,9 @@ spec: {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} + {{- if .Values.horizontalPodAutoscaler.enabled }} + terminationGracePeriodSeconds: 60 + {{- end }} volumes: - name: tmp emptyDir: {} diff --git a/helm-charts/common/embedding-usvc/templates/horizontalPodAutoscaler.yaml b/helm-charts/common/embedding-usvc/templates/horizontalPodAutoscaler.yaml index 2632f3e27..4a55df11a 100644 --- a/helm-charts/common/embedding-usvc/templates/horizontalPodAutoscaler.yaml +++ b/helm-charts/common/embedding-usvc/templates/horizontalPodAutoscaler.yaml @@ -12,7 +12,7 @@ spec: kind: Deployment name: {{ include "embedding-usvc.fullname" . }} minReplicas: 1 - maxReplicas: 2 + maxReplicas: {{ .Values.horizontalPodAutoscaler.maxReplicas }} metrics: - type: Object object: diff --git a/helm-charts/common/embedding-usvc/values.yaml b/helm-charts/common/embedding-usvc/values.yaml index 2349a8d8f..492c3c2ba 100644 --- a/helm-charts/common/embedding-usvc/values.yaml +++ b/helm-charts/common/embedding-usvc/values.yaml @@ -11,6 +11,7 @@ autodependency: replicaCount: 1 horizontalPodAutoscaler: enabled: false + maxReplicas: 2 TEI_EMBEDDING_ENDPOINT: "" image: diff --git a/helm-charts/common/reranking-usvc/templates/deployment.yaml b/helm-charts/common/reranking-usvc/templates/deployment.yaml index 2619e4d0f..dbc9e3ecf 100644 --- a/helm-charts/common/reranking-usvc/templates/deployment.yaml +++ b/helm-charts/common/reranking-usvc/templates/deployment.yaml @@ -65,6 +65,9 @@ spec: {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} + {{- if .Values.horizontalPodAutoscaler.enabled }} + terminationGracePeriodSeconds: 60 + {{- end }} volumes: - name: tmp emptyDir: {} diff --git a/helm-charts/common/reranking-usvc/templates/horizontalPodAutoscaler.yaml b/helm-charts/common/reranking-usvc/templates/horizontalPodAutoscaler.yaml index 36fcb429a..b24fa3294 100644 --- a/helm-charts/common/reranking-usvc/templates/horizontalPodAutoscaler.yaml +++ b/helm-charts/common/reranking-usvc/templates/horizontalPodAutoscaler.yaml @@ -12,7 +12,7 @@ spec: kind: Deployment name: {{ include "reranking-usvc.fullname" . }} minReplicas: 1 - maxReplicas: 3 + maxReplicas: {{ .Values.horizontalPodAutoscaler.maxReplicas }} metrics: - type: Object object: diff --git a/helm-charts/common/reranking-usvc/values.yaml b/helm-charts/common/reranking-usvc/values.yaml index 991345be4..025536d68 100644 --- a/helm-charts/common/reranking-usvc/values.yaml +++ b/helm-charts/common/reranking-usvc/values.yaml @@ -11,6 +11,7 @@ autodependency: replicaCount: 1 horizontalPodAutoscaler: enabled: false + maxReplicas: 3 TEI_RERANKING_ENDPOINT: "" image: