@@ -98,13 +98,14 @@ func (a *Allocator) ClaimsToAllocate() []*resourceapi.ResourceClaim {
98
98
// progress reports, and V(6) for detailed debug output.
99
99
func (sharedAllocator * Allocator ) Allocate (ctx context.Context , node * v1.Node ) ([]* resourceapi.AllocationResult , error ) {
100
100
alloc := & allocator {
101
- Allocator : sharedAllocator ,
102
- ctx : ctx , // all methods share the same a and thus ctx
103
- logger : klog .FromContext (ctx ),
104
- constraints : make ([][]constraint , 0 , len (sharedAllocator .claimsToAllocate )),
105
- requestData : make (map [requestIndices ]requestData ),
106
- allocated : make (map [DeviceID ]bool ),
107
- result : make ([]* resourceapi.AllocationResult , len (sharedAllocator .claimsToAllocate )),
101
+ Allocator : sharedAllocator ,
102
+ ctx : ctx , // all methods share the same a and thus ctx
103
+ logger : klog .FromContext (ctx ),
104
+ deviceMatchesRequest : make (map [matchKey ]bool ),
105
+ constraints : make ([][]constraint , 0 , len (sharedAllocator .claimsToAllocate )),
106
+ requestData : make (map [requestIndices ]requestData ),
107
+ allocated : make (map [DeviceID ]bool ),
108
+ result : make ([]* resourceapi.AllocationResult , len (sharedAllocator .claimsToAllocate )),
108
109
}
109
110
110
111
// First determine all eligible pools.
@@ -227,7 +228,7 @@ func (sharedAllocator *Allocator) Allocate(ctx context.Context, node *v1.Node) (
227
228
// Constraints are assumed to be monotonic: once a constraint returns
228
229
// false, adding more devices will not cause it to return true. This
229
230
// allows the search to stop early once a constraint returns false.
230
- var constraints = make ([]constraint , len (claim .Spec .Devices .Constraints ))
231
+ var constraints = make ([]constraint , 0 , len (claim .Spec .Devices .Constraints ))
231
232
for i , constraint := range claim .Spec .Devices .Constraints {
232
233
switch {
233
234
case constraint .MatchAttribute != nil :
0 commit comments