diff --git a/pkg/apis/core/types.go b/pkg/apis/core/types.go index 51423b4109c..e40b8bfa104 100644 --- a/pkg/apis/core/types.go +++ b/pkg/apis/core/types.go @@ -2629,12 +2629,6 @@ const ( PodReady PodConditionType = "Ready" // PodInitialized means that all init containers in the pod have started successfully. 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 PodConditionType = "ContainersReady" // DisruptionTarget indicates the pod is about to be terminated due to a diff --git a/pkg/printers/internalversion/printers.go b/pkg/printers/internalversion/printers.go index 138e38e025c..239471c2aeb 100644 --- a/pkg/printers/internalversion/printers.go +++ b/pkg/printers/internalversion/printers.go @@ -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'. for _, condition := range pod.Status.Conditions { - if condition.Type == api.PodScheduled && condition.Reason == api.PodReasonSchedulingGated { - reason = api.PodReasonSchedulingGated + if condition.Type == api.PodScheduled && condition.Reason == apiv1.PodReasonSchedulingGated { + reason = apiv1.PodReasonSchedulingGated } } diff --git a/pkg/printers/internalversion/printers_test.go b/pkg/printers/internalversion/printers_test.go index 4f3feaab592..6580181c45d 100644 --- a/pkg/printers/internalversion/printers_test.go +++ b/pkg/printers/internalversion/printers_test.go @@ -25,6 +25,7 @@ import ( "time" "github.com/google/go-cmp/cmp" + apiv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" @@ -1515,12 +1516,12 @@ func TestPrintPod(t *testing.T) { { Type: api.PodScheduled, Status: api.ConditionFalse, - Reason: api.PodReasonSchedulingGated, + Reason: apiv1.PodReasonSchedulingGated, }, }, }, }, - []metav1.TableRow{{Cells: []interface{}{"test15", "0/2", api.PodReasonSchedulingGated, "0", ""}}}, + []metav1.TableRow{{Cells: []interface{}{"test15", "0/2", apiv1.PodReasonSchedulingGated, "0", ""}}}, }, } diff --git a/pkg/registry/core/pod/strategy.go b/pkg/registry/core/pod/strategy.go index 63bc0b52432..f638eb64e2e 100644 --- a/pkg/registry/core/pod/strategy.go +++ b/pkg/registry/core/pod/strategy.go @@ -26,6 +26,7 @@ import ( "strings" "time" + apiv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" @@ -686,7 +687,7 @@ func applyWaitingForSchedulingGatesCondition(pod *api.Pod) { pod.Status.Conditions = append(pod.Status.Conditions, api.PodCondition{ Type: api.PodScheduled, Status: api.ConditionFalse, - Reason: api.PodReasonSchedulingGated, + Reason: apiv1.PodReasonSchedulingGated, Message: "Scheduling is blocked due to non-empty scheduling gates", }) } diff --git a/pkg/registry/core/pod/strategy_test.go b/pkg/registry/core/pod/strategy_test.go index 625f8550efe..76f589a1642 100644 --- a/pkg/registry/core/pod/strategy_test.go +++ b/pkg/registry/core/pod/strategy_test.go @@ -26,6 +26,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" + apiv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -351,7 +352,7 @@ func TestWaitingForGatesCondition(t *testing.T) { want: api.PodCondition{ Type: api.PodScheduled, Status: api.ConditionFalse, - Reason: api.PodReasonSchedulingGated, + Reason: apiv1.PodReasonSchedulingGated, Message: "Scheduling is blocked due to non-empty scheduling gates", }, },