From a6586aa610acaf7aae18e48ef83b6b1ca16b90fd Mon Sep 17 00:00:00 2001 From: Morten Torkildsen Date: Sun, 11 May 2025 23:26:32 +0000 Subject: [PATCH] Addressed comments --- test/e2e/dra/deploy.go | 16 ++++++++-------- test/e2e/dra/dra.go | 22 ++++++---------------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/test/e2e/dra/deploy.go b/test/e2e/dra/deploy.go index ccac5084f19..b37e5d5c86a 100644 --- a/test/e2e/dra/deploy.go +++ b/test/e2e/dra/deploy.go @@ -173,7 +173,10 @@ func validateClaim(claim *resourceapi.ResourceClaim) { } const ( - networkPool = "network-pool" + // multi-host identifies DriverResources that are associated with multiple devices, i.e. + // is not managed by a driver. So any Pools and ResourceSlices will be published directly + // to the cluster, rather than through the driver. + multiHostDriverResources = "multi-host" ) // driverResourcesGenFunc defines the callback that will be invoked by the driver to generate the @@ -292,13 +295,13 @@ func (d *Driver) SetUp(nodes *Nodes, driverResources map[string]resourceslice.Dr d.ctx = ctx d.cleanup = append(d.cleanup, func(context.Context) { cancel() }) - driverResource, found := driverResources[networkPool] - // If found, we create a network ResourcSlice, i.e. one that is not - // associated with a specific node. + driverResource, found := driverResources[multiHostDriverResources] + // If found, we create ResourceSlices that are associated with multiple nodes + // through the node selector. Thus, the ResourceSlices are published here + // rather than through the driver on a specific node. if found { for poolName, pool := range driverResource.Pools { for i, slice := range pool.Slices { - // Publish one resource pool with "network-attached" devices. resourceSlice := &resourceapi.ResourceSlice{ ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("%s-%d", d.Name, i), // globally unique @@ -398,9 +401,6 @@ func (d *Driver) SetUp(nodes *Nodes, driverResources map[string]resourceslice.Dr // Run registrar and plugin for each of the pods. for _, pod := range pods.Items { - // Need a local variable, not the loop variable, for the anonymous - // callback functions below. - pod := pod nodename := pod.Spec.NodeName // Authenticate the plugin so that it has the exact same diff --git a/test/e2e/dra/dra.go b/test/e2e/dra/dra.go index a4585ad20af..e8acd752de3 100644 --- a/test/e2e/dra/dra.go +++ b/test/e2e/dra/dra.go @@ -1407,25 +1407,15 @@ var _ = framework.SIGDescribe("node")(framework.WithLabel("DRA"), feature.Dynami }) } - ginkgo.Context("on single node", func() { - singleNodeTests() - }) + ginkgo.Context("on single node", singleNodeTests) - ginkgo.Context("on multiple nodes", func() { - multiNodeTests() - }) + ginkgo.Context("on multiple nodes", multiNodeTests) - framework.Context(f.WithFeatureGate(features.DRAPrioritizedList), func() { - prioritizedListTests() - }) + framework.Context(f.WithFeatureGate(features.DRAPrioritizedList), prioritizedListTests) - ginkgo.Context("with v1beta2 API", func() { - v1beta2Tests() - }) + ginkgo.Context("with v1beta2 API", v1beta2Tests) - ginkgo.Context("with partitionable devices", func() { - partitionableDevicesTests() - }) + ginkgo.Context("with partitionable devices", partitionableDevicesTests) framework.Context(f.WithFeatureGate(features.DRADeviceTaints), func() { nodes := NewNodes(f, 1, 1) @@ -2609,7 +2599,7 @@ func networkResources(maxAllocations int, tainted bool) driverResourcesGenFunc { } devices = append(devices, device) } - driverResources[networkPool] = resourceslice.DriverResources{ + driverResources[multiHostDriverResources] = resourceslice.DriverResources{ Pools: map[string]resourceslice.Pool{ "network": { Slices: []resourceslice.Slice{{