Skip to content

Make run.kafka.sasl.mechanism optional - #4072

Open
aliok wants to merge 3 commits into
knative:mainfrom
aliok:fix-kafka-sasl-mechanism
Open

aliok wants to merge 3 commits into
knative:mainfrom
aliok:fix-kafka-sasl-mechanism

Conversation

@aliok

@aliok aliok commented Oct 2, 2026

Copy link
Copy Markdown
Member

Changes

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

  • 🐛 Make run.kafka.sasl.mechanism optional. func-go's Kafka runtime
    defaults an empty mechanism to PLAIN, so a SASL/PLAIN broker deployed and
    consumed fine before scale.keda landed. Requiring the field broke that config
    on every deployer (raw, knative, keda), not only keda. Validation now
    constrains only a non-empty value to the mechanisms both sides understand, and
    kedaSASLType maps "" to KEDA's plaintext so the scaler authenticates the
    same way the function container does.

/kind bug

Relates to #4069

Release Note

Fixed a regression where `run.kafka.sasl.mechanism` was required: it is now optional
and defaults to PLAIN, so SASL/PLAIN Kafka functions that omit it deploy again without
edits.

Docs


@knative-prow knative-prow Bot added the kind/bug Bugs label Oct 2, 2026
@knative-prow

knative-prow Bot commented Oct 2, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aliok
Once this PR has been reviewed and has the lgtm label, please assign matejvasek for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 size/M 🤖 PR changes 30-99 lines, ignoring generated files. label Oct 2, 2026

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

🟡 Changes recommended

KEDA metadata must emit SASL plaintext configuration when the mechanism is omitted.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Makes run.kafka.sasl.mechanism optional, defaulting omitted values to SASL/PLAIN.

Changes:

  • Relaxes mechanism validation.
  • Maps empty mechanisms to KEDA plaintext.
  • Updates tests and documentation.

A critical issue remains: empty mechanisms are not emitted in KEDA ScaledObject metadata.

File Reviewed changes
pkg/​keda/​kafka_scaling.go Adds empty-mechanism mapping.
pkg/​keda/​kafka_scaling_test.go Tests the mapping.
pkg/​keda/​deployer_unit_test.go Removes obsolete required-mechanism coverage.
pkg/​functions/​function.go Makes mechanism validation conditional.
pkg/​functions/​function_test.go Tests empty mechanisms.
docs/​reference/​func_yaml.md Documents the optional field and default.

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

Comment thread pkg/keda/kafka_scaling.go

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

🔵 Needs a closer look

Align the shipped KafkaSASL schema with validation so explicit empty mechanisms are accepted consistently.

Review effort: Lite
Findings: None

Resolved since last review (1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Bugs size/M 🤖 PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants