You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2023/02/07 07:44:09 UTC

[cloudstack-kubernetes-provider] branch main updated: Allow case insensitive vm names while creating lb rules (#41)

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 <dj...@gmail.com>
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")
 			}