keda icon indicating copy to clipboard operation
keda copied to clipboard

Transferring ownership of an existing HPA didn't work

Open kirayamato16 opened this issue 10 months ago • 6 comments

Report

I followed this docs to migrate from an existing HPA to KEDA. I added some external scalers, advanced.horizontalPodAutoscalerConfig.behavior in ScaledObject and updated minReplicaCount & maxReplicaCount.

However, the existing HPA remained unchanged after applying the new yaml.

Expected Behavior

The ScaledObject takes control of the existing HPA and updates it with new configurations.

Actual Behavior

The existing HPA seemed to be transferred to ScaledObject but its yaml didn't change, and the HPA still scaled the Deployment based on the old configurations.

Steps to Reproduce the Problem

  1. Delete the old HPA definition from the yaml file
  2. Migrate the HPA to KEDA following this docs, add some external scalers, advanced.horizontalPodAutoscalerConfig.behavior in ScaledObject and update minReplicaCount & maxReplicaCount.
  3. Apply the new yaml

Logs from KEDA operator

Image

KEDA Version

2.16.0

Kubernetes Version

1.31

Platform

Amazon Web Services

Scaler Details

cpu, memory, aws-sqs-queue, etc.

Anything else?

No response

kirayamato16 avatar Mar 04 '25 04:03 kirayamato16

Did you use an existing ScaledObject rather than a new ScaledObject to handle the existing HPA? The error that you posted in the issue will occur in that situation.

SpiritZhou avatar Mar 04 '25 08:03 SpiritZhou

Did you use an existing ScaledObject rather than a new ScaledObject to handle the existing HPA? The error that you posted in the issue will occur in that situation.

Yes, the ScaledObject is the existing one. But I was updating it and making it take over the existing HPA for the first time. If that's not the right way to do things, how should I do? Just make ScaledObject create a new HPA and delete the old one?

kirayamato16 avatar Mar 05 '25 02:03 kirayamato16

Delete the existing ScaledObject and create a new ScaledObject can take over the existing HPA even if the new one has the same name. If using the existing ScaledObject to take over the HPA directly, ScaledObject will delete the old HPA, skip the HPA existing checking and attempt to create a new HPA, resulting in a duplicate HPA creation error.

SpiritZhou avatar Mar 06 '25 07:03 SpiritZhou

Any chance we can improve this? Making the existing ScaledObject do the existing HPA check?

kirayamato16 avatar Mar 07 '25 00:03 kirayamato16

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 May 06 '25 01:05 stale[bot]

Updating

kirayamato16 avatar May 07 '25 03:05 kirayamato16

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 Jul 06 '25 03:07 stale[bot]

This issue has been automatically closed due to inactivity.

stale[bot] avatar Jul 13 '25 04:07 stale[bot]