mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 11:38:15 +00:00
refactor(scheduler): Rename UpdatePodTolerations for code style consistency.
This commit is contained in:
parent
810e9e212e
commit
27608fa25d
@ -130,7 +130,7 @@ func extractPodTolerationChange(newPod *v1.Pod, oldPod *v1.Pod) ActionType {
|
|||||||
// Due to API validation, the user can add, but cannot modify or remove tolerations.
|
// Due to API validation, the user can add, but cannot modify or remove tolerations.
|
||||||
// So, it's enough to just check the length of tolerations to notice the update.
|
// So, it's enough to just check the length of tolerations to notice the update.
|
||||||
// And, any updates in tolerations could make Pod schedulable.
|
// And, any updates in tolerations could make Pod schedulable.
|
||||||
return UpdatePodTolerations
|
return UpdatePodToleration
|
||||||
}
|
}
|
||||||
|
|
||||||
return none
|
return none
|
||||||
|
@ -410,7 +410,7 @@ func Test_podSchedulingPropertiesChange(t *testing.T) {
|
|||||||
name: "pod's tolerations are updated",
|
name: "pod's tolerations are updated",
|
||||||
newPod: st.MakePod().Toleration("key").Toleration("key2").Obj(),
|
newPod: st.MakePod().Toleration("key").Toleration("key2").Obj(),
|
||||||
oldPod: st.MakePod().Toleration("key").Obj(),
|
oldPod: st.MakePod().Toleration("key").Obj(),
|
||||||
want: []ClusterEvent{{Resource: unschedulablePod, ActionType: UpdatePodTolerations}},
|
want: []ClusterEvent{{Resource: unschedulablePod, ActionType: UpdatePodToleration}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "pod claim statuses change, feature disabled",
|
name: "pod claim statuses change, feature disabled",
|
||||||
|
@ -68,7 +68,7 @@ func (pl *NodeUnschedulable) EventsToRegister(_ context.Context) ([]framework.Cl
|
|||||||
// the scheduling queue uses Pod/Update Queueing Hint
|
// the scheduling queue uses Pod/Update Queueing Hint
|
||||||
// to determine whether a Pod's update makes the Pod schedulable or not.
|
// to determine whether a Pod's update makes the Pod schedulable or not.
|
||||||
// https://github.com/kubernetes/kubernetes/pull/122234
|
// https://github.com/kubernetes/kubernetes/pull/122234
|
||||||
{Event: framework.ClusterEvent{Resource: framework.Pod, ActionType: framework.UpdatePodTolerations}, QueueingHintFn: pl.isSchedulableAfterPodTolerationChange},
|
{Event: framework.ClusterEvent{Resource: framework.Pod, ActionType: framework.UpdatePodToleration}, QueueingHintFn: pl.isSchedulableAfterPodTolerationChange},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,8 +146,8 @@ func (pl *PodTopologySpread) EventsToRegister(_ context.Context) ([]framework.Cl
|
|||||||
//
|
//
|
||||||
// The Pod rejected by this plugin can be schedulable when the Pod has a spread constraint with NodeTaintsPolicy:Honor
|
// The Pod rejected by this plugin can be schedulable when the Pod has a spread constraint with NodeTaintsPolicy:Honor
|
||||||
// and has got a new toleration.
|
// and has got a new toleration.
|
||||||
// So, we add UpdatePodTolerations here only when QHint is enabled.
|
// So, we add UpdatePodToleration here only when QHint is enabled.
|
||||||
podActionType = framework.Add | framework.UpdatePodLabel | framework.UpdatePodTolerations | framework.Delete
|
podActionType = framework.Add | framework.UpdatePodLabel | framework.UpdatePodToleration | framework.Delete
|
||||||
}
|
}
|
||||||
|
|
||||||
return []framework.ClusterEventWithHint{
|
return []framework.ClusterEventWithHint{
|
||||||
|
@ -67,7 +67,7 @@ func (pl *TaintToleration) EventsToRegister(_ context.Context) ([]framework.Clus
|
|||||||
// the scheduling queue uses Pod/Update Queueing Hint
|
// the scheduling queue uses Pod/Update Queueing Hint
|
||||||
// to determine whether a Pod's update makes the Pod schedulable or not.
|
// to determine whether a Pod's update makes the Pod schedulable or not.
|
||||||
// https://github.com/kubernetes/kubernetes/pull/122234
|
// https://github.com/kubernetes/kubernetes/pull/122234
|
||||||
{Event: framework.ClusterEvent{Resource: framework.Pod, ActionType: framework.UpdatePodTolerations}, QueueingHintFn: pl.isSchedulableAfterPodTolerationChange},
|
{Event: framework.ClusterEvent{Resource: framework.Pod, ActionType: framework.UpdatePodToleration}, QueueingHintFn: pl.isSchedulableAfterPodTolerationChange},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,9 +72,9 @@ const (
|
|||||||
UpdatePodLabel
|
UpdatePodLabel
|
||||||
// UpdatePodScaleDown is an update for pod's scale down (i.e., any resource request is reduced).
|
// UpdatePodScaleDown is an update for pod's scale down (i.e., any resource request is reduced).
|
||||||
UpdatePodScaleDown
|
UpdatePodScaleDown
|
||||||
// UpdatePodTolerations is an addition for pod's tolerations.
|
// UpdatePodToleration is an addition for pod's tolerations.
|
||||||
// (Due to API validation, we can add, but cannot modify or remove tolerations.)
|
// (Due to API validation, we can add, but cannot modify or remove tolerations.)
|
||||||
UpdatePodTolerations
|
UpdatePodToleration
|
||||||
// UpdatePodSchedulingGatesEliminated is an update for pod's scheduling gates, which eliminates all scheduling gates in the Pod.
|
// UpdatePodSchedulingGatesEliminated is an update for pod's scheduling gates, which eliminates all scheduling gates in the Pod.
|
||||||
UpdatePodSchedulingGatesEliminated
|
UpdatePodSchedulingGatesEliminated
|
||||||
// UpdatePodGeneratedResourceClaim is an update of the list of ResourceClaims generated for the pod.
|
// UpdatePodGeneratedResourceClaim is an update of the list of ResourceClaims generated for the pod.
|
||||||
@ -88,7 +88,7 @@ const (
|
|||||||
All ActionType = 1<<iota - 1
|
All ActionType = 1<<iota - 1
|
||||||
|
|
||||||
// Use the general Update type if you don't either know or care the specific sub-Update type to use.
|
// Use the general Update type if you don't either know or care the specific sub-Update type to use.
|
||||||
Update = UpdateNodeAllocatable | UpdateNodeLabel | UpdateNodeTaint | UpdateNodeCondition | UpdateNodeAnnotation | UpdatePodLabel | UpdatePodScaleDown | UpdatePodTolerations | UpdatePodSchedulingGatesEliminated | UpdatePodGeneratedResourceClaim | updatePodOther
|
Update = UpdateNodeAllocatable | UpdateNodeLabel | UpdateNodeTaint | UpdateNodeCondition | UpdateNodeAnnotation | UpdatePodLabel | UpdatePodScaleDown | UpdatePodToleration | UpdatePodSchedulingGatesEliminated | UpdatePodGeneratedResourceClaim | updatePodOther
|
||||||
// none is a special ActionType that is only used internally.
|
// none is a special ActionType that is only used internally.
|
||||||
none ActionType = 0
|
none ActionType = 0
|
||||||
)
|
)
|
||||||
@ -97,7 +97,7 @@ var (
|
|||||||
// basicActionTypes is a list of basicActionTypes ActionTypes.
|
// basicActionTypes is a list of basicActionTypes ActionTypes.
|
||||||
basicActionTypes = []ActionType{Add, Delete, Update}
|
basicActionTypes = []ActionType{Add, Delete, Update}
|
||||||
// podActionTypes is a list of ActionTypes that are only applicable for Pod events.
|
// podActionTypes is a list of ActionTypes that are only applicable for Pod events.
|
||||||
podActionTypes = []ActionType{UpdatePodLabel, UpdatePodScaleDown, UpdatePodTolerations, UpdatePodSchedulingGatesEliminated, UpdatePodGeneratedResourceClaim}
|
podActionTypes = []ActionType{UpdatePodLabel, UpdatePodScaleDown, UpdatePodToleration, UpdatePodSchedulingGatesEliminated, UpdatePodGeneratedResourceClaim}
|
||||||
// nodeActionTypes is a list of ActionTypes that are only applicable for Node events.
|
// nodeActionTypes is a list of ActionTypes that are only applicable for Node events.
|
||||||
nodeActionTypes = []ActionType{UpdateNodeAllocatable, UpdateNodeLabel, UpdateNodeTaint, UpdateNodeCondition, UpdateNodeAnnotation}
|
nodeActionTypes = []ActionType{UpdateNodeAllocatable, UpdateNodeLabel, UpdateNodeTaint, UpdateNodeCondition, UpdateNodeAnnotation}
|
||||||
)
|
)
|
||||||
@ -122,8 +122,8 @@ func (a ActionType) String() string {
|
|||||||
return "UpdatePodLabel"
|
return "UpdatePodLabel"
|
||||||
case UpdatePodScaleDown:
|
case UpdatePodScaleDown:
|
||||||
return "UpdatePodScaleDown"
|
return "UpdatePodScaleDown"
|
||||||
case UpdatePodTolerations:
|
case UpdatePodToleration:
|
||||||
return "UpdatePodTolerations"
|
return "UpdatePodToleration"
|
||||||
case UpdatePodSchedulingGatesEliminated:
|
case UpdatePodSchedulingGatesEliminated:
|
||||||
return "UpdatePodSchedulingGatesEliminated"
|
return "UpdatePodSchedulingGatesEliminated"
|
||||||
case UpdatePodGeneratedResourceClaim:
|
case UpdatePodGeneratedResourceClaim:
|
||||||
|
@ -901,7 +901,7 @@ func Test_UnionedGVKs(t *testing.T) {
|
|||||||
name: "plugins with default profile (queueingHint/InPlacePodVerticalScaling: enabled)",
|
name: "plugins with default profile (queueingHint/InPlacePodVerticalScaling: enabled)",
|
||||||
plugins: schedulerapi.PluginSet{Enabled: defaults.PluginsV1.MultiPoint.Enabled},
|
plugins: schedulerapi.PluginSet{Enabled: defaults.PluginsV1.MultiPoint.Enabled},
|
||||||
want: map[framework.EventResource]framework.ActionType{
|
want: map[framework.EventResource]framework.ActionType{
|
||||||
framework.Pod: framework.Add | framework.UpdatePodLabel | framework.UpdatePodScaleDown | framework.UpdatePodTolerations | framework.UpdatePodSchedulingGatesEliminated | framework.Delete,
|
framework.Pod: framework.Add | framework.UpdatePodLabel | framework.UpdatePodScaleDown | framework.UpdatePodToleration | framework.UpdatePodSchedulingGatesEliminated | framework.Delete,
|
||||||
framework.Node: framework.Add | framework.UpdateNodeAllocatable | framework.UpdateNodeLabel | framework.UpdateNodeTaint | framework.Delete,
|
framework.Node: framework.Add | framework.UpdateNodeAllocatable | framework.UpdateNodeLabel | framework.UpdateNodeTaint | framework.Delete,
|
||||||
framework.CSINode: framework.All - framework.Delete,
|
framework.CSINode: framework.All - framework.Delete,
|
||||||
framework.CSIDriver: framework.Update,
|
framework.CSIDriver: framework.Update,
|
||||||
|
@ -220,7 +220,7 @@ var CoreResourceEnqueueTestCases = []*CoreResourceEnqueueTestCase{
|
|||||||
if _, err := testCtx.ClientSet.CoreV1().Pods(testCtx.NS.Name).Update(testCtx.Ctx, st.MakePod().Name("pod1").Container("image").Toleration("taint-key").Obj(), metav1.UpdateOptions{}); err != nil {
|
if _, err := testCtx.ClientSet.CoreV1().Pods(testCtx.NS.Name).Update(testCtx.Ctx, st.MakePod().Name("pod1").Container("image").Toleration("taint-key").Obj(), metav1.UpdateOptions{}); err != nil {
|
||||||
return nil, fmt.Errorf("failed to update the pod: %w", err)
|
return nil, fmt.Errorf("failed to update the pod: %w", err)
|
||||||
}
|
}
|
||||||
return map[framework.ClusterEvent]uint64{{Resource: unschedulablePod, ActionType: framework.UpdatePodTolerations}: 1}, nil
|
return map[framework.ClusterEvent]uint64{{Resource: unschedulablePod, ActionType: framework.UpdatePodToleration}: 1}, nil
|
||||||
},
|
},
|
||||||
WantRequeuedPods: sets.New("pod1"),
|
WantRequeuedPods: sets.New("pod1"),
|
||||||
},
|
},
|
||||||
|
@ -133,7 +133,7 @@
|
|||||||
measurePods: 500 # Must be initNodes * 10
|
measurePods: 500 # Must be initNodes * 10
|
||||||
|
|
||||||
# This test case is used to measure the performance of queuing hints when handling the pod update events:
|
# This test case is used to measure the performance of queuing hints when handling the pod update events:
|
||||||
# UpdatePodLabel, UpdatePodScaleDown, UpdatePodTolerations and UpdatePodSchedulingGatesEliminated.
|
# UpdatePodLabel, UpdatePodScaleDown, UpdatePodToleration and UpdatePodSchedulingGatesEliminated.
|
||||||
# It has a few stages, but general idea is to make a node and block some pods on it
|
# It has a few stages, but general idea is to make a node and block some pods on it
|
||||||
# or to create additional blocker pods that will prevent the other ones from being scheduled.
|
# or to create additional blocker pods that will prevent the other ones from being scheduled.
|
||||||
# Then, updating the blocker pods or the unschedulable pods themselves generate cluster events,
|
# Then, updating the blocker pods or the unschedulable pods themselves generate cluster events,
|
||||||
|
Loading…
Reference in New Issue
Block a user