mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 13:45:06 +00:00
update PodSpec.Host to PodSpec.NodeName in /pkg/api/types.go and /pkg/api/v1beta3/types.go
This commit is contained in:
@@ -274,7 +274,7 @@ func (s activePods) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
|
||||
func (s activePods) Less(i, j int) bool {
|
||||
// Unassigned < assigned
|
||||
if s[i].Spec.Host == "" && s[j].Spec.Host != "" {
|
||||
if s[i].Spec.NodeName == "" && s[j].Spec.NodeName != "" {
|
||||
return true
|
||||
}
|
||||
// PodPending < PodUnknown < PodRunning
|
||||
|
@@ -436,19 +436,19 @@ func TestSortingActivePods(t *testing.T) {
|
||||
pods[i] = &podList.Items[i]
|
||||
}
|
||||
// pods[0] is not scheduled yet.
|
||||
pods[0].Spec.Host = ""
|
||||
pods[0].Spec.NodeName = ""
|
||||
pods[0].Status.Phase = api.PodPending
|
||||
// pods[1] is scheduled but pending.
|
||||
pods[1].Spec.Host = "bar"
|
||||
pods[1].Spec.NodeName = "bar"
|
||||
pods[1].Status.Phase = api.PodPending
|
||||
// pods[2] is unknown.
|
||||
pods[2].Spec.Host = "foo"
|
||||
pods[2].Spec.NodeName = "foo"
|
||||
pods[2].Status.Phase = api.PodUnknown
|
||||
// pods[3] is running but not ready.
|
||||
pods[3].Spec.Host = "foo"
|
||||
pods[3].Spec.NodeName = "foo"
|
||||
pods[3].Status.Phase = api.PodRunning
|
||||
// pods[4] is running and ready.
|
||||
pods[4].Spec.Host = "foo"
|
||||
pods[4].Spec.NodeName = "foo"
|
||||
pods[4].Status.Phase = api.PodRunning
|
||||
pods[4].Status.Conditions = []api.PodCondition{{Type: api.PodReady, Status: api.ConditionTrue}}
|
||||
|
||||
|
Reference in New Issue
Block a user