fix: return validation error from verifyReplicaCount in ScaledObject webhook#7562
Merged
rickbrouwer merged 2 commits intoMar 20, 2026
Merged
Conversation
…webhook The verifyReplicaCount function in the ScaledObject admission webhook logged the validation error from CheckReplicaCountBoundsAreValid but always returned nil, allowing ScaledObjects with invalid replica count bounds (e.g. minReplicaCount > maxReplicaCount) to be created despite failing validation. This fix changes the function to return the error, consistent with the other verify functions (verifyFallback, verifyTriggers, etc.). The //nolint:unparam directive is also removed since the error return is no longer always nil. Fixes kedacore#5954 Signed-off-by: Rohan Sood <[email protected]>
|
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:
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. |
The validate-changelog pre-commit hook requires entries within each section to be sorted alphabetically. Move the kedacore#5954 entry to its correct position among the General entries. Signed-off-by: Rohan Sood <[email protected]>
Member
|
/run-e2e internal |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
rickbrouwer
approved these changes
Mar 20, 2026
jansworld
pushed a commit
to jansworld/keda
that referenced
this pull request
Apr 10, 2026
…webhook (kedacore#7562) * fix: return validation error from verifyReplicaCount in ScaledObject webhook The verifyReplicaCount function in the ScaledObject admission webhook logged the validation error from CheckReplicaCountBoundsAreValid but always returned nil, allowing ScaledObjects with invalid replica count bounds (e.g. minReplicaCount > maxReplicaCount) to be created despite failing validation. This fix changes the function to return the error, consistent with the other verify functions (verifyFallback, verifyTriggers, etc.). The //nolint:unparam directive is also removed since the error return is no longer always nil. Fixes kedacore#5954 Signed-off-by: Rohan Sood <[email protected]> * fix: sort CHANGELOG Fixes entries alphabetically The validate-changelog pre-commit hook requires entries within each section to be sorted alphabetically. Move the kedacore#5954 entry to its correct position among the General entries. Signed-off-by: Rohan Sood <[email protected]> --------- Signed-off-by: Rohan Sood <[email protected]> Signed-off-by: jansworld <[email protected]>
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
The
verifyReplicaCountfunction in the ScaledObject admission webhook logged validation errors fromCheckReplicaCountBoundsAreValidbut always returnednil, allowing ScaledObjects with invalid replica count bounds (e.g.minReplicaCount > maxReplicaCount) to be created despite failing validation.Changes
verifyReplicaCount(): Returnerrinstead ofnilso the admission webhook properly rejects ScaledObjects with invalid replica count configurations//nolint:unparamdirective since the error return is no longer always nilThis makes
verifyReplicaCountconsistent with the other verify functions (verifyFallback,verifyTriggers, etc.) which already correctly return their errors.Checklist
shouldn't validate the so creation when the replica counts are wrong)Fixes #5954