Skip to content
New issue

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

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

Already on GitHub? # to your account

plural for resource always adds "s" #199

Open
martin-ilavsky opened this issue Feb 11, 2025 · 2 comments
Open

plural for resource always adds "s" #199

martin-ilavsky opened this issue Feb 11, 2025 · 2 comments

Comments

@martin-ilavsky
Copy link

Describe the bug

kindPlural := fmt.Sprintf("%ss", strings.ToLower(kind))
This always adds 's' to kind. But in case of CRD resource like logstash, the plural is logstashes and not logstashs. This is causing it to fail

To Reproduce
Steps to reproduce the behavior:

  1. Deploy logstash CRD
  2. Use scaleTargetRef as '{"kind": "Logstash", "name": "logstash", "apiVersion": "logstash.k8s.elastic.co/v1alpha1"}'
  3. See error

Expected behavior
find correct resource

Kubernetes Details (kubectl version):
1.32

@jthomperoo
Copy link
Owner

Thanks for raising this - I always knew this was a bit of a hack when it was first implemented but it seemed to work for the use cases I could think of; I'll investigate the correct way of getting the plural kind.

@martin-ilavsky
Copy link
Author

martin-ilavsky commented Feb 11, 2025

Maybe just simple retry with +"es" when it fails on getting the resource. I am currently working on task where I require this, so probably I will just try to fix it with some hack, but would rather use your image, since I would need to build it completely. I wanted to rewrite that specific file in docker container but then found out its a binary :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants