diff --git a/pkg/cloud-controller-manager/instance.go b/pkg/cloud-controller-manager/instance.go index c4d5f917..1cd33fdf 100644 --- a/pkg/cloud-controller-manager/instance.go +++ b/pkg/cloud-controller-manager/instance.go @@ -50,7 +50,7 @@ func (i *instanceManager) InstanceMetadata(ctx context.Context, node *v1.Node) ( ProviderID: ProviderName + "://" + string(vm.UID), } - vmi, err := i.vmiClient.Get(i.namespace, node.Name, metav1.GetOptions{}) + vmi, err := i.vmiClient.Get(i.namespace, vm.Name, metav1.GetOptions{}) if err != nil { if errors.IsNotFound(err) { return meta, nil diff --git a/pkg/controller/virtualmachineinstance/controller.go b/pkg/controller/virtualmachineinstance/controller.go index 6e63bdb4..9bad99b9 100644 --- a/pkg/controller/virtualmachineinstance/controller.go +++ b/pkg/controller/virtualmachineinstance/controller.go @@ -40,6 +40,7 @@ func Register( restClient: restClient, kubevirtClient: kubevirtClient, nodeToVMName: nodeToVMName, + namespace: namespace, } vmis.OnChange(ctx, vmiControllerName, handler.OnVmiChanged) }