[WIP] Scaling with KEDA Kafka scaler - #4045
Open
aliok wants to merge 6 commits into
Open
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.