Skip to content

Commit 0835702

Browse files
authored
Allow case insensitive vm names while creating lb rules (#41)
1 parent e7deb8e commit 0835702

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cloudstack_loadbalancer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"github.com/xanzy/go-cloudstack/v2/cloudstack"
2929
"k8s.io/klog"
3030

31-
"k8s.io/api/core/v1"
31+
v1 "k8s.io/api/core/v1"
3232
cloudprovider "k8s.io/cloud-provider"
3333
)
3434

@@ -332,7 +332,7 @@ func (cs *CSCloud) getLoadBalancer(service *v1.Service) (*loadBalancer, error) {
332332
func (cs *CSCloud) verifyHosts(nodes []*v1.Node) ([]string, string, error) {
333333
hostNames := map[string]bool{}
334334
for _, node := range nodes {
335-
hostNames[node.Name] = true
335+
hostNames[strings.ToLower(node.Name)] = true
336336
}
337337

338338
p := cs.client.VirtualMachine.NewListVirtualMachinesParams()
@@ -352,7 +352,7 @@ func (cs *CSCloud) verifyHosts(nodes []*v1.Node) ([]string, string, error) {
352352

353353
// Check if the virtual machine is in the hosts slice, then add the corresponding ID.
354354
for _, vm := range l.VirtualMachines {
355-
if hostNames[vm.Name] {
355+
if hostNames[strings.ToLower(vm.Name)] {
356356
if networkID != "" && networkID != vm.Nic[0].Networkid {
357357
return nil, "", fmt.Errorf("found hosts that belong to different networks")
358358
}

0 commit comments

Comments
 (0)