mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-12 13:31:52 +00:00
Merge pull request #118493 from kerthcet/cleanup/pod-status-reason
Remove reasons from PodConditionType
This commit is contained in:
commit
370c85f5ab
@ -2629,12 +2629,6 @@ const (
|
|||||||
PodReady PodConditionType = "Ready"
|
PodReady PodConditionType = "Ready"
|
||||||
// PodInitialized means that all init containers in the pod have started successfully.
|
// PodInitialized means that all init containers in the pod have started successfully.
|
||||||
PodInitialized PodConditionType = "Initialized"
|
PodInitialized PodConditionType = "Initialized"
|
||||||
// PodReasonUnschedulable reason in PodScheduled PodCondition means that the scheduler
|
|
||||||
// can't schedule the pod right now, for example due to insufficient resources in the cluster.
|
|
||||||
PodReasonUnschedulable = "Unschedulable"
|
|
||||||
// PodReasonSchedulingGated reason in PodScheduled PodCondition means that the scheduler
|
|
||||||
// skips scheduling the pod because one or more scheduling gates are still present.
|
|
||||||
PodReasonSchedulingGated = "SchedulingGated"
|
|
||||||
// ContainersReady indicates whether all containers in the pod are ready.
|
// ContainersReady indicates whether all containers in the pod are ready.
|
||||||
ContainersReady PodConditionType = "ContainersReady"
|
ContainersReady PodConditionType = "ContainersReady"
|
||||||
// DisruptionTarget indicates the pod is about to be terminated due to a
|
// DisruptionTarget indicates the pod is about to be terminated due to a
|
||||||
|
@ -828,8 +828,8 @@ func printPod(pod *api.Pod, options printers.GenerateOptions) ([]metav1.TableRow
|
|||||||
|
|
||||||
// If the Pod carries {type:PodScheduled, reason:WaitingForGates}, set reason to 'SchedulingGated'.
|
// If the Pod carries {type:PodScheduled, reason:WaitingForGates}, set reason to 'SchedulingGated'.
|
||||||
for _, condition := range pod.Status.Conditions {
|
for _, condition := range pod.Status.Conditions {
|
||||||
if condition.Type == api.PodScheduled && condition.Reason == api.PodReasonSchedulingGated {
|
if condition.Type == api.PodScheduled && condition.Reason == apiv1.PodReasonSchedulingGated {
|
||||||
reason = api.PodReasonSchedulingGated
|
reason = apiv1.PodReasonSchedulingGated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
@ -1515,12 +1516,12 @@ func TestPrintPod(t *testing.T) {
|
|||||||
{
|
{
|
||||||
Type: api.PodScheduled,
|
Type: api.PodScheduled,
|
||||||
Status: api.ConditionFalse,
|
Status: api.ConditionFalse,
|
||||||
Reason: api.PodReasonSchedulingGated,
|
Reason: apiv1.PodReasonSchedulingGated,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[]metav1.TableRow{{Cells: []interface{}{"test15", "0/2", api.PodReasonSchedulingGated, "0", "<unknown>"}}},
|
[]metav1.TableRow{{Cells: []interface{}{"test15", "0/2", apiv1.PodReasonSchedulingGated, "0", "<unknown>"}}},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/fields"
|
"k8s.io/apimachinery/pkg/fields"
|
||||||
@ -686,7 +687,7 @@ func applyWaitingForSchedulingGatesCondition(pod *api.Pod) {
|
|||||||
pod.Status.Conditions = append(pod.Status.Conditions, api.PodCondition{
|
pod.Status.Conditions = append(pod.Status.Conditions, api.PodCondition{
|
||||||
Type: api.PodScheduled,
|
Type: api.PodScheduled,
|
||||||
Status: api.ConditionFalse,
|
Status: api.ConditionFalse,
|
||||||
Reason: api.PodReasonSchedulingGated,
|
Reason: apiv1.PodReasonSchedulingGated,
|
||||||
Message: "Scheduling is blocked due to non-empty scheduling gates",
|
Message: "Scheduling is blocked due to non-empty scheduling gates",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/google/go-cmp/cmp/cmpopts"
|
"github.com/google/go-cmp/cmp/cmpopts"
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -351,7 +352,7 @@ func TestWaitingForGatesCondition(t *testing.T) {
|
|||||||
want: api.PodCondition{
|
want: api.PodCondition{
|
||||||
Type: api.PodScheduled,
|
Type: api.PodScheduled,
|
||||||
Status: api.ConditionFalse,
|
Status: api.ConditionFalse,
|
||||||
Reason: api.PodReasonSchedulingGated,
|
Reason: apiv1.PodReasonSchedulingGated,
|
||||||
Message: "Scheduling is blocked due to non-empty scheduling gates",
|
Message: "Scheduling is blocked due to non-empty scheduling gates",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user