Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xy] Support horizontal pod scaler in deployment #52

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions charts/mageai/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{{- if not .Values.standaloneScheduler }}

{{- if .Values.hpa -}}
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "mageai.fullname" . }}-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
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 }}
15 changes: 14 additions & 1 deletion charts/mageai/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ scheduler:
# requests:
# cpu: 100m
# memory: 128Mi

# hpa:
# minReplicas: 1
# maxReplicas: 10
# targetCPUUtilizationPercentage: 50

# Effective if standaloneScheduler is true
webServer:
Expand All @@ -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:
Expand Down Expand Up @@ -117,6 +124,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.
Expand Down
Loading