const stateKey … const maxUtilization … type stateData … func (d *stateData) Clone() framework.StateData { … } type VolumeBinding … var _ … var _ … var _ … var _ … var _ … var _ … var _ … const Name … // Name returns name of the plugin. It is used in logs, etc. func (pl *VolumeBinding) Name() string { … } // EventsToRegister returns the possible events that may make a Pod // failed by this plugin schedulable. func (pl *VolumeBinding) EventsToRegister(_ context.Context) ([]framework.ClusterEventWithHint, error) { … } func (pl *VolumeBinding) isSchedulableAfterCSINodeChange(logger klog.Logger, pod *v1.Pod, oldObj, newObj interface{ … } func (pl *VolumeBinding) isSchedulableAfterPersistentVolumeClaimChange(logger klog.Logger, pod *v1.Pod, oldObj, newObj interface{ … } // isSchedulableAfterStorageClassChange checks whether an StorageClass event might make a Pod schedulable or not. // Any StorageClass addition and a StorageClass update to allowedTopologies // might make a Pod schedulable. // Note that an update to volume binding mode is not allowed and we don't have to consider while examining the update event. func (pl *VolumeBinding) isSchedulableAfterStorageClassChange(logger klog.Logger, pod *v1.Pod, oldObj, newObj interface{ … } // isSchedulableAfterCSIStorageCapacityChange checks whether a CSIStorageCapacity event // might make a Pod schedulable or not. // Any CSIStorageCapacity addition and a CSIStorageCapacity update to volume limit // (calculated based on capacity and maximumVolumeSize) might make a Pod schedulable. // Note that an update to nodeTopology and storageClassName is not allowed and // we don't have to consider while examining the update event. func (pl *VolumeBinding) isSchedulableAfterCSIStorageCapacityChange(logger klog.Logger, pod *v1.Pod, oldObj, newObj interface{ … } func (pl *VolumeBinding) isSchedulableAfterCSIDriverChange(logger klog.Logger, pod *v1.Pod, oldObj, newObj interface{ … } // podHasPVCs returns 2 values: // - the first one to denote if the given "pod" has any PVC defined. // - the second one to return any error if the requested PVC is illegal. func (pl *VolumeBinding) podHasPVCs(pod *v1.Pod) (bool, error) { … } // PreFilter invoked at the prefilter extension point to check if pod has all // immediate PVCs bound. If not all immediate PVCs are bound, an // UnschedulableAndUnresolvable is returned. func (pl *VolumeBinding) PreFilter(ctx context.Context, state *framework.CycleState, pod *v1.Pod) (*framework.PreFilterResult, *framework.Status) { … } // PreFilterExtensions returns prefilter extensions, pod add and remove. func (pl *VolumeBinding) PreFilterExtensions() framework.PreFilterExtensions { … } func getStateData(cs *framework.CycleState) (*stateData, error) { … } // Filter invoked at the filter extension point. // It evaluates if a pod can fit due to the volumes it requests, // for both bound and unbound PVCs. // // For PVCs that are bound, then it checks that the corresponding PV's node affinity is // satisfied by the given node. // // For PVCs that are unbound, it tries to find available PVs that can satisfy the PVC requirements // and that the PV node affinity is satisfied by the given node. // // If storage capacity tracking is enabled, then enough space has to be available // for the node and volumes that still need to be created. // // The predicate returns true if all bound PVCs have compatible PVs with the node, and if all unbound // PVCs can be matched with an available and node-compatible PV. func (pl *VolumeBinding) Filter(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status { … } // PreScore invoked at the preScore extension point. It checks whether volumeBinding can skip Score func (pl *VolumeBinding) PreScore(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodes []*framework.NodeInfo) *framework.Status { … } // Score invoked at the score extension point. func (pl *VolumeBinding) Score(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeName string) (int64, *framework.Status) { … } // ScoreExtensions of the Score plugin. func (pl *VolumeBinding) ScoreExtensions() framework.ScoreExtensions { … } // Reserve reserves volumes of pod and saves binding status in cycle state. func (pl *VolumeBinding) Reserve(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeName string) *framework.Status { … } // PreBind will make the API update with the assumed bindings and wait until // the PV controller has completely finished the binding operation. // // If binding errors, times out or gets undone, then an error will be returned to // retry scheduling. func (pl *VolumeBinding) PreBind(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeName string) *framework.Status { … } // Unreserve clears assumed PV and PVC cache. // It's idempotent, and does nothing if no cache found for the given pod. func (pl *VolumeBinding) Unreserve(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeName string) { … } // New initializes a new plugin and returns it. func New(ctx context.Context, plArgs runtime.Object, fh framework.Handle, fts feature.Features) (framework.Plugin, error) { … }