Description of problem: Create VM with hostname 'test.example.com' is failed on UI. Error "spec.template.spec.hostname does not conform to the kubernetes DNS_LABEL rules : a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')" for field "spec.template.spec.hostname". The whole yaml is: { "apiVersion": "kubevirt.io/v1alpha3", "kind": "VirtualMachine", "metadata": { "name": "test1", "labels": { "flavor.template.kubevirt.io/small": "true", "os.template.kubevirt.io/fedora29": "true", "workload.template.kubevirt.io/generic": "true", "vm.kubevirt.io/template": "fedora-generic", "vm.kubevirt.io/template-namespace": "openshift" }, "annotations": { "name.os.template.kubevirt.io/fedora29": "Fedora 29" }, "namespace": "default" }, "spec": { "running": true, "template": { "spec": { "domain": { "cpu": { "cores": 2 }, "devices": { "disks": [ { "bootOrder": 1, "disk": { "bus": "virtio" }, "name": "rootdisk" }, { "bootOrder": 3, "disk": { "bus": "virtio" }, "name": "cloudinitdisk" } ], "interfaces": [ { "bootOrder": 2, "masquerade": {}, "name": "nic0" } ], "rng": {} }, "resources": { "requests": { "memory": "2G" } } }, "hostname": "test.example.com", "networks": [ { "name": "nic0", "pod": {} } ], "terminationGracePeriodSeconds": 0, "volumes": [ { "containerDisk": { "image": "kubevirt/cirros-container-disk-demo" }, "name": "rootdisk" }, { "cloudInitNoCloud": { "userData": "#cloud-config\nusers:\n - name: default\n ssh-authorized-keys: >-\n ssh-rsa\n AAAAB3NzaC1yc2EAAAADAQABAAABAQCj47ubVnxR16JU7ZfDli3N5QVBAwJBRh2xMryyjk5dtfugo5JIPGB2cyXTqEDdzuRmI+Vkb/A5duJyBRlA+9RndGGmhhMnj8and3wu5/cEb7DkF6ZJ25QV4LQx3K/i57LStUHXRTvruHOZ2nCuVXWqi7wSvz5YcvEv7O8pNF5uGmqHlShBdxQxcjurXACZ1YY0YDJDr3AJai1KF9zehVJODuSbrnOYpThVWGjFuFAnNxbtuZ8EOSougN2aYTf2qr/KFGDHtewIkzZmP6cjzKO5bN3pVbXxmb2Gces/BYHntY4MXBTUqwsmsCRC5SAz14bEP/vsLtrNhjq9vCS+BjMT\nhostname: test.example.com\n" }, "name": "cloudinitdisk" } ] }, "metadata": { "labels": { "vm.kubevirt.io/name": "test1" } } } } } Version-Release number of selected component (if applicable): hco:v2.0.0-15 kubevirt-web-ui: brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888/container-native-virtualization/kubevirt-web-ui@sha256:d0b9fb56f92c2d339fa2a5850f89006e475f5ba7641b6f619e5f2715ba0c1314 How reproducible: 100% Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
move to virt component.
This error comes from kubevirt' validation: https://github.com/kubevirt/kubevirt/blob/master/pkg/virt-api/webhooks/validating-webhook/admitters/vmi-create-admitter.go#L113 I'm not even sure it is an actual bug
It's not a bug. It is explained what value is permitted, the select value does not meet these requirements.
@Fabian, do you think 'test.example.com' is a valid hostname regardless kubevirt validation? If it is, why we cannot use it?
In the context of kubernetes test.example.com is not a valid hostname. It needs to be understood that in the kubernetes context, the hostname is used to create an FQDN. That's why the hostname needs to match the DNS_LABEL rule mentioned in the description. The benefit is, that the VM will tie into Kubernete's DNS system, which means that the VM can be resolved with a complete FQDN once the name is set.
thanks for the explannation, I'm okay to close this bug now.