type VolumeZone … var _ … var _ … var _ … const Name … const preFilterStateKey … const ErrReasonConflict … type pvTopology … type stateData … func (d *stateData) Clone() framework.StateData { … } var topologyLabels … func translateToGALabel(label string) string { … } // Name returns name of the plugin. It is used in logs, etc. func (pl *VolumeZone) Name() string { … } // PreFilter invoked at the prefilter extension point // // # It finds the topology of the PersistentVolumes corresponding to the volumes a pod requests // // Currently, this is only supported with PersistentVolumeClaims, // and only looks for the bound PersistentVolume. func (pl *VolumeZone) PreFilter(ctx context.Context, cs *framework.CycleState, pod *v1.Pod) (*framework.PreFilterResult, *framework.Status) { … } // getPVbyPod gets PVTopology from pod func (pl *VolumeZone) getPVbyPod(logger klog.Logger, pod *v1.Pod) ([]pvTopology, *framework.Status) { … } // PreFilterExtensions returns prefilter extensions, pod add and remove. func (pl *VolumeZone) PreFilterExtensions() framework.PreFilterExtensions { … } // Filter invoked at the filter extension point. // // It evaluates if a pod can fit due to the volumes it requests, given // that some volumes may have zone scheduling constraints. The requirement is that any // volume zone-labels must match the equivalent zone-labels on the node. It is OK for // the node to have more zone-label constraints (for example, a hypothetical replicated // volume might allow region-wide access) // // Currently this is only supported with PersistentVolumeClaims, and looks to the labels // only on the bound PersistentVolume. // // Working with volumes declared inline in the pod specification (i.e. not // using a PersistentVolume) is likely to be harder, as it would require // determining the zone of a volume during scheduling, and that is likely to // require calling out to the cloud provider. It seems that we are moving away // from inline volume declarations anyway. func (pl *VolumeZone) Filter(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status { … } func getStateData(cs *framework.CycleState) (*stateData, error) { … } func getErrorAsStatus(err error) *framework.Status { … } // EventsToRegister returns the possible events that may make a Pod // failed by this plugin schedulable. func (pl *VolumeZone) EventsToRegister(_ context.Context) ([]framework.ClusterEventWithHint, error) { … } // getPersistentVolumeClaimNameFromPod gets pvc names bound to a pod. func (pl *VolumeZone) getPersistentVolumeClaimNameFromPod(pod *v1.Pod) []string { … } // isSchedulableAfterPersistentVolumeClaimChange is invoked whenever a PersistentVolumeClaim added or updated. // It checks whether the change of PVC has made a previously unschedulable pod schedulable. func (pl *VolumeZone) isSchedulableAfterPersistentVolumeClaimChange(logger klog.Logger, pod *v1.Pod, oldObj, newObj interface{ … } // isPVCRequestedFromPod verifies if the PVC is requested from a given Pod. func (pl *VolumeZone) isPVCRequestedFromPod(logger klog.Logger, pvc *v1.PersistentVolumeClaim, pod *v1.Pod) bool { … } // isSchedulableAfterStorageClassAdded is invoked whenever a StorageClass is added. // It checks whether the addition of StorageClass has made a previously unschedulable pod schedulable. // Only a new StorageClass with WaitForFirstConsumer will cause a pod to become schedulable. func (pl *VolumeZone) isSchedulableAfterStorageClassAdded(logger klog.Logger, pod *v1.Pod, oldObj, newObj interface{ … } // isSchedulableAfterPersistentVolumeChange is invoked whenever a PersistentVolume added or updated. // It checks whether the change of PV has made a previously unschedulable pod schedulable. // Changing the PV topology labels could cause the pod to become schedulable. func (pl *VolumeZone) isSchedulableAfterPersistentVolumeChange(logger klog.Logger, pod *v1.Pod, oldObj, newObj interface{ … } // getPVTopologies retrieves pvTopology from a given PV and returns the array // This function doesn't check spec.nodeAffinity // because it's read-only after creation and thus cannot be updated // and nodeAffinity is being handled in node affinity plugin func (pl *VolumeZone) getPVTopologies(logger klog.Logger, pv *v1.PersistentVolume) []pvTopology { … } // New initializes a new plugin and returns it. func New(_ context.Context, _ runtime.Object, handle framework.Handle, fts feature.Features) (framework.Plugin, error) { … }