Skip to content

Commit

Permalink
dev: add hpa (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshv1995 authored Mar 13, 2024
1 parent b0a1d8a commit 679c4b4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ charts-dir: squadcast-helm
sign: false
charts_repo_url: https://squadcasthub.github.io/helm-infra
index-path: .
version: 0.2.4
version: 0.2.5
2 changes: 1 addition & 1 deletion squadcast-helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ name: squadcast-helm
description: A Helm chart for Kubernetes
type: application

version: 0.2.4
version: 0.2.5

appVersion: "1.16.0"
24 changes: 14 additions & 10 deletions squadcast-helm/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "squadcast-helm.fullname" . }}
labels:
name: {{ include "squadcast-helm.fullname" . }}
labels:
{{- include "squadcast-helm.labels" . | nindent 4 }}
namespace: {{ .Values.namespace }}
namespace: {{ .Values.namespace }}

spec:
scaleTargetRef:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "squadcast-helm.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

0 comments on commit 679c4b4

Please sign in to comment.