ScaledObject Validating Webhook should support dry-run=server requests #5306
Closed
Description
Report
Certain use cases require the usage of server side dry-run request to validate manifests at Kubernetes API server side, a simple way of simulating that would be, when using a helm chart, to execute the following:
helm -n default template release-name some-chart-name | kubectl -n default apply -f - --dry-run=server
Assuming the helm chart has the following:
- A
ScaledObject
defined for ascaleTargetRef
of theDeployment
kind. - The
ScaledObject
is defining acpu
and/ormemory
trigger.
The kubectl
command is going to fail with the following error:
Error from server (NotFound): error when creating "STDIN": admission webhook "vscaledobject.kb.io" denied the request: Deployment.apps "some-deployment" not found
Expected Behavior
I would expect, when in dry-run
mode, the admission webhook to succeed without requiring the deployment to exist, meaning the webhook wouldn't check by a side effect during dry-run mode.
Actual Behavior
The admission webhook is failing due side effects when in dry-run mode, side effects should only be checked when the request is not in dry-run mode.
Steps to Reproduce the Problem
- Create a helm chart with a valid ScaledObject using a Deployment or StatefulSet as a target
- Define a
cpu
ormemory
trigger to the ScaledObject - Execute
helm -n default template release-name some-chart-name | kubectl -n default apply -f - --dry-run=server
Logs from KEDA operator
example
KEDA Version
2.12.1
Kubernetes Version
1.26
Platform
Amazon Web Services
Scaler Details
CPU, memory
Anything else?
No response
Metadata
Assignees
Labels
Type
Projects
Status
Done