NodeLabeling feature uses Machine name instead of node name
#1,679 opened on Nov 2, 2022
Repository metrics
- Stars
- (417 stars)
- PR merge metrics
- (PR metrics pending)
Description
/kind bug
What steps did you take and what happened: With the NodeLabeling feature turned on, capv controller is unable to label the managed cluster's nodes and emits errors similar to the following:
E1102 23:05:13.351244 1 node_controller.go:157] "capv-controller-manager/node-label-controller/cluster-name/cluster-name-6jtlt: unable to get node object" err="nodes \"cluster-name-6jtlt\" not found" cluster="cluster-name" machine="cluster-name-6jtlt" node="cluster-name-6jtlt"
E1102 23:05:13.351427 1 controller.go:326] "Reconciler error" err="nodes \"cluster-name-6jtlt\" not found" controller="machine" controllerGroup="cluster.x-k8s.io" controllerKind="Machine" machine="cluster-name/cluster-name-6jtlt" namespace="cluster-name" name="cluster-name-6jtlt" reconcileID=a6d8a900-f72e-4a44-b388-216d8a191b6b
What did you expect to happen: Labeling of managed cluster's node should work correctly even if machine's name and node name differ
Anything else you would like to add: Looking at the machines, it seems that the issue is that we attach a suffix to the hostname when the nodes register with DNS, therefore node name and machine name are not equal and the controller is grabbing the machine name instead of the node name when trying to find and label nodes.
NAME CLUSTER NODENAME PROVIDERID PHASE AGE VERSION
cluster-name-6jtlt cluster-name cluster-name-6jtlt.testnetwork vsphere://4216a7bd-43d1-926d-8565-cfef63a62a16 Running 89m v1.23.5
cluster-name-md-0-b994bb558-f6k9k cluster-name cluster-name-md-0-b994bb558-f6k9k.testnetwork vsphere://42164462-a671-ba3c-132c-84cd14a7acaf Running 95m v1.23.5
On the managed cluster:
NAME STATUS ROLES AGE VERSION
cluster-name-6jtlt.testnetwork Ready control-plane,master 90m v1.23.5
cluster-name-md-0-b994bb558-f6k9k.testnetwork Ready <none> 92m v1.23.5
Environment:
- Cluster-api-provider-vsphere version: 1.4.1
- Kubernetes version: (use
kubectl version): 1.23.5 - OS (e.g. from
/etc/os-release): ubuntu 20.04