mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-08-08 23:37:11 +00:00
DRA device taint eviction: use NOP queue during simulation
It's slightly more efficient and a bit cleaner.
This commit is contained in:
@@ -551,8 +551,7 @@ func (tc *Controller) maybeUpdateRuleStatus(ctx context.Context, ruleRef taintev
|
||||
allocatedClaims: maps.Clone(tc.allocatedClaims),
|
||||
pools: tc.pools,
|
||||
simulateRule: ruleEvict,
|
||||
// TODO: stub implementation
|
||||
workqueue: workqueue.NewTypedRateLimitingQueueWithConfig(workqueue.DefaultTypedControllerRateLimiter[workItem](), workqueue.TypedRateLimitingQueueConfig[workItem]{}),
|
||||
workqueue: &NOPQueue[workItem]{},
|
||||
}
|
||||
defer tc.workqueue.ShutDown()
|
||||
|
||||
|
||||
79
pkg/controller/devicetainteviction/nopqueue.go
Normal file
79
pkg/controller/devicetainteviction/nopqueue.go
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package devicetainteviction
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
)
|
||||
|
||||
// NOPQueue is an implementation of [TypedRateLimitingInterface] which
|
||||
// doesn't do anything.
|
||||
type NOPQueue[T comparable] struct {
|
||||
}
|
||||
|
||||
var _ workqueue.TypedRateLimitingInterface[int] = &NOPQueue[int]{}
|
||||
|
||||
// Add implements [TypedInterface].
|
||||
func (m *NOPQueue[T]) Add(item T) {
|
||||
}
|
||||
|
||||
// Len implements [TypedInterface].
|
||||
func (m *NOPQueue[T]) Len() int {
|
||||
return 0
|
||||
}
|
||||
|
||||
// Get implements [TypedInterface].
|
||||
func (m *NOPQueue[T]) Get() (item T, shutdown bool) {
|
||||
shutdown = true
|
||||
return
|
||||
}
|
||||
|
||||
// Done implements [TypedInterface].
|
||||
func (m *NOPQueue[T]) Done(item T) {
|
||||
}
|
||||
|
||||
// ShutDown implements [TypedInterface].
|
||||
func (m *NOPQueue[T]) ShutDown() {
|
||||
}
|
||||
|
||||
// ShutDownWithDrain implements [TypedInterface].
|
||||
func (m *NOPQueue[T]) ShutDownWithDrain() {
|
||||
}
|
||||
|
||||
// ShuttingDown implements [TypedInterface].
|
||||
func (m *NOPQueue[T]) ShuttingDown() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// AddAfter implements [TypedDelayingInterface.AddAfter]
|
||||
func (m *NOPQueue[T]) AddAfter(item T, duration time.Duration) {
|
||||
}
|
||||
|
||||
// AddRateLimited implements [TypedRateLimitingInterface.AddRateLimited].
|
||||
func (m *NOPQueue[T]) AddRateLimited(item T) {
|
||||
}
|
||||
|
||||
// Forget implements [TypedRateLimitingInterface.Forget].
|
||||
func (m *NOPQueue[T]) Forget(item T) {
|
||||
}
|
||||
|
||||
// NumRequeues implements [TypedRateLimitingInterface.NumRequeues].
|
||||
func (m *NOPQueue[T]) NumRequeues(item T) int {
|
||||
return 0
|
||||
}
|
||||
Reference in New Issue
Block a user