Skip to content

Commit

Permalink
feat: adding HPA for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabNeu committed Nov 23, 2023
1 parent 7cf97a8 commit a3c7baf
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
8 changes: 8 additions & 0 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ spec:
- name: {{ .Chart.Name }}
image: {{ .Values.image.containerImg }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
#TODO: Need to add requests and limits for every container
# resources:
# requests:
# memory: "1Gi"
# cpu: "1000m"
# limits:
# memory: "1Gi"
# cpu: "1000m"
ports:
- name: http
containerPort: {{ .Values.service.port }}
Expand Down
19 changes: 19 additions & 0 deletions templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Release.Name }}-hpa
namespace: {{ .Values.namespace }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ .Release.Name }}-deployment
minReplicas: {{ .Values.hpa.minReplicas }}
maxReplicas: {{ .Values.hpa.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.hpa.metrics.averageUtilization }}
7 changes: 7 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ imagePullSecrets:

namespace: webapp

hpa:
metrics:
averageUtilization: 20

minReplicas: 1
maxReplicas: 7

deployStrat:
rolling: RollingUpdate
maxSurge: 1
Expand Down

0 comments on commit a3c7baf

Please sign in to comment.