sched: support PreEnqueueChecks prior to moving Pods

This commit is contained in:
Wei Huang
2021-03-11 12:31:33 -08:00
parent 1db614ec8f
commit 6384f397b4
10 changed files with 298 additions and 64 deletions

View File

@@ -250,6 +250,25 @@ func (p *PodWrapper) NominatedNodeName(n string) *PodWrapper {
return p
}
// Toleration creates a toleration (with the operator Exists)
// and injects into the inner pod.
func (p *PodWrapper) Toleration(key string) *PodWrapper {
p.Spec.Tolerations = append(p.Spec.Tolerations, v1.Toleration{
Key: key,
Operator: v1.TolerationOpExists,
})
return p
}
// HostPort creates a container with a hostPort valued `hostPort`,
// and injects into the inner pod.
func (p *PodWrapper) HostPort(port int32) *PodWrapper {
p.Spec.Containers = append(p.Spec.Containers, v1.Container{
Ports: []v1.ContainerPort{{HostPort: port}},
})
return p
}
// PodAffinityKind represents different kinds of PodAffinity.
type PodAffinityKind int