From df20347e3b8154fe725aa872c0e335f8ba4b80ef Mon Sep 17 00:00:00 2001 From: RainbowMango Date: Fri, 12 Nov 2021 20:07:31 +0800 Subject: [PATCH] Fix job can not schedule issue. Signed-off-by: RainbowMango --- pkg/crdexplorer/defaultexplorer/default.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/crdexplorer/defaultexplorer/default.go b/pkg/crdexplorer/defaultexplorer/default.go index d767ae00c..8bbefaf2c 100644 --- a/pkg/crdexplorer/defaultexplorer/default.go +++ b/pkg/crdexplorer/defaultexplorer/default.go @@ -43,19 +43,18 @@ func (e *DefaultExplorer) HookEnabled(kind schema.GroupVersionKind, operationTyp // GetReplicas returns the desired replicas of the object as well as the requirements of each replica. func (e *DefaultExplorer) GetReplicas(object runtime.Object) (int32, *workv1alpha2.ReplicaRequirements, error) { - _, exist := e.replicaHandlers[object.GetObjectKind().GroupVersionKind()] + handler, exist := e.replicaHandlers[object.GetObjectKind().GroupVersionKind()] if !exist { return 0, &workv1alpha2.ReplicaRequirements{}, fmt.Errorf("defalut explorer for operation %s not found", configv1alpha1.ExploreReplica) } - return e.replicaHandlers[appsv1.SchemeGroupVersion.WithKind(util.DeploymentKind)](object) + return handler(object) } // GetHealthy tells if the object in healthy state. func (e *DefaultExplorer) GetHealthy(object runtime.Object) (bool, error) { - // judge object type, and then get correct kind. - _, exist := e.healthyHandlers[appsv1.SchemeGroupVersion.WithKind(util.DeploymentKind)] + handler, exist := e.healthyHandlers[appsv1.SchemeGroupVersion.WithKind(util.DeploymentKind)] if !exist { return false, fmt.Errorf("defalut explorer for operation %s not found", configv1alpha1.ExploreHealthy) } - return e.healthyHandlers[appsv1.SchemeGroupVersion.WithKind(util.DeploymentKind)](object) + return handler(object) }