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

MTV-1744 | Allow dots in the VM names #1281

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

mnecas
Copy link
Member

@mnecas mnecas commented Dec 19, 2024

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

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 <[email protected]>
@mnecas mnecas requested a review from yaacov as a code owner December 19, 2024 13:37
@@ -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("[_]")
Copy link
Member

@yaacov yaacov Dec 19, 2024

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh yeah good point!

Copy link
Member Author

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

Copy link
Member

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 ?

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 this pull request may close these issues.

2 participants