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

Magnum/CAPI provisioned Kubernetes cluster name length #96

Closed
runlevel-six opened this issue Apr 4, 2023 · 4 comments · Fixed by #101 or #338
Closed

Magnum/CAPI provisioned Kubernetes cluster name length #96

runlevel-six opened this issue Apr 4, 2023 · 4 comments · Fixed by #101 or #338

Comments

@runlevel-six
Copy link

Is there a way to customize the name used by the Magnum API (using the CAPI driver) built into Atmosphere? We are running into issues where operators are adding labels to artifacts that exceed the 63 character limit built into Kubernetes, and a big chunk of the label is the cluster name in these cases. It would be nice if we can define a name (such as prod-k8s-00 or something like that) that tells the user exactly what it is used for and doesn't include the additional Magnum (and/or CAPI/CAPO) syntax.

trivy k8s cluster --compliance k8s-cis --report summary 
2023-03-25T16:59:00.124-0400	FATAL	get k8s artifacts error: running node-collector job: Job.batch "node-collector-foo-test-4admbibsdj-default-worker-infra-rb4bh-f2h5t" is invalid: spec.template.labels: Invalid value: "node-collector-foo-test-4admbibsdj-default-worker-infra-rb4bh-f2h5t": must be no more than 63 characters
@mnaser mnaser transferred this issue from vexxhost/atmosphere Apr 11, 2023
@mnaser
Copy link
Member

mnaser commented Apr 11, 2023

@runlevel-six: I think this is an interesting problem, right now, we are generating cluster names in the following way:

https://github.com/vexxhost/magnum-cluster-api/blob/main/magnum_cluster_api/utils.py#L45-L58

We're using cluster name + 10 characters. Since we're creating all of them inside the magnum-system namespace, we can't really have clusters with the name only, unless we start creating clusters in different namespaces but that starts to get a little bit more complicated and becomes a much bigger change.

I think what we can do is probably drop that down to 5 characters, that might help a little bit?

@runlevel-six
Copy link
Author

@mnaser I think that will definitely help, and we can work to shorten our cluster names as well. Any chance we can also shorten the node names since that is part of the overall length for some application applied labels?

I ask because in the example above, it looks like the name is foo-test-4admbibsdj-default-worker-infra-rb4bh-f2h5t which looks to be a mix of cluster name + 10 characters + worker name + 2 five character strings. In that example the cluster name was solely foo-test and all the rest is appended by Magnum.

@mnaser
Copy link
Member

mnaser commented Apr 11, 2023

Unfortunately the server name component actually comes from the Cluster API so we have to look for something there

@runlevel-six
Copy link
Author

Ok, thanks

@mnaser mnaser closed this as completed in 0024683 Apr 16, 2023
This was referenced Jul 31, 2023
This was referenced Dec 15, 2023
This was referenced Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants