# NOT EXECUTED: see deployment.yaml. Field names and defaults were taken from the KEDA 2.21 # documentation (ScaledObject specification and the Apache Kafka scaler page). apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: orders-consumer spec: scaleTargetRef: name: orders-consumer pollingInterval: 15 # seconds between scaler checks when scaling from/to zero (default 30) cooldownPeriod: 120 # only delays scale-to-ZERO after the last active trigger (default 300) minReplicaCount: 1 # 0 enables scale-to-zero (the default); 1 keeps one warm pod maxReplicaCount: 6 # keep <= partitions of the topic; more pods than partitions sit idle advanced: horizontalPodAutoscalerConfig: behavior: # passed straight to the HPA scaleDown: stabilizationWindowSeconds: 300 policies: - type: Pods value: 1 periodSeconds: 60 # remove at most one pod a minute: every removal is a rebalance triggers: - type: kafka metadata: bootstrapServers: kafka.kafka.svc.cluster.local:9092 consumerGroup: orders-consumer topic: orders lagThreshold: "100" # target lag PER REPLICA (default 10) activationLagThreshold: "10" # lag must be strictly greater than this to wake from zero offsetResetPolicy: earliest # limitToPartitionsWithLag: "true" # for skewed topics; needs `topic`; not with allowIdleConsumers