Registry Mirror
Skip to content

Conversation

@aliok

@aliok aliok commented Oct 5, 2026

Copy link
Copy Markdown
Member

Changes

Follow-up to review feedback on #4069 (thanks @gauron99); reproduced on a live
cluster.

  • 🐛 Stop rejecting scale.kpa on the keda deployer. scale.kpa is
    deployer: knative config. Per the contract settled in Add top-level scale field to func.yaml #4063, the raw and
    keda deployers ignore it with a warning rather than rejecting it. Add KEDA Kafka consumer-lag scaling (scale.keda) #4069 broke
    that contract on the keda path in two places:

    • Deploy failed. triggers() returned nil when scale.kpa was set
      without scale.keda, so Deploy tripped its empty-triggers guard and failed
      with deployer keda requires at least one trigger in scale.keda.triggers --
      after first printing the "scale.kpa is ignored" warning.
    • Validation failed. scale.keda + scale.kpa together were treated as
      mutually exclusive, so adding a trigger to a function that already carried a
      scale.kpa block was rejected outright. Within a single run the user was
      told the block was ignored and then rejected for it.

    This is not just a hand-written-config edge case: the 0.38.0 migration
    (migrateScaleToTopLevel) lifts the legacy flat metric/target/utilization
    fields into scale.kpa for every deployer, deliberately keeping the block
    rather than dropping it (so a later switch to deployer: knative isn't lossy).
    So a keda function that used those legacy fields would stop deploying after an
    upgrade, for config the user never wrote.

    The fix restores the pre-Add KEDA Kafka consumer-lag scaling (scale.keda) #4069 behavior -- warn, then deploy with the http
    scaler
    :

    • triggers() falls back to the default http trigger instead of returning
      nil. This matches IntendedScalerType, which already resolves http for a
      keda function with only scale.kpa, so the deploy-time scaler-switch gate
      and the deploy agree on the scaler type.
    • The deploy-time ValidateScale backstop in the keda deployer is gated on
      scale.keda alone. Nothing is lost: the keda deployer's own preflight
      already guards scale.min/scale.max independently, and the remaining
      backstop checks (pollingInterval/cooldownPeriod/per-trigger thresholds) live
      under scale.keda and are vacuous without it.
    • The scale.keda/scale.kpa mutual-exclusion rule is dropped (plus the
      matching docs sentence and tests).

    The "scale.kpa is ignored" warning (cmd/deploy.go) is unchanged, so a keda
    function carrying scale.kpa now warns and deploys instead of failing.

/kind bug

Relates to #4069

Release Note

Fixed a regression where a `deployer: keda` function carrying a `scale.kpa` block
(for example after the 0.38.0 migration moved legacy flat scale fields into it) failed
to deploy. `scale.kpa` is now ignored on the keda deployer, as documented, instead of
being rejected.

Docs


@knative-prow knative-prow Bot added the kind/bug Bugs label Oct 5, 2026
@knative-prow knative-prow Bot added the size/M 🤖 PR changes 30-99 lines, ignoring generated files. label Oct 5, 2026
@aliok
aliok requested a lite review from Copilot October 5, 2026 08:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Restores KEDA compatibility for functions containing ignored scale.kpa configuration.

Changes:

  • Falls back to HTTP scaling when only scale.kpa is present.
  • Removes KEDA/KPA mutual-exclusion validation.
  • Updates validation, tests, and documentation.
File Summary
pkg/​keda/​kafka_scaling.go Restores HTTP trigger fallback.
pkg/​keda/​kafka_scaling_test.go Tests KPA-only fallback behavior.
pkg/​keda/​deployer.go Limits validation to explicit KEDA configuration.
pkg/​keda/​deployer_unit_test.go Removes obsolete exclusivity test.
pkg/​functions/​function_scale.go Allows KEDA and KPA blocks together.
pkg/​functions/​function_options_unit_test.go Tests coexistence validation.
docs/​reference/​func_yaml.md Documents ignored deployer-specific configuration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@aliok
aliok force-pushed the fix-keda-kpa-scale branch from 5fe8daa to f0c6f53 Compare October 5, 2026 14:49
@aliok
aliok force-pushed the fix-keda-kpa-scale branch from f0c6f53 to a74f7da Compare October 6, 2026 07:16
@gauron99

gauron99 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@knative-prow knative-prow Bot added the lgtm 🤖 PR is ready to be merged. label Oct 6, 2026
@knative-prow

knative-prow Bot commented Oct 6, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aliok, gauron99

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow Bot added the approved 🤖 PR has been approved by an approver from all required OWNERS files. label Oct 6, 2026
@knative-prow
knative-prow Bot merged commit 104fd69 into knative:main Oct 6, 2026
71 of 72 checks passed
@aliok
aliok deleted the fix-keda-kpa-scale branch October 6, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved 🤖 PR has been approved by an approver from all required OWNERS files. kind/bug Bugs lgtm 🤖 PR is ready to be merged. size/M 🤖 PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants