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

Names longer than 63 chars crash operator completely #169

Closed
lallinger-tech opened this issue May 14, 2024 · 6 comments · Fixed by #170
Closed

Names longer than 63 chars crash operator completely #169

lallinger-tech opened this issue May 14, 2024 · 6 comments · Fixed by #170

Comments

@lallinger-tech
Copy link

Creating a terraform CR with a name longer than 63 chars results in the operator crashing hard (not even crash loop backoff but recreation and immediate crash of the pod). The issue arises as the operator uses labels to track some information, but labels are limited to 63 chars vs metadata.name length may be 253 chars: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/

The easiest way to get around this problem is to switch from labels to annotations as there the value can be almost arbitrarily long and only the key needs to follow these constraints: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set

@isaaguilar
Copy link
Collaborator

I do like label-selectors over annotations (via field-selectors). Since I use labels to track resources, I wouldn't want to change code. It should be safe enough to truncate label values at 63 chars, right?

@lallinger-tech
Copy link
Author

truncating could lead to 2 resources having the same label, imagine the two resources only start differing from each other after char 63. Hashing would be an option, but this would make it non human readable..

@isaaguilar
Copy link
Collaborator

I'll get to making it an annotation soon. Thanks for the input! :)

@lallinger-tech
Copy link
Author

thank you very much!! :)

@isaaguilar
Copy link
Collaborator

I'll get to making it an annotation soon. Thanks for the input! :)

I know I said I'd do annotations, but for simplicity and a small technical detail, I went with a hash instead of the long label value. #170

@lallinger-tech
Copy link
Author

works for me, thanks for the fast implementation!

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

Successfully merging a pull request may close this issue.

2 participants