mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Merge pull request #100090 from whypro/enqueue-extension
Implement EnqueueExtensions interface in volumerestrictions and volumezone.
This commit is contained in:
commit
e42f44588a
@ -29,6 +29,7 @@ import (
|
||||
type VolumeRestrictions struct{}
|
||||
|
||||
var _ framework.FilterPlugin = &VolumeRestrictions{}
|
||||
var _ framework.EnqueueExtensions = &VolumeRestrictions{}
|
||||
|
||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||
const Name = "VolumeRestrictions"
|
||||
@ -130,6 +131,19 @@ func (pl *VolumeRestrictions) Filter(ctx context.Context, _ *framework.CycleStat
|
||||
return nil
|
||||
}
|
||||
|
||||
// EventsToRegister returns the possible events that may make a Pod
|
||||
// failed by this plugin schedulable.
|
||||
func (pl *VolumeRestrictions) EventsToRegister() []framework.ClusterEvent {
|
||||
return []framework.ClusterEvent{
|
||||
// Pods may fail to schedule because of volumes conflicting with other pods on same node.
|
||||
// Once running pods are deleted and volumes have been released, the unschedulable pod will be schedulable.
|
||||
// Due to immutable fields `spec.volumes`, pod update events are ignored.
|
||||
{Resource: framework.Pod, ActionType: framework.Delete},
|
||||
// A new Node may make a pod schedulable.
|
||||
{Resource: framework.Node, ActionType: framework.Add},
|
||||
}
|
||||
}
|
||||
|
||||
// New initializes a new plugin and returns it.
|
||||
func New(_ runtime.Object, _ framework.Handle) (framework.Plugin, error) {
|
||||
return &VolumeRestrictions{}, nil
|
||||
|
@ -40,6 +40,7 @@ type VolumeZone struct {
|
||||
}
|
||||
|
||||
var _ framework.FilterPlugin = &VolumeZone{}
|
||||
var _ framework.EnqueueExtensions = &VolumeZone{}
|
||||
|
||||
const (
|
||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||
@ -171,6 +172,23 @@ func (pl *VolumeZone) Filter(ctx context.Context, _ *framework.CycleState, pod *
|
||||
return nil
|
||||
}
|
||||
|
||||
// EventsToRegister returns the possible events that may make a Pod
|
||||
// failed by this plugin schedulable.
|
||||
func (pl *VolumeZone) EventsToRegister() []framework.ClusterEvent {
|
||||
return []framework.ClusterEvent{
|
||||
// New storageClass with bind mode `VolumeBindingWaitForFirstConsumer` will make a pod schedulable.
|
||||
// Due to immutable field `storageClass.volumeBindingMode`, storageClass update events are ignored.
|
||||
{Resource: framework.StorageClass, ActionType: framework.Add},
|
||||
// A new node or updating a node's volume zone labels may make a pod schedulable.
|
||||
{Resource: framework.Node, ActionType: framework.Add | framework.UpdateNodeLabel},
|
||||
// A new pvc may make a pod schedulable.
|
||||
// Due to fields are immutable except `spec.resources`, pvc update events are ignored.
|
||||
{Resource: framework.PersistentVolumeClaim, ActionType: framework.Add},
|
||||
// A new pv or updating a pv's volume zone labels may make a pod shedulable.
|
||||
{Resource: framework.PersistentVolume, ActionType: framework.Add | framework.Update},
|
||||
}
|
||||
}
|
||||
|
||||
// New initializes a new plugin and returns it.
|
||||
func New(_ runtime.Object, handle framework.Handle) (framework.Plugin, error) {
|
||||
informerFactory := handle.SharedInformerFactory()
|
||||
|
Loading…
Reference in New Issue
Block a user