Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPA is not created for deployments with long names #2915

Closed
bmalka opened this issue Apr 17, 2022 · 12 comments
Closed

HPA is not created for deployments with long names #2915

bmalka opened this issue Apr 17, 2022 · 12 comments
Labels
bug Something isn't working help wanted Looking for support from community stale-bot-ignore All issues that should not be automatically closed by our stale bot

Comments

@bmalka
Copy link

bmalka commented Apr 17, 2022

Report

Related to bug #704

Error:
HPA is failing to be created: controller.scaledobject Failed to update ScaledObject with scaledObjectName label

Expected Behavior

HPA should be created

Actual Behavior

HPA wasn't created

Steps to Reproduce the Problem

  1. Add a deployment with name longer than 45 chars

Logs from KEDA operator

1.650181258876292e+09 ERROR controller.scaledobject Failed to update ScaledObject with scaledObjectName label {"reconciler group": "keda.sh", "reconciler kind": "ScaledObject", "name": "kafka-scaledobject-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxx-xxxxxx-xxxxxxxxx", "namespace": "production-xx-xxxxxxxxxx", "error": "ScaledObject.keda.sh "kafka-scaledobject-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxx-xxxxxx-xxxxxxxxx" is invalid: metadata.labels: Invalid value: "kafka-scaledobject-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxx-xxxxxx-xxxxxxxxx": must be no more than 63 characters"}

KEDA Version

2.6.1

Kubernetes Version

1.21

Platform

Amazon Web Services

Scaler Details

No response

Anything else?

No response

@bmalka bmalka added the bug Something isn't working label Apr 17, 2022
@tomkerkhove tomkerkhove moved this to Proposed in Roadmap - KEDA Core Apr 17, 2022
@JorTurFer JorTurFer moved this from Proposed to In Review in Roadmap - KEDA Core May 3, 2022
@JorTurFer
Copy link
Member

Hey,
I'd say that the problem is related with the ScaledObject length. Is there any option to reduce it? I have created a PR (linked to this issue) but we are discussing it there

@tomkerkhove
Copy link
Member

From #2995: We need to have a robust solution where creating two ScaledObjects with the same name does not break the link.

Current thinking: Generate unique IDs per ScaledObject and use those instead. These unique IDs should be available to end-users (ie when doing kubectl get scaledobject) so that they can use them as well.

@JorTurFer
Copy link
Member

yes, as @tomkerkhove said, we have to think it better so this fix will not be included till v2.8. Meanwhile, you could try reducing the ScaledObject name size 🙏

@JorTurFer JorTurFer moved this from In Review to In Progress in Roadmap - KEDA Core May 4, 2022
@stale
Copy link

stale bot commented Jul 3, 2022

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 stale bot added the stale All issues that are marked as stale due to inactivity label Jul 3, 2022
@zroubalik zroubalik added the help wanted Looking for support from community label Jul 3, 2022
@stale stale bot removed the stale All issues that are marked as stale due to inactivity label Jul 3, 2022
@zroubalik zroubalik added stale-bot-ignore All issues that should not be automatically closed by our stale bot stale All issues that are marked as stale due to inactivity labels Jul 3, 2022
@stale stale bot removed the stale All issues that are marked as stale due to inactivity label Jul 3, 2022
@zroubalik
Copy link
Member

What we can do, is to generate some UID suffix to name like, keda-hpa-... in case the standard generated name would be too long. This way we would keep the original design, but also offer solution for longer names.

@JorTurFer
Copy link
Member

Yes, but in that case we should add the current name as an annotation IMO to having a simple way to track which is what without inspecting all the SO looking for the UID

@tomkerkhove
Copy link
Member

What if somebody changes the annotation and breaks the link?

Current thinking: Generate unique IDs per ScaledObject and use those instead. These unique IDs should be available to end-users (ie when doing kubectl get scaledobject) so that they can use them as well.

I think this is a more future-proof fix long term. We can work around it so that we can fit it in the current model but that feels more like a hack to me.

@JorTurFer
Copy link
Member

JorTurFer commented Jul 4, 2022

No no, I'm not saying to link them using the annotation in the HPA, I see it as a helper for human discovery, KEDA should continue using the current approach of registering it in the SO Status. I know that the HPA is something internal for KEDA, but end-users check it, so if we change the name to another one with random names, IMO we should provide a workaround to know what HPA is related with what SO without having to go SO by SO checking their status.
But I'm saying it like a candy for users, not to use it at all in KEDA's behavior

@tomkerkhove
Copy link
Member

I agree, good idea 👍

@dogzzdogzz
Copy link
Contributor

dogzzdogzz commented Jan 13, 2023

We encounter this issue recently, too. Not sure if it's already scheduled in v2.10 release, if not, can we raise the severity of this issue?

This issue makes KEDA not reliable because we expect the deployments with scaledobject resource in production environment are supposed to be able to autoscale but in fact, it might not because the length of the name exceeds. Now we have to sort out all deployments with name exceeded and spend extra effort to rename them and update the endpoint in their downstream service.

Also quite difficult to restrict the length of the name of any new workloads in company.

@zroubalik
Copy link
Member

We are limited by k8s restrictions on labels and name, though you can provide custom HPA name in the advanced config: https://keda.sh/docs/2.9/concepts/scaling-deployments/#advanced

@github-project-automation github-project-automation bot moved this from In Progress to Ready To Ship in Roadmap - KEDA Core Jan 13, 2023
@JorTurFer JorTurFer moved this from Ready To Ship to Done in Roadmap - KEDA Core Mar 13, 2023
@michaelbannister
Copy link

michaelbannister commented Sep 18, 2023

Hi, similar-but-different to the issues mentioned previously, I've found that an HPA can't be created if the ScaledObject's name exceeds 63 characters, because of this code which wants to set the HPA's label app.kubernetes.io/part-of with the ScaledObject's name.

(This is with version 2.11.2)

Would it be more helpful for me to raise a new issue about this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Looking for support from community stale-bot-ignore All issues that should not be automatically closed by our stale bot
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

6 participants