k8ssandra-operator icon indicating copy to clipboard operation
k8ssandra-operator copied to clipboard

Migration from clusters with names that don't match k8s name syntax is failing

Open vstariradev opened this issue 2 years ago • 1 comments

I'm trying to perform migration from an existing k8s cassandra cluster running in a statefulset. The cluster name is RGS.

Following the guide here I have to create a new K8ssandraCluster with name RGS. However, k8s won't allow that:

The K8ssandraCluster "RGS" is invalid: metadata.name: Invalid value: "RGS": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

https://github.com/k8ssandra/k8ssandra-operator/blob/5045d5abf0904c6988bbb005fd62806950369c8f/docs/content/en/tasks/migrate/_index.md?plain=1#L148C87-L148C87

Renaming a cassandra cluster is not a supported operation as per: https://dba.stackexchange.com/a/316208. It would be nice to warn about this limitation or just add it to the pre-requisites section (https://docs.k8ssandra.io/tasks/migrate/#pre-requisites) before people start attempting and going all the way to reach this step and fail.

Thanks

vstariradev avatar Sep 26 '23 10:09 vstariradev

That documentation is wrong. You can use Spec.Cassandra.ClusterName to define the real clustername and keep metadata.name as something that's valid for Kubernetes (such as rgs).

burmanm avatar Sep 26 '23 10:09 burmanm