Skip to content

Commit 370c85f

Browse files
authored
Merge pull request kubernetes#118493 from kerthcet/cleanup/pod-status-reason
Remove reasons from PodConditionType
2 parents 1144c85 + 96ab232 commit 370c85f

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

pkg/apis/core/types.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2629,12 +2629,6 @@ const (
26292629
PodReady PodConditionType = "Ready"
26302630
// PodInitialized means that all init containers in the pod have started successfully.
26312631
PodInitialized PodConditionType = "Initialized"
2632-
// PodReasonUnschedulable reason in PodScheduled PodCondition means that the scheduler
2633-
// can't schedule the pod right now, for example due to insufficient resources in the cluster.
2634-
PodReasonUnschedulable = "Unschedulable"
2635-
// PodReasonSchedulingGated reason in PodScheduled PodCondition means that the scheduler
2636-
// skips scheduling the pod because one or more scheduling gates are still present.
2637-
PodReasonSchedulingGated = "SchedulingGated"
26382632
// ContainersReady indicates whether all containers in the pod are ready.
26392633
ContainersReady PodConditionType = "ContainersReady"
26402634
// DisruptionTarget indicates the pod is about to be terminated due to a

pkg/printers/internalversion/printers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,8 +828,8 @@ func printPod(pod *api.Pod, options printers.GenerateOptions) ([]metav1.TableRow
828828

829829
// If the Pod carries {type:PodScheduled, reason:WaitingForGates}, set reason to 'SchedulingGated'.
830830
for _, condition := range pod.Status.Conditions {
831-
if condition.Type == api.PodScheduled && condition.Reason == api.PodReasonSchedulingGated {
832-
reason = api.PodReasonSchedulingGated
831+
if condition.Type == api.PodScheduled && condition.Reason == apiv1.PodReasonSchedulingGated {
832+
reason = apiv1.PodReasonSchedulingGated
833833
}
834834
}
835835

pkg/printers/internalversion/printers_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"time"
2626

2727
"github.com/google/go-cmp/cmp"
28+
apiv1 "k8s.io/api/core/v1"
2829
"k8s.io/apimachinery/pkg/api/resource"
2930
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3031
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -1515,12 +1516,12 @@ func TestPrintPod(t *testing.T) {
15151516
{
15161517
Type: api.PodScheduled,
15171518
Status: api.ConditionFalse,
1518-
Reason: api.PodReasonSchedulingGated,
1519+
Reason: apiv1.PodReasonSchedulingGated,
15191520
},
15201521
},
15211522
},
15221523
},
1523-
[]metav1.TableRow{{Cells: []interface{}{"test15", "0/2", api.PodReasonSchedulingGated, "0", "<unknown>"}}},
1524+
[]metav1.TableRow{{Cells: []interface{}{"test15", "0/2", apiv1.PodReasonSchedulingGated, "0", "<unknown>"}}},
15241525
},
15251526
}
15261527

pkg/registry/core/pod/strategy.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"strings"
2727
"time"
2828

29+
apiv1 "k8s.io/api/core/v1"
2930
"k8s.io/apimachinery/pkg/api/errors"
3031
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3132
"k8s.io/apimachinery/pkg/fields"
@@ -686,7 +687,7 @@ func applyWaitingForSchedulingGatesCondition(pod *api.Pod) {
686687
pod.Status.Conditions = append(pod.Status.Conditions, api.PodCondition{
687688
Type: api.PodScheduled,
688689
Status: api.ConditionFalse,
689-
Reason: api.PodReasonSchedulingGated,
690+
Reason: apiv1.PodReasonSchedulingGated,
690691
Message: "Scheduling is blocked due to non-empty scheduling gates",
691692
})
692693
}

pkg/registry/core/pod/strategy_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626

2727
"github.com/google/go-cmp/cmp"
2828
"github.com/google/go-cmp/cmp/cmpopts"
29+
apiv1 "k8s.io/api/core/v1"
2930
"k8s.io/apimachinery/pkg/api/errors"
3031
"k8s.io/apimachinery/pkg/api/resource"
3132
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -351,7 +352,7 @@ func TestWaitingForGatesCondition(t *testing.T) {
351352
want: api.PodCondition{
352353
Type: api.PodScheduled,
353354
Status: api.ConditionFalse,
354-
Reason: api.PodReasonSchedulingGated,
355+
Reason: apiv1.PodReasonSchedulingGated,
355356
Message: "Scheduling is blocked due to non-empty scheduling gates",
356357
},
357358
},

0 commit comments

Comments
 (0)