Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cloudstack_loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,9 @@ func (cs *CSCloud) getLoadBalancer(service *corev1.Service) (*loadBalancer, erro
func (cs *CSCloud) verifyHosts(nodes []*corev1.Node) ([]string, string, error) {
hostNames := map[string]bool{}
for _, node := range nodes {
hostNames[strings.ToLower(node.Name)] = true
// node.Name can be an FQDN as well, and CloudStack VM names aren't
// To match, we need to Split the domain part off here, if present
hostNames[strings.Split(strings.ToLower(node.Name), ".")[0]] = true
}

p := cs.client.VirtualMachine.NewListVirtualMachinesParams()
Expand Down Expand Up @@ -362,6 +364,10 @@ func (cs *CSCloud) verifyHosts(nodes []*corev1.Node) ([]string, string, error) {
}
}

if len(hostIDs) == 0 || len(networkID) == 0 {
return nil, "", fmt.Errorf("none of the hosts matched the list of VMs retrieved from CS API")
}

return hostIDs, networkID, nil
}

Expand Down