This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/cloudstack-kubernetes-provider.git


The following commit(s) were added to refs/heads/main by this push:
     new 08357029 Allow case insensitive vm names while creating lb rules (#41)
08357029 is described below

commit 08357029a24f299ad47202c3918e7cc2d9f680e0
Author: David Jumani <[email protected]>
AuthorDate: Tue Feb 7 13:14:04 2023 +0530

    Allow case insensitive vm names while creating lb rules (#41)
---
 cloudstack_loadbalancer.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cloudstack_loadbalancer.go b/cloudstack_loadbalancer.go
index 1af6cae4..2149164b 100644
--- a/cloudstack_loadbalancer.go
+++ b/cloudstack_loadbalancer.go
@@ -28,7 +28,7 @@ import (
        "github.com/xanzy/go-cloudstack/v2/cloudstack"
        "k8s.io/klog"
 
-       "k8s.io/api/core/v1"
+       v1 "k8s.io/api/core/v1"
        cloudprovider "k8s.io/cloud-provider"
 )
 
@@ -332,7 +332,7 @@ func (cs *CSCloud) getLoadBalancer(service *v1.Service) 
(*loadBalancer, error) {
 func (cs *CSCloud) verifyHosts(nodes []*v1.Node) ([]string, string, error) {
        hostNames := map[string]bool{}
        for _, node := range nodes {
-               hostNames[node.Name] = true
+               hostNames[strings.ToLower(node.Name)] = true
        }
 
        p := cs.client.VirtualMachine.NewListVirtualMachinesParams()
@@ -352,7 +352,7 @@ func (cs *CSCloud) verifyHosts(nodes []*v1.Node) ([]string, 
string, error) {
 
        // Check if the virtual machine is in the hosts slice, then add the 
corresponding ID.
        for _, vm := range l.VirtualMachines {
-               if hostNames[vm.Name] {
+               if hostNames[strings.ToLower(vm.Name)] {
                        if networkID != "" && networkID != vm.Nic[0].Networkid {
                                return nil, "", fmt.Errorf("found hosts that 
belong to different networks")
                        }

Reply via email to