Skip to content

Commit

Permalink
integrating HPA for saleor api
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikZed committed Apr 30, 2021
1 parent d7bb14d commit 8b005fd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/saleor/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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.
version: 0.1.12
version: 0.1.13

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
Expand Down
2 changes: 1 addition & 1 deletion charts/saleor/templates/saleor_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
{{- include "saleor-helm.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
replicas: {{ .Values.saleor.minReplicas }}
selector:
matchLabels:
{{- include "saleor-helm.selectorLabels" . | nindent 6 }}
Expand Down
23 changes: 23 additions & 0 deletions charts/saleor/templates/saleor_hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if .Values.saleor.enableHpa -}}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
annotations:
field.cattle.io/displayName: saleor-api-autoscaler
labels:
name: saleor-api-autoscaler
spec:
maxReplicas: {{ .Values.saleor.maxReplicas }}
metrics:
- resource:
name: cpu
target:
averageUtilization: 80
type: Utilization
type: Resource
minReplicas: {{ .Values.saleor.minReplicas }}
scaleTargetRef:
apiVersion: apps/v1beta2
kind: Deployment
name: saleor-api
{{- end }}
5 changes: 3 additions & 2 deletions charts/saleor/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
repository: registry.gitlab.com/trieb.work/saleor
pullPolicy: IfNotPresent
Expand Down Expand Up @@ -54,6 +52,9 @@ ingress:
# - chart-example.local

saleor:
enableHpa: true
maxReplicas: 3
minReplicas: 2
resources:
requests:
cpu: 300m
Expand Down

0 comments on commit 8b005fd

Please sign in to comment.