mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 10:53:34 +00:00
rebase: bump sigs.k8s.io/controller-runtime
Bumps the k8s-dependencies group with 1 update: [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime). Updates `sigs.k8s.io/controller-runtime` from 0.20.4 to 0.21.0 - [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases) - [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md) - [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.20.4...v0.21.0) --- updated-dependencies: - dependency-name: sigs.k8s.io/controller-runtime dependency-version: 0.21.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: k8s-dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
mergify[bot]
parent
d05ebd3456
commit
eb13efc9df
5
vendor/sigs.k8s.io/controller-runtime/pkg/handler/enqueue_mapped.go
generated
vendored
5
vendor/sigs.k8s.io/controller-runtime/pkg/handler/enqueue_mapped.go
generated
vendored
@ -86,9 +86,8 @@ func (e *enqueueRequestsFromMapFunc[object, request]) Create(
|
||||
reqs := map[request]empty{}
|
||||
|
||||
var lowPriority bool
|
||||
if e.objectImplementsClientObject && isPriorityQueue(q) && !isNil(evt.Object) {
|
||||
clientObjectEvent := event.CreateEvent{Object: any(evt.Object).(client.Object)}
|
||||
if isObjectUnchanged(clientObjectEvent) {
|
||||
if isPriorityQueue(q) && !isNil(evt.Object) {
|
||||
if evt.IsInInitialList {
|
||||
lowPriority = true
|
||||
}
|
||||
}
|
||||
|
18
vendor/sigs.k8s.io/controller-runtime/pkg/handler/eventhandler.go
generated
vendored
18
vendor/sigs.k8s.io/controller-runtime/pkg/handler/eventhandler.go
generated
vendored
@ -19,7 +19,6 @@ package handler
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
@ -132,14 +131,8 @@ func (h TypedFuncs[object, request]) Create(ctx context.Context, e event.TypedCr
|
||||
// We already know that we have a priority queue, that event.Object implements
|
||||
// client.Object and that its not nil
|
||||
addFunc: func(item request, q workqueue.TypedRateLimitingInterface[request]) {
|
||||
// We construct a new event typed to client.Object because isObjectUnchanged
|
||||
// is a generic and hence has to know at compile time the type of the event
|
||||
// it gets. We only figure that out at runtime though, but we know for sure
|
||||
// that it implements client.Object at this point so we can hardcode the event
|
||||
// type to that.
|
||||
evt := event.CreateEvent{Object: any(e.Object).(client.Object)}
|
||||
var priority int
|
||||
if isObjectUnchanged(evt) {
|
||||
if e.IsInInitialList {
|
||||
priority = LowPriority
|
||||
}
|
||||
q.(priorityqueue.PriorityQueue[request]).AddWithOpts(
|
||||
@ -217,13 +210,6 @@ func (w workqueueWithCustomAddFunc[request]) Add(item request) {
|
||||
w.addFunc(item, w.TypedRateLimitingInterface)
|
||||
}
|
||||
|
||||
// isObjectUnchanged checks if the object in a create event is unchanged, for example because
|
||||
// we got it in our initial listwatch. The heuristic it uses is to check if the object is older
|
||||
// than one minute.
|
||||
func isObjectUnchanged[object client.Object](e event.TypedCreateEvent[object]) bool {
|
||||
return e.Object.GetCreationTimestamp().Time.Before(time.Now().Add(-time.Minute))
|
||||
}
|
||||
|
||||
// addToQueueCreate adds the reconcile.Request to the priorityqueue in the handler
|
||||
// for Create requests if and only if the workqueue being used is of type priorityqueue.PriorityQueue[reconcile.Request]
|
||||
func addToQueueCreate[T client.Object, request comparable](q workqueue.TypedRateLimitingInterface[request], evt event.TypedCreateEvent[T], item request) {
|
||||
@ -234,7 +220,7 @@ func addToQueueCreate[T client.Object, request comparable](q workqueue.TypedRate
|
||||
}
|
||||
|
||||
var priority int
|
||||
if isObjectUnchanged(evt) {
|
||||
if evt.IsInInitialList {
|
||||
priority = LowPriority
|
||||
}
|
||||
priorityQueue.AddWithOpts(priorityqueue.AddOpts{Priority: priority}, item)
|
||||
|
Reference in New Issue
Block a user