Skip to content

Commit

Permalink
Helm Chart: Scaling the event handler is not possible (#666)
Browse files Browse the repository at this point in the history
* feat: make replicas configurable

* feat: add HorizontalPodAutoscaler
  • Loading branch information
tnotheis authored May 23, 2024
1 parent 70ac464 commit fe00b2d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
6 changes: 3 additions & 3 deletions helm/templates/eventhandler/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ metadata:
{{- include "global.labels" . | nindent 4 }}
app: {{ .Values.eventhandler.name }}
spec:
replicas: 1
replicas: {{ .Values.eventhandler.replicas }}
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: {{ .Values.maxSurge }}
maxUnavailable: {{ .Values.maxUnavailable }}
maxSurge: {{ .Values.eventhandler.maxSurge }}
maxUnavailable: {{ .Values.eventhandler.maxUnavailable }}
selector:
matchLabels:
app: {{ .Values.eventhandler.name }}
Expand Down
28 changes: 28 additions & 0 deletions helm/templates/eventhandler/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.eventhandler.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Values.eventhandler.name }}
labels:
{{- include "global.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ .Values.eventhandler.name }}
minReplicas: {{ .Values.eventhandler.autoscaling.minReplicas }}
maxReplicas: {{ .Values.eventhandler.autoscaling.maxReplicas }}
metrics:
{{- if .Values.eventhandler.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.eventhandler.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.eventhandler.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.eventhandler.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

0 comments on commit fe00b2d

Please sign in to comment.