From c0733b4e8d99e976472bbca9700083f966956228 Mon Sep 17 00:00:00 2001 From: Gaurav Mehta Date: Thu, 5 Sep 2024 13:52:53 +1000 Subject: [PATCH] convert sriov device name objects to lowercase (#88) --- pkg/util/nichelper/helper.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/util/nichelper/helper.go b/pkg/util/nichelper/helper.go index f632e1e1..6618ce76 100644 --- a/pkg/util/nichelper/helper.go +++ b/pkg/util/nichelper/helper.go @@ -5,8 +5,8 @@ import ( "os" "path/filepath" "strconv" + "strings" - ctlnetworkv1beta1 "github.com/harvester/harvester-network-controller/pkg/generated/controllers/network.harvesterhci.io/v1beta1" "github.com/jaypipes/ghw" "github.com/jaypipes/ghw/pkg/net" ctlcorev1 "github.com/rancher/wrangler/pkg/generated/controllers/core/v1" @@ -18,6 +18,8 @@ import ( "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/json" + ctlnetworkv1beta1 "github.com/harvester/harvester-network-controller/pkg/generated/controllers/network.harvesterhci.io/v1beta1" + "github.com/harvester/pcidevices/pkg/util/common" "github.com/harvester/pcidevices/pkg/apis/devices.harvesterhci.io/v1beta1" @@ -271,7 +273,7 @@ func generateSRIOVDeviceObjects(nodeName string, nics *net.Info, skipNics []stri func generateSRIOVDev(nodeName string, nic *net.NIC) *v1beta1.SRIOVNetworkDevice { return &v1beta1.SRIOVNetworkDevice{ ObjectMeta: metav1.ObjectMeta{ - Name: fmt.Sprintf("%s-%s", nodeName, nic.Name), + Name: strings.ToLower(fmt.Sprintf("%s-%s", nodeName, nic.Name)), Labels: map[string]string{ v1beta1.NodeKeyName: nodeName, },