Fix admission webhook validation not denying invalid fallbacks and replica counts#5962
Fix admission webhook validation not denying invalid fallbacks and replica counts#5962vzdai wants to merge 4 commits intokedacore:mainfrom
Conversation
|
Regarding tests: The test case for the webhook rejecting invalid fallback is done here. However, this was falsely passing before due to the section: According to Gomega docs, Is there a reason we are wrapping this assertion in an The whole |
|
Awesome catch! In theory, the addmission webhook must block invalid SO, so I think that the fix isn't a breaking change (@tomkerkhove @zroubalik ?) Could you update the test to ensure that the behaviour is correctly covered by tests? |
4003f16 to
9864f70
Compare
| return k8sClient.Create(context.Background(), so) | ||
| }).Should(HaveOccurred()) | ||
| err = k8sClient.Create(context.Background(), so) | ||
| Expect(err).To(HaveOccurred()) |
There was a problem hiding this comment.
I've removed the use of Eventually in these tests according to #5962 (comment).
I also set up vzdai#1 to remove Eventually from all other tests where it's not needed. That branch is based off of this branch (since without the changes here, some tests would fail), and once this PR gets merged, I can remake that PR in kedacore:main.
|
/run-e2e |
|
/run-e2e |
…plica counts Signed-off-by: Vivian Dai <viviandai12@gmail.com>
Signed-off-by: Vivian Dai <viviandai12@gmail.com>
ce73bea to
32ff796
Compare
|
Rebased onto |
|
/run-e2e |
|
PTAL @wozniakjan |
zroubalik
left a comment
There was a problem hiding this comment.
What if there is some scaler that supports fallback (eg. Prometheus) and also CPU/Memory scaler?
imho ideally KEDA should allow this, looks like this PR would make it not possible while in previous versions it just logged as an error? |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
|
This issue has been automatically closed due to inactivity. |
Provide a description of what has been changed
When a ScaledObject with an invalid fallback (using fallback with CPU/Memory scalers) or an invalid replica count (minReplicaCount > maxReplicaCount) was applied, the admission webhook logged an error but the ScaledObject was still updated.
After this fix, attempting to create an invalid ScaledObject will get rejected with the respective error messages:
Note: Since invalid ScaledObjects applies are being allowed through right now, users may encounter errors when trying to update the same ScaledObject after this change. I'm unsure if this should be considered a breaking change or if it needs an additional warning somewhere.
Checklist
Fixes #5954