From 1bad02cb227540338cc7db5a0abf0a63ee0f35d9 Mon Sep 17 00:00:00 2001 From: FengyunPan Date: Thu, 20 Apr 2017 10:43:24 +0800 Subject: [PATCH] Use const value for pod's conditions --- .../pkg/federation-controller/util/podanalyzer/pod_helper.go | 2 +- .../federation-controller/util/podanalyzer/pod_helper_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/federation/pkg/federation-controller/util/podanalyzer/pod_helper.go b/federation/pkg/federation-controller/util/podanalyzer/pod_helper.go index ccf1f683188..4b342fe15c7 100644 --- a/federation/pkg/federation-controller/util/podanalyzer/pod_helper.go +++ b/federation/pkg/federation-controller/util/podanalyzer/pod_helper.go @@ -68,7 +68,7 @@ func AnalysePods(selectorv1 *metav1.LabelSelector, allPods []util.FederatedObjec } else { if condition.Type == api_v1.PodScheduled && condition.Status == api_v1.ConditionFalse && - condition.Reason == "Unschedulable" && + condition.Reason == api_v1.PodReasonUnschedulable && condition.LastTransitionTime.Add(UnschedulableThreshold).Before(currentTime) { status.Unschedulable++ diff --git a/federation/pkg/federation-controller/util/podanalyzer/pod_helper_test.go b/federation/pkg/federation-controller/util/podanalyzer/pod_helper_test.go index 3f84afe08b1..c0515c3e37e 100644 --- a/federation/pkg/federation-controller/util/podanalyzer/pod_helper_test.go +++ b/federation/pkg/federation-controller/util/podanalyzer/pod_helper_test.go @@ -49,7 +49,7 @@ func TestAnalyze(t *testing.T) { { Type: api_v1.PodScheduled, Status: api_v1.ConditionFalse, - Reason: "Unschedulable", + Reason: api_v1.PodReasonUnschedulable, LastTransitionTime: metav1.Time{Time: now.Add(-10 * time.Minute)}, }, },