Skip to content

Commit

Permalink
remove useless function
Browse files Browse the repository at this point in the history
  • Loading branch information
whitebear009 committed Aug 30, 2023
1 parent 4a459d3 commit b5475b7
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions pkg/controller/ehpa/hpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import (
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/scale"
"k8s.io/client-go/util/retry"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -393,26 +391,3 @@ func (c *EffectiveHPAController) propagateLabelAndAnnotation(ehpa *autoscalingap
}
}
}

func getAvailablePods(ctx context.Context, restMapper meta.RESTMapper, kubeClient client.Client, scaleClient scale.ScalesGetter, ehpa autoscalingapi.EffectiveHorizontalPodAutoscaler) ([]v1.Pod, error) {
scale, _, err := utils.GetScale(ctx, restMapper, scaleClient, ehpa.Namespace, ehpa.Spec.ScaleTargetRef)
if err != nil {
return nil, err
}

pods, err := utils.GetPodsFromScale(kubeClient, scale)
if err != nil {
return nil, err
}

if len(pods) == 0 {
return nil, fmt.Errorf("no pods returns from scale object. ")
}

availablePods := utils.GetAvailablePods(pods)
if len(availablePods) == 0 {
return nil, fmt.Errorf("failed to get available pods. ")
}

return availablePods, nil
}

0 comments on commit b5475b7

Please sign in to comment.