fix: correct incorrect comment & function name about SchedulingGated

This commit is contained in:
Huan Yan 2024-01-31 11:27:14 +08:00
parent 4f910fe47c
commit 01dbb85974
4 changed files with 6 additions and 6 deletions

View File

@ -836,7 +836,7 @@ func printPod(pod *api.Pod, options printers.GenerateOptions) ([]metav1.TableRow
reason = pod.Status.Reason reason = pod.Status.Reason
} }
// If the Pod carries {type:PodScheduled, reason:WaitingForGates}, set reason to 'SchedulingGated'. // If the Pod carries {type:PodScheduled, reason:SchedulingGated}, set reason to 'SchedulingGated'.
for _, condition := range pod.Status.Conditions { for _, condition := range pod.Status.Conditions {
if condition.Type == api.PodScheduled && condition.Reason == apiv1.PodReasonSchedulingGated { if condition.Type == api.PodScheduled && condition.Reason == apiv1.PodReasonSchedulingGated {
reason = apiv1.PodReasonSchedulingGated reason = apiv1.PodReasonSchedulingGated

View File

@ -1506,7 +1506,7 @@ func TestPrintPod(t *testing.T) {
[]metav1.TableRow{{Cells: []interface{}{"test14", "2/2", "Running", "9 (5d ago)", "<unknown>"}}}, []metav1.TableRow{{Cells: []interface{}{"test14", "2/2", "Running", "9 (5d ago)", "<unknown>"}}},
}, },
{ {
// Test PodScheduled condition with reason WaitingForGates // Test PodScheduled condition with reason SchedulingGated
api.Pod{ api.Pod{
ObjectMeta: metav1.ObjectMeta{Name: "test15"}, ObjectMeta: metav1.ObjectMeta{Name: "test15"},
Spec: api.PodSpec{Containers: make([]api.Container, 2)}, Spec: api.PodSpec{Containers: make([]api.Container, 2)},

View File

@ -89,7 +89,7 @@ func (podStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
podutil.DropDisabledPodFields(pod, nil) podutil.DropDisabledPodFields(pod, nil)
applyWaitingForSchedulingGatesCondition(pod) applySchedulingGatedCondition(pod)
mutatePodAffinity(pod) mutatePodAffinity(pod)
} }
@ -737,9 +737,9 @@ func mutatePodAffinity(pod *api.Pod) {
} }
} }
// applyWaitingForSchedulingGatesCondition adds a {type:PodScheduled, reason:WaitingForGates} condition // applySchedulingGatedCondition adds a {type:PodScheduled, reason:SchedulingGated} condition
// to a new-created Pod if necessary. // to a new-created Pod if necessary.
func applyWaitingForSchedulingGatesCondition(pod *api.Pod) { func applySchedulingGatedCondition(pod *api.Pod) {
if !utilfeature.DefaultFeatureGate.Enabled(features.PodSchedulingReadiness) || if !utilfeature.DefaultFeatureGate.Enabled(features.PodSchedulingReadiness) ||
len(pod.Spec.SchedulingGates) == 0 { len(pod.Spec.SchedulingGates) == 0 {
return return

View File

@ -312,7 +312,7 @@ func TestGetPodQOS(t *testing.T) {
} }
} }
func TestWaitingForGatesCondition(t *testing.T) { func TestSchedulingGatedCondition(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
pod *api.Pod pod *api.Pod