keda icon indicating copy to clipboard operation
keda copied to clipboard

Admissions webhook rejects when helm upgrade done with renamed ScaledObject

Open govindbalaji-s opened this issue 1 year ago • 3 comments

Report

Let's say I have a ScaledObject already installed with "name: initial-scaled-object", and it's target is a deployment with name "target-deployment".

Now, if I rename the ScaledObject in my helm charts to "name: renamed-scaled-object", admissions webhook starts failing the helm upgrade with:

upgrade.go:367: [debug] warning: Upgrade "<<RELEASE_NAME>>" failed: failed to create resource: admission webhook "vscaledobject.kb.io" denied the request: the workload 'target-deployment' of type 'apps/v1.Deployment' is already managed by the ScaledObject 'initial-scaled-object'

Expected Behavior

Scaled object with "renamed-scaled-object" name gets created, then "initial-scaled-object" gets deleted by helm upgrade.

Actual Behavior

Creation of "renamed-scaled-object" fails with above error.

Steps to Reproduce the Problem

  1. Install a scaledobject with some name targeting some deployment.
  2. Rename the scaledobject in your helm charts and do a helm upgrade.

Logs from KEDA operator

No response

KEDA Version

2.11.2

Kubernetes Version

1.25

Platform

Amazon Web Services

Scaler Details

No response

Anything else?

No response

govindbalaji-s avatar Nov 08 '23 06:11 govindbalaji-s

I think this is the correct behavior because the name is the identifier of the ScaledObject. Automatically replacing the current ScaledObject with another ScaledObject that has a new identifier can be a little tricky.

SpiritZhou avatar Nov 14 '23 08:11 SpiritZhou

What's the right way to rename a ScaledObject when used with helm then?

govindbalaji-s avatar Nov 15 '23 05:11 govindbalaji-s

We are also encountering a similar issue. In our case, the creation of the ScaledObject is failing because there is already an HPA for a deployment that we are attempting to update, as we are transitioning from native HPA to ScaledObject.

helm.go:84: [debug] admission webhook "vscaledobject.kb.io" denied the request: the workload 'app-prod-http' of type 'apps/v1.Deployment' is already managed by the hpa 'app-prod-http'

prajithp13 avatar Dec 14 '23 09:12 prajithp13

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.

stale[bot] avatar Feb 13 '24 03:02 stale[bot]

This issue has been automatically closed due to inactivity.

stale[bot] avatar Feb 20 '24 10:02 stale[bot]

We are also encountering a similar issue. In our case, the creation of the ScaledObject is failing because there is already an HPA for a deployment that we are attempting to update, as we are transitioning from native HPA to ScaledObject.

helm.go:84: [debug] admission webhook "vscaledobject.kb.io" denied the request: the workload 'app-prod-http' of type 'apps/v1.Deployment' is already managed by the hpa 'app-prod-http'

For anyone else running into this, this did the trick for me.

lucyeun-alation avatar Feb 23 '24 04:02 lucyeun-alation