Skip to content

Commit

Permalink
pro: add ability to scale for kakfa (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
domdepasquale authored Nov 30, 2023
1 parent 292ca1a commit b4c21bc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/application-core/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.7.0
version: 1.8.0

maintainers:
- name: Dominic DePasquale
26 changes: 23 additions & 3 deletions charts/application-core/templates/scaledobject.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if and .Values.autoscaling.enabled (eq .Values.autoscaling.type "scaledobject" ) }}
{{- $fullName := include "application-core.fullname" . -}}
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
Expand All @@ -20,16 +21,35 @@ spec:
minReplicaCount: {{ .Values.autoscaling.minReplicas }}
maxReplicaCount: {{ .Values.autoscaling.maxReplicas }}
triggers:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- if and .Values.autoscaling.targetCPUUtilizationPercentage (not .Values.autoscaling.kafka )}}
- type: cpu
metricType: Utilization
metadata:
value: {{ .Values.autoscaling.targetCPUUtilizationPercentage | quote }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- if and .Values.autoscaling.targetMemoryUtilizationPercentage (not .Values.autoscaling.kafka )}}
- type: memory
metricType: Utilization
metadata:
value: {{ .Values.autoscaling.targetMemoryUtilizationPercentage | quote }}
{{- end }}
{{- end }}
{{- if .Values.autoscaling.kafka }}
- type: kafka
metadata:
{{- with .Values.autoscaling.kafka }}
bootstrapServers: {{ .bootstrapServers }}
consumerGroup: {{ default $fullName .consumerGroup }}
topic: {{ .topic }}
lagThreshold: {{ default 5 .lagThreshold | quote }}
offsetResetPolicy: {{ default "latest" .offsetResetPolicy }}
allowIdleConsumers: false
scaleToZeroOnInvalidOffset: false
excludePersistentLag: false
sasl: {{ default "plaintext" .sasl }}
tls: {{ default "enable" .tls }}
username: {{ .username }}
authenticationRef:
name: {{ default "keda-kafka-creds" .authenticationRef }}
{{- end }}
{{- end }}
{{- end }}
4 changes: 4 additions & 0 deletions charts/application-core/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ autoscaling:
maxReplicas: 10
targetCPUUtilizationPercentage: 80
targetMemoryUtilizationPercentage: 80
# kafka:
# topic: this-topic
# bootstrapServers: this.web.address:9092
# username: thisusername

serviceProfile:
create: false
Expand Down

0 comments on commit b4c21bc

Please sign in to comment.