[WIP] Scaling with KEDA Kafka scaler - #4045
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aliok The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@aliok: The following test failed, say
DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
Adds KEDA Kafka consumer-lag scaling for the
kedadeployer, closes #3934.scale.keda.triggerssub-key onfunc.yaml, supportinghttp,kafka, andcrontrigger types.deployer: kedanow requires at least one trigger to be declared explicitly (existing KEDA functions are migrated to an explicithttptrigger to preserve current behavior).scale.kpasub-key for Knative-specific autoscaling config (metric/target/utilization), kept alongside the existing flat fields for backwards compatibility with older CLI versions.kedadeployer creates aScaledObject+TriggerAuthentication(via the dynamic/unstructured client — no new dependency onkedacore/keda) when akafkatrigger is present, resolving SASL/TLS credentials fromrun.kafkaand the function's secret-backed volumes.could not find current pod-template-hash) on a deployment with 0 desired replicas — needed forscale.min: 0to work with Kafka-triggered scale-to-zero.func.yaml: old vs new structure
Before (implicit HTTP trigger, flat KPA fields only):
After —
kedadeployer now requires explicit triggers. HTTP-only (equivalent to the old implicit behavior):After — Kafka consumer-lag trigger:
After —
knativedeployer, explicit KPA sub-key (old flatmetric/target/utilizationfields still work and are migrated intokpaautomatically on deploy):A
specVersionmigration handles both transitions automatically: an oldkedafunction with no triggers getskeda.triggers: [{type: http}]added, and an oldknativefunction's flat KPA fields get copied intoscale.kpa(the flat fields are left in place too, so older CLI versions can keep reading them).Known limitations (tracked separately)
ScaledObject, sohttpandkafkatriggers cannot currently be combined on the same function — the HTTP trigger'sHTTPScaledObjectcreates its own internalScaledObject. Tracked in Migrate KEDA HTTP scaling from HTTPScaledObject to ScaledObject with external trigger #4043 (migrate the HTTP path to aScaledObjectwith an external trigger, so triggers of any kind can be combined).pollingInterval,cooldownPeriod, HTTPtargetValue, etc.) are currently hardcoded rather than configurable viafunc.yaml. Tracked in Expose KEDA ScaledObject and HTTP scaling configuration options #4044.Testing
TriggerAuthentication/ScaledObjectconstruction, SASL mechanism mapping, migration behavior, and cross-field validation.TestInt_KafkaScaling,-tags integration): deploys a function with a Kafka-only trigger against a real cluster and verifies theScaledObject/TriggerAuthenticationare created with the expected spec and cleaned up on remove.{raw, knative, keda} x {no kafka, with kafka}deployer combinations end-to-end on Kind, including watching KEDA actually scale a Kafka consumer from 0 to N replicas under load, and the specVersion migration path from an old flat-scalefunc.yaml. Walkthroughs and captured resources for each scenario are underdocs/testing-deployments/.Docs
docs/reference/func_yaml.md: documenteddeployer,run.kafka,scale.keda,scale.kpa.docs/reference/func_deploy.md/--deployerflag help: updated to mention KEDA's Kafka/cron triggers, not just HTTP.