mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-16 14:45:28 +00:00
Refactor PodCondition to PodPhase
This commit is contained in:
@@ -129,7 +129,7 @@ func (rs *REST) Get(ctx api.Context, id string) (runtime.Object, error) {
|
||||
if err != nil {
|
||||
return pod, err
|
||||
}
|
||||
pod.Status.Condition = status
|
||||
pod.Status.Phase = status
|
||||
}
|
||||
if pod.Status.Host != "" {
|
||||
pod.Status.HostIP = rs.getInstanceIP(pod.Status.Host)
|
||||
@@ -143,11 +143,11 @@ func (rs *REST) podToSelectableFields(pod *api.Pod) labels.Set {
|
||||
// see https://github.com/GoogleCloudPlatform/kubernetes/pull/2503
|
||||
|
||||
var olderPodStatus v1beta1.PodStatus
|
||||
api.Scheme.Convert(pod.Status.Condition, &olderPodStatus)
|
||||
api.Scheme.Convert(pod.Status.Phase, &olderPodStatus)
|
||||
|
||||
return labels.Set{
|
||||
"name": pod.Name,
|
||||
"Status.Condition": string(pod.Status.Condition),
|
||||
"Status.Phase": string(pod.Status.Phase),
|
||||
"Status.Host": pod.Status.Host,
|
||||
"DesiredState.Status": string(olderPodStatus),
|
||||
"DesiredState.Host": pod.Status.Host,
|
||||
@@ -173,7 +173,7 @@ func (rs *REST) List(ctx api.Context, label, field labels.Selector) (runtime.Obj
|
||||
if err != nil {
|
||||
return pod, err
|
||||
}
|
||||
pod.Status.Condition = status
|
||||
pod.Status.Phase = status
|
||||
if pod.Status.Host != "" {
|
||||
pod.Status.HostIP = rs.getInstanceIP(pod.Status.Host)
|
||||
}
|
||||
@@ -274,7 +274,7 @@ func getInstanceIPFromCloud(cloud cloudprovider.Interface, host string) string {
|
||||
return addr.String()
|
||||
}
|
||||
|
||||
func getPodStatus(pod *api.Pod, minions client.MinionInterface) (api.PodCondition, error) {
|
||||
func getPodStatus(pod *api.Pod, minions client.MinionInterface) (api.PodPhase, error) {
|
||||
if pod.Status.Host == "" {
|
||||
return api.PodPending, nil
|
||||
}
|
||||
|
@@ -205,7 +205,7 @@ func TestListPodListSelection(t *testing.T) {
|
||||
Status: api.PodStatus{Host: "barhost"},
|
||||
}, {
|
||||
ObjectMeta: api.ObjectMeta{Name: "baz"},
|
||||
Status: api.PodStatus{Condition: "bazstatus"},
|
||||
Status: api.PodStatus{Phase: "bazstatus"},
|
||||
}, {
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: "qux",
|
||||
@@ -236,7 +236,7 @@ func TestListPodListSelection(t *testing.T) {
|
||||
label: "label=qux",
|
||||
expectedIDs: util.NewStringSet("qux"),
|
||||
}, {
|
||||
field: "Status.Condition=bazstatus",
|
||||
field: "Status.Phase=bazstatus",
|
||||
expectedIDs: util.NewStringSet("baz"),
|
||||
}, {
|
||||
field: "Status.Host=barhost",
|
||||
@@ -400,7 +400,7 @@ func TestMakePodStatus(t *testing.T) {
|
||||
|
||||
tests := []struct {
|
||||
pod *api.Pod
|
||||
status api.PodCondition
|
||||
status api.PodPhase
|
||||
test string
|
||||
}{
|
||||
{&api.Pod{Spec: desiredState, Status: currentState}, api.PodPending, "waiting"},
|
||||
|
Reference in New Issue
Block a user