Test plugin assumes that each node can hold only one pod whose id begins with blockingPrefix. This allows us to construct pods that block future selves or not.
(ctx context.Context, state fwk.CycleState, pod *v1.Pod, nodeInfo fwk.NodeInfo)
| 124 | // Test plugin assumes that each node can hold only one pod whose id begins with blockingPrefix. This allows |
| 125 | // us to construct pods that block future selves or not. |
| 126 | func (pl *BatchTestPlugin) Filter(ctx context.Context, state fwk.CycleState, pod *v1.Pod, nodeInfo fwk.NodeInfo) *fwk.Status { |
| 127 | podID := pod.GetUID() |
| 128 | for _, nodePod := range nodeInfo.GetPods() { |
| 129 | npid := nodePod.GetPod().GetUID() |
| 130 | if podID[0] == blockingPodPrefix && npid[0] == blockingPodPrefix { |
| 131 | return fwk.NewStatus(fwk.Unschedulable, "unsched") |
| 132 | } |
| 133 | } |
| 134 | return nil |
| 135 | } |
| 136 | |
| 137 | func newBatchTestPlugin(_ context.Context, injArgs runtime.Object, f fwk.Handle) (fwk.Plugin, error) { |
| 138 | return &BatchTestPlugin{}, nil |