Skip to content

Commit

Permalink
creating hpa template
Browse files Browse the repository at this point in the history
  • Loading branch information
Vidya2606 committed Oct 8, 2024
1 parent abc79e6 commit dc738dd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
25 changes: 25 additions & 0 deletions template/deployments/helm/charts/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ printf "{{ include \"%s.fullname\" . }}" .APPNAME }}
labels:
{{- `
app.kubernetes.io/part-of: {{ .Values.partOf }}
kubernetes.azure.com/generator: {{ .Values.generatorLabel }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
` -}}
name: {{ printf "{{ include \"%s.fullname\" . }}" .APPNAME }}
{{- `
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
- type: Resource
resource:
name: {{ .Values.resourceName }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
` -}}
22 changes: 13 additions & 9 deletions template/deployments/helm/charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ service:
type: LoadBalancer
port: {{.SERVICEPORT}}

resources: {}
resources:
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi

autoscaling:
enabled: false
enabled: true
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
Expand All @@ -60,4 +60,8 @@ tolerations: []

affinity: {}

generatorLabel: {{.GENERATORLABEL}}
generatorLabel: {{.GENERATORLABEL}}

partOf: "online-store"

resourceName: "cpu"

0 comments on commit dc738dd

Please sign in to comment.