clear pod's .status.nominatedNodeName when necessary
This commit is contained in:
@@ -608,16 +608,44 @@ type Handle interface {
|
||||
Parallelizer() parallelize.Parallelizer
|
||||
}
|
||||
|
||||
type NominatingMode int
|
||||
|
||||
const (
|
||||
ModeNoop NominatingMode = iota
|
||||
ModeOverride
|
||||
)
|
||||
|
||||
type NominatingInfo struct {
|
||||
NominatedNodeName string
|
||||
NominatingMode NominatingMode
|
||||
}
|
||||
|
||||
// PostFilterResult wraps needed info for scheduler framework to act upon PostFilter phase.
|
||||
type PostFilterResult struct {
|
||||
NominatedNodeName string
|
||||
*NominatingInfo
|
||||
}
|
||||
|
||||
func NewPostFilterResultWithNominatedNode(name string) *PostFilterResult {
|
||||
return &PostFilterResult{
|
||||
NominatingInfo: &NominatingInfo{
|
||||
NominatedNodeName: name,
|
||||
NominatingMode: ModeOverride,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (ni *NominatingInfo) Mode() NominatingMode {
|
||||
if ni == nil {
|
||||
return ModeNoop
|
||||
}
|
||||
return ni.NominatingMode
|
||||
}
|
||||
|
||||
// PodNominator abstracts operations to maintain nominated Pods.
|
||||
type PodNominator interface {
|
||||
// AddNominatedPod adds the given pod to the nominator or
|
||||
// updates it if it already exists.
|
||||
AddNominatedPod(pod *PodInfo, nodeName string)
|
||||
AddNominatedPod(pod *PodInfo, nominatingInfo *NominatingInfo)
|
||||
// DeleteNominatedPodIfExists deletes nominatedPod from internal cache. It's a no-op if it doesn't exist.
|
||||
DeleteNominatedPodIfExists(pod *v1.Pod)
|
||||
// UpdateNominatedPod updates the <oldPod> with <newPod>.
|
||||
|
Reference in New Issue
Block a user