Skip to content

ScaledObject Validating Webhook should support dry-run=server requests #5306

Closed
@rodrigorfk

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 a scaleTargetRef of the Deployment kind.
  • The ScaledObject is defining a cpu and/or memory 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

  1. Create a helm chart with a valid ScaledObject using a Deployment or StatefulSet as a target
  2. Define a cpu or memory trigger to the ScaledObject
  3. 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

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions