Update gofmt.

This commit is contained in:
Cici Huang 2025-03-19 23:21:30 +00:00
parent ea2f888109
commit f04cfdf6e7
4 changed files with 69 additions and 4 deletions

View File

@ -107,7 +107,7 @@ type DynamicResources struct {
enablePrioritizedList bool
enableSchedulingQueueHint bool
enablePartitionableDevices bool
enableDeviceTaints bool
enableDeviceTaints bool
fh framework.Handle
clientset kubernetes.Interface
@ -460,7 +460,7 @@ func (pl *DynamicResources) PreFilter(ctx context.Context, state *framework.Cycl
AdminAccess: pl.enableAdminAccess,
PrioritizedList: pl.enablePrioritizedList,
PartitionableDevices: pl.enablePartitionableDevices,
DeviceTaints: pl.enableDeviceTaints,
DeviceTaints: pl.enableDeviceTaints,
}
allocator, err := structured.NewAllocator(ctx, features, allocateClaims, allAllocatedDevices, pl.draManager.DeviceClasses(), slices, pl.celCache)
if err != nil {

View File

@ -62,7 +62,7 @@ type BasicDevice struct {
NodeName *string
NodeSelector *v1.NodeSelector
AllNodes *bool
Taints []resourceapi.DeviceTaint
Taints []resourceapi.DeviceTaint
}
type DeviceCounterConsumption struct {

View File

@ -731,6 +731,71 @@ func TestControllerSyncPool(t *testing.T) {
Pool(resourceapi.ResourcePool{Name: poolName, Generation: 1, ResourceSliceCount: 1}).Obj(),
},
},
"add-shared-counters": {
nodeUID: nodeUID,
initialObjects: []runtime.Object{
MakeResourceSlice().Name(generatedName1).GenerateName(generateName).
NodeOwnerReferences(ownerName, string(nodeUID)).NodeName(ownerName).
Driver(driverName).Devices([]resourceapi.Device{{
Name: deviceName,
Basic: &resourceapi.BasicDevice{
Taints: []resourceapi.DeviceTaint{{
Effect: resourceapi.DeviceTaintEffectNoExecute,
TimeAdded: &timeAdded,
}},
}}}).
Pool(resourceapi.ResourcePool{Name: poolName, Generation: 1, ResourceSliceCount: 1}).
Obj(),
},
inputDriverResources: &DriverResources{
Pools: map[string]Pool{
poolName: {
Generation: 1,
Slices: []Slice{{Devices: []resourceapi.Device{{
Name: deviceName,
Basic: &resourceapi.BasicDevice{
Taints: []resourceapi.DeviceTaint{
{
Effect: resourceapi.DeviceTaintEffectNoExecute,
// No time added here! Time from existing slice must get copied during update.
},
{
Key: "example.com/tainted",
Effect: resourceapi.DeviceTaintEffectNoSchedule,
TimeAdded: &timeAddedLater,
},
},
}}},
}},
},
},
},
expectedStats: Stats{
NumUpdates: 1,
},
expectedResourceSlices: []resourceapi.ResourceSlice{
*MakeResourceSlice().Name(generatedName1).GenerateName(generateName).
ResourceVersion("1").
NodeOwnerReferences(ownerName, string(nodeUID)).NodeName(ownerName).
Driver(driverName).Devices([]resourceapi.Device{{
Name: deviceName,
Basic: &resourceapi.BasicDevice{
Taints: []resourceapi.DeviceTaint{
{
Effect: resourceapi.DeviceTaintEffectNoExecute,
TimeAdded: &timeAdded,
},
{
Key: "example.com/tainted",
Effect: resourceapi.DeviceTaintEffectNoSchedule,
TimeAdded: &timeAddedLater,
},
},
}}}).
Pool(resourceapi.ResourcePool{Name: poolName, Generation: 1, ResourceSliceCount: 1}).
Obj(),
},
},
}
for name, test := range testCases {

View File

@ -341,7 +341,7 @@ claims:
allocator, err := structured.NewAllocator(tCtx, structured.Features{
PrioritizedList: utilfeature.DefaultFeatureGate.Enabled(features.DRAPrioritizedList),
AdminAccess: utilfeature.DefaultFeatureGate.Enabled(features.DRAAdminAccess),
DeviceTaints: utilfeature.DefaultFeatureGate.Enabled(features.DRADeviceTaints),
DeviceTaints: utilfeature.DefaultFeatureGate.Enabled(features.DRADeviceTaints),
}, []*resourceapi.ResourceClaim{claim}, allocatedDevices, draManager.DeviceClasses(), slices, celCache)
tCtx.ExpectNoError(err, "create allocator")