Skip to content

CRDs: allow patch merge for ScaledObject's and ScaledJob's triggers#7553

Open
paulolieuthier wants to merge 2 commits intokedacore:mainfrom
paulolieuthier:crds-triggers-merge
Open

CRDs: allow patch merge for ScaledObject's and ScaledJob's triggers#7553
paulolieuthier wants to merge 2 commits intokedacore:mainfrom
paulolieuthier:crds-triggers-merge

Conversation

@paulolieuthier
Copy link
Copy Markdown

@paulolieuthier paulolieuthier commented Mar 17, 2026

This patch makes it possible to use Kustomize to define triggers across Kustomize overlays.

Checklist

  • I have verified that my change is according to the deprecations & breaking changes policy
  • Ensure make generate-scalers-schema has been run to update any outdated generated files
  • Commits are signed with Developer Certificate of Origin (DCO - learn more)

@paulolieuthier paulolieuthier requested a review from a team as a code owner March 17, 2026 13:06
@github-actions
Copy link
Copy Markdown

Thank you for your contribution! 🙏

Please understand that we will do our best to review your PR and give you feedback as soon as possible, but please bear with us if it takes a little longer as expected.

While you are waiting, make sure to:

  • Add an entry in our changelog in alphabetical order and link related issue
  • Update the documentation, if needed
  • Add unit & e2e tests for your changes
  • GitHub checks are passing
  • Is the DCO check failing? Here is how you can fix DCO issues

Once the initial tests are successful, a KEDA member will ensure that the e2e tests are run. Once the e2e tests have been successfully completed, the PR may be merged at a later date. Please be patient.

Learn more about our contribution guide.

@snyk-io
Copy link
Copy Markdown

snyk-io bot commented Mar 17, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enables Kustomize/strategic-merge patching of spec.triggers for KEDA ScaledObject and ScaledJob CRDs by making the triggers list mergeable.

Changes:

  • Add x-kubernetes-patch-strategy: merge to spec.triggers in ScaledObject CRD schema.
  • Add x-kubernetes-patch-strategy: merge to spec.triggers in ScaledJob CRD schema.
  • Set x-kubernetes-patch-merge-key: name for both triggers lists.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
config/crd/bases/keda.sh_scaledobjects.yaml Marks spec.triggers as mergeable using name as the merge key.
config/crd/bases/keda.sh_scaledjobs.yaml Marks spec.triggers as mergeable using name as the merge key.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +370 to +371
x-kubernetes-patch-merge-key: name
x-kubernetes-patch-strategy: merge
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

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

triggers is being made an associative list keyed by name, but ScaleTriggers.name is optional and (per schema) can be an empty string. With x-kubernetes-patch-strategy: merge, unnamed/empty-name triggers will all share the same merge key, which can cause Kustomize/strategic-merge patches to unexpectedly overwrite or drop triggers. Consider tightening the schema for triggers[].name (eg minLength + clear description that it must be set uniquely when using overlays), and/or using the structural-schema list markers (x-kubernetes-list-type: map + x-kubernetes-list-map-keys: ["name"]) to make the intent explicit.

Copilot uses AI. Check for mistakes.
Comment on lines +9059 to +9060
x-kubernetes-patch-merge-key: name
x-kubernetes-patch-strategy: merge
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

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

triggers is being made an associative list keyed by name, but ScaleTriggers.name is optional and (per schema) can be an empty string. With x-kubernetes-patch-strategy: merge, unnamed/empty-name triggers will all share the same merge key, which can cause Kustomize/strategic-merge patches to unexpectedly overwrite or drop triggers. Consider tightening the schema for triggers[].name (eg minLength + clear description that it must be set uniquely when using overlays), and/or using the structural-schema list markers (x-kubernetes-list-type: map + x-kubernetes-list-map-keys: ["name"]) to make the intent explicit.

Suggested change
x-kubernetes-patch-merge-key: name
x-kubernetes-patch-strategy: merge
x-kubernetes-list-type: atomic

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

To preserve this PR, we need to update the source comments to ensure that new CRD generations don't remove these changes. Could you update the API definition directly please?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants