Skip to content

Commit

Permalink
Dbp 1021 adapt spsh helm charts for autoscaling (#748)
Browse files Browse the repository at this point in the history
Dbp 1021 adapt spsh helm charts for autoscaling (#748)
  • Loading branch information
MWesterholz authored Nov 12, 2024
1 parent b83e60c commit 221f752
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
2 changes: 2 additions & 0 deletions charts/dbildungs-iam-server/templates/backend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ metadata:
{{- include "common.labels" . | nindent 4 }}
app.kubernetes.io/component: server-backend
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.backend.replicaCount }}
{{- end }}
selector:
matchLabels:
app.kubernetes.io/name: {{ template "common.names.name" . }}
Expand Down
32 changes: 32 additions & 0 deletions charts/dbildungs-iam-server/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.autoscaling.enabled }}
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" . }}-backend
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
behavior:
scaleDown:
policies:
- type: Percent
value: 100
periodSeconds: 60
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
15 changes: 6 additions & 9 deletions charts/dbildungs-iam-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,9 @@ redis-cluster:
memory: 128Mi
metrics:
enabled: true
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 50m
memory: 64Mi
serviceMonitor:
enabled: true

autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 5
targetCPUUtilizationPercentage: 60

0 comments on commit 221f752

Please sign in to comment.