Addressed comments

This commit is contained in:
Morten Torkildsen
2025-05-11 23:26:32 +00:00
parent e262cccf23
commit a6586aa610
2 changed files with 14 additions and 24 deletions

View File

@@ -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

View File

@@ -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{{