Skip to content

Commit

Permalink
adding hpa 2
Browse files Browse the repository at this point in the history
  • Loading branch information
M_Westerholz committed Nov 4, 2024
1 parent 349e5a9 commit 2381c46
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
heritage: {{ .Release.Service }}

spec:
replicas: {{ .Values.replicaCount }}
replicas: {{ if not .Values.autoscaling.enabled }}{{ .Values.replicaCount }}{{ end }}
selector:
matchLabels:
app: {{ template "phpldapadmin.name" . }}
Expand Down
30 changes: 30 additions & 0 deletions charts/dbildungs-iam-ldap/templates/hpa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "common.names.name" . }}
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ include "common.names.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "common.names.name" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
6 changes: 6 additions & 0 deletions charts/dbildungs-iam-ldap/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -424,3 +424,9 @@ phpldapadmin:
# - secretName: phpldapadmin.example
# hosts:
# - phpldapadmin.example
autoscaling:
enabled: true
minReplicas: 1
maxReplicas: 5
targetCPUUtilizationPercentage: 80
targetMemoryUtilizationPercentage: 80

0 comments on commit 2381c46

Please sign in to comment.