From 1c2a51a395bae974ec368dfe6784f0f126301bc0 Mon Sep 17 00:00:00 2001 From: wangxiaoyou1993 Date: Tue, 21 May 2024 17:03:02 -0700 Subject: [PATCH 1/2] [xy] Update default setting. --- charts/mageai/templates/hpa.yaml | 12 ++++++++++++ charts/mageai/values.yaml | 6 ++++++ 2 files changed, 18 insertions(+) create mode 100644 charts/mageai/templates/hpa.yaml diff --git a/charts/mageai/templates/hpa.yaml b/charts/mageai/templates/hpa.yaml new file mode 100644 index 0000000..b073d15 --- /dev/null +++ b/charts/mageai/templates/hpa.yaml @@ -0,0 +1,12 @@ +{{- if .Values.hpa -}} +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: deployment-name-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "mageai.fullname" . }} + {{- toYaml .Values.hpa | nindent 2 }} +{{- end }} diff --git a/charts/mageai/values.yaml b/charts/mageai/values.yaml index 89ff991..c1377cb 100644 --- a/charts/mageai/values.yaml +++ b/charts/mageai/values.yaml @@ -117,6 +117,12 @@ customLivenessProbe: {} # Custom readiness probe customReadinessProbe: {} +# Horizontal pod autoscaler +# hpa: +# minReplicas: 1 +# maxReplicas: 10 +# targetCPUUtilizationPercentage: 50 + # We recommend creating the ingress separately instead of creating it using this chart. # There is a corresponding Mage-Ingress chart to create an ingress for Mage if needed. # This section is kept here for backwards compatibility. From 600a92322be8b8542cc03b7e0d45778ae35dba7d Mon Sep 17 00:00:00 2001 From: wangxiaoyou1993 Date: Tue, 21 May 2024 17:56:27 -0700 Subject: [PATCH 2/2] [xy] Hpa for web server and scheduler. --- charts/mageai/templates/hpa.yaml | 36 +++++++++++++++++++++++++++++++- charts/mageai/values.yaml | 9 +++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/charts/mageai/templates/hpa.yaml b/charts/mageai/templates/hpa.yaml index b073d15..2587fd1 100644 --- a/charts/mageai/templates/hpa.yaml +++ b/charts/mageai/templates/hpa.yaml @@ -1,8 +1,10 @@ +{{- if not .Values.standaloneScheduler }} + {{- if .Values.hpa -}} apiVersion: autoscaling/v1 kind: HorizontalPodAutoscaler metadata: - name: deployment-name-hpa + name: {{ include "mageai.fullname" . }}-hpa spec: scaleTargetRef: apiVersion: apps/v1 @@ -10,3 +12,35 @@ spec: name: {{ include "mageai.fullname" . }} {{- toYaml .Values.hpa | nindent 2 }} {{- end }} + +{{- else }} + +{{- if .Values.scheduler.hpa -}} +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ .Values.scheduler.name }}-scheduler-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ .Values.scheduler.name }} + {{- toYaml .Values.scheduler.hpa | nindent 2 }} +{{- end }} + +--- + +{{- if .Values.webServer.hpa -}} +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ .Values.webServer.name }}-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ .Values.webServer.name }} + {{- toYaml .Values.webServer.hpa | nindent 2 }} +{{- end }} + +{{- end }} diff --git a/charts/mageai/values.yaml b/charts/mageai/values.yaml index c1377cb..5db575f 100644 --- a/charts/mageai/values.yaml +++ b/charts/mageai/values.yaml @@ -20,7 +20,10 @@ scheduler: # requests: # cpu: 100m # memory: 128Mi - + # hpa: + # minReplicas: 1 + # maxReplicas: 10 + # targetCPUUtilizationPercentage: 50 # Effective if standaloneScheduler is true webServer: @@ -37,6 +40,10 @@ webServer: # requests: # cpu: 100m # memory: 128Mi + # hpa: + # minReplicas: 1 + # maxReplicas: 10 + # targetCPUUtilizationPercentage: 50 # Enable redis if you want more replica redis: