-
Notifications
You must be signed in to change notification settings - Fork 37
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
MTV-1744 | Allow dots in the VM names #1281
base: main
Are you sure you want to change the base?
Conversation
Issue: Right now we are not allowing to keep the VM names which have the dots in the name but we replace the dots with dashes. Fix: Use the IsDNS1123Subdomain validation instead of IsDNS1123Label and ignore the dots in the replacemnet of the new name. Signed-off-by: Martin Necas <mnecas@redhat.com>
Quality Gate passedIssues Measures |
@@ -33,7 +33,7 @@ func (r *KubeVirt) changeVmNameDNS1123(vmName string, vmNamespace string) (gener | |||
|
|||
// changes VM name to match DNS1123 RFC convention. | |||
func changeVmName(currName string) string { | |||
var underscoreExcluded = regexp.MustCompile("[_.]") | |||
var underscoreExcluded = regexp.MustCompile("[_]") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also need to replace or remove "." if it is in the start or end of the name
https://github.com/kubernetes/apimachinery/blob/master/pkg/util/validation/validation.go#L206
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh yeah good point!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm that's get tricky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the "." if they are in the start of end ?
@mnecas is this something we can close before 2.8.0? |
Does kube permit dots in object names? |
It's |
Thanks, so what we are saying: Oject names must not contain dots. Right? |
labels must not contain dots, names can contain dots but not at the begining or end, for example: yzamir@fedora:~$ kubectl create configmap my-config --from-literal=env=production --from-literal=version=1.0
configmap/my-config created
yzamir@fedora:~$ kubectl create configmap my.config --from-literal=env=production --from-literal=version=1.0
configmap/my.config created
yzamir@fedora:~$ kubectl create configmap .my.config --from-literal=env=production --from-literal=version=1.0
error: failed to create configmap: ConfigMap ".my.config" is invalid: metadata.name: Invalid value: ".my.config": 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])?)*')
|
|
Issue:
Right now we are not allowing to keep the VM names which have the dots in the name but we replace the dots with dashes.
Fix:
Use the IsDNS1123Subdomain validation instead of IsDNS1123Label and ignore the dots in the replacemnet of the new name.
Ref:
https://issues.redhat.com/browse/MTV-1744