mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Add comments about wildcard clusterEvent
Signed-off-by: kerthcet <kerthcet@gmail.com>
This commit is contained in:
parent
d81023db30
commit
f97dec2840
@ -83,6 +83,14 @@ const (
|
|||||||
CSINode GVK = "storage.k8s.io/CSINode"
|
CSINode GVK = "storage.k8s.io/CSINode"
|
||||||
CSIDriver GVK = "storage.k8s.io/CSIDriver"
|
CSIDriver GVK = "storage.k8s.io/CSIDriver"
|
||||||
CSIStorageCapacity GVK = "storage.k8s.io/CSIStorageCapacity"
|
CSIStorageCapacity GVK = "storage.k8s.io/CSIStorageCapacity"
|
||||||
|
|
||||||
|
// WildCard is a special GVK to match all resources.
|
||||||
|
// e.g., If you register `{Resource: "*", ActionType: All}` in EventsToRegister,
|
||||||
|
// all coming clusterEvents will be admitted. Be careful to register it, it will
|
||||||
|
// increase the computing pressure in requeueing unless you really need it.
|
||||||
|
//
|
||||||
|
// Meanwhile, if the coming clusterEvent is a wildcard one, all pods
|
||||||
|
// will be moved from unschedulablePod pool to activeQ/backoffQ forcibly.
|
||||||
WildCard GVK = "*"
|
WildCard GVK = "*"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -147,6 +155,10 @@ func (ce ClusterEvent) IsWildCard() bool {
|
|||||||
// Match returns true if ClusterEvent is matched with the coming event.
|
// Match returns true if ClusterEvent is matched with the coming event.
|
||||||
// If the ce.Resource is "*", there's no requirement for the coming event' Resource.
|
// If the ce.Resource is "*", there's no requirement for the coming event' Resource.
|
||||||
// Contrarily, if the coming event's Resource is "*", the ce.Resource should only be "*".
|
// Contrarily, if the coming event's Resource is "*", the ce.Resource should only be "*".
|
||||||
|
//
|
||||||
|
// Note: we have a special case here when the coming event is a wildcard event,
|
||||||
|
// it will force all Pods to move to activeQ/backoffQ,
|
||||||
|
// but we take it as an unmatched event unless the ce is also a wildcard one.
|
||||||
func (ce ClusterEvent) Match(event ClusterEvent) bool {
|
func (ce ClusterEvent) Match(event ClusterEvent) bool {
|
||||||
return ce.IsWildCard() || (ce.Resource == WildCard || ce.Resource == event.Resource) && ce.ActionType&event.ActionType != 0
|
return ce.IsWildCard() || (ce.Resource == WildCard || ce.Resource == event.Resource) && ce.ActionType&event.ActionType != 0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user