From 01dbb85974d1f3d5811e8099c7d3dd9300602e63 Mon Sep 17 00:00:00 2001 From: Huan Yan Date: Wed, 31 Jan 2024 11:27:14 +0800 Subject: [PATCH] fix: correct incorrect comment & function name about SchedulingGated --- pkg/printers/internalversion/printers.go | 2 +- pkg/printers/internalversion/printers_test.go | 2 +- pkg/registry/core/pod/strategy.go | 6 +++--- pkg/registry/core/pod/strategy_test.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/printers/internalversion/printers.go b/pkg/printers/internalversion/printers.go index fd4377e143b..6ce614d3a27 100644 --- a/pkg/printers/internalversion/printers.go +++ b/pkg/printers/internalversion/printers.go @@ -836,7 +836,7 @@ func printPod(pod *api.Pod, options printers.GenerateOptions) ([]metav1.TableRow 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 { 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 3d1f5e8b4c2..f14bd702ea7 100644 --- a/pkg/printers/internalversion/printers_test.go +++ b/pkg/printers/internalversion/printers_test.go @@ -1506,7 +1506,7 @@ func TestPrintPod(t *testing.T) { []metav1.TableRow{{Cells: []interface{}{"test14", "2/2", "Running", "9 (5d ago)", ""}}}, }, { - // Test PodScheduled condition with reason WaitingForGates + // Test PodScheduled condition with reason SchedulingGated api.Pod{ ObjectMeta: metav1.ObjectMeta{Name: "test15"}, Spec: api.PodSpec{Containers: make([]api.Container, 2)}, diff --git a/pkg/registry/core/pod/strategy.go b/pkg/registry/core/pod/strategy.go index c34568abd22..ea73d18a3c8 100644 --- a/pkg/registry/core/pod/strategy.go +++ b/pkg/registry/core/pod/strategy.go @@ -89,7 +89,7 @@ func (podStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) { podutil.DropDisabledPodFields(pod, nil) - applyWaitingForSchedulingGatesCondition(pod) + applySchedulingGatedCondition(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. -func applyWaitingForSchedulingGatesCondition(pod *api.Pod) { +func applySchedulingGatedCondition(pod *api.Pod) { if !utilfeature.DefaultFeatureGate.Enabled(features.PodSchedulingReadiness) || len(pod.Spec.SchedulingGates) == 0 { return diff --git a/pkg/registry/core/pod/strategy_test.go b/pkg/registry/core/pod/strategy_test.go index 6317af86da6..c91a7c1fd8a 100644 --- a/pkg/registry/core/pod/strategy_test.go +++ b/pkg/registry/core/pod/strategy_test.go @@ -312,7 +312,7 @@ func TestGetPodQOS(t *testing.T) { } } -func TestWaitingForGatesCondition(t *testing.T) { +func TestSchedulingGatedCondition(t *testing.T) { tests := []struct { name string pod *api.Pod