Skip to content

Commit

Permalink
dont use slices.contains apparently
Browse files Browse the repository at this point in the history
  • Loading branch information
BenHinthorne committed Jun 18, 2024
1 parent 9f717a7 commit 520c6ae
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions cluster-autoscaler/expander/grpcplugin/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package grpcplugin
import (
"context"
"log"
"slices"
"time"

v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -158,13 +157,20 @@ func transformAndSanitizeOptionsFromGRPC(bestOptionsResponseOptions []*protos.Op
// Any similar options that were not included in the original grpcExpander request, but were added
// as part of the response, will be ignored
func getRetainedSimilarNodegroups(grpcOption *protos.Option, expanderOption expander.Option) []cloudprovider.NodeGroup {
var retainedSimilarNodegroups []cloudprovider.NodeGroup
var retainedSimilarNodeGroups []cloudprovider.NodeGroup
for _, sng := range expanderOption.SimilarNodeGroups {
if slices.Contains(grpcOption.SimilarNodegroupIds, sng.Id()) {
retainedSimilarNodegroups = append(retainedSimilarNodegroups, sng)
retained := false
for _, id := range grpcOption.SimilarNodegroupIds {
if sng.Id() == id {
retained = true
continue
}
}
if retained {
retainedSimilarNodeGroups = append(retainedSimilarNodeGroups, sng)
}
}
return retainedSimilarNodegroups
return retainedSimilarNodeGroups
}

func newOptionMessage(nodeGroupId string, nodeCount int32, debug string, pods []*v1.Pod, similarNodegroupIds []string) *protos.Option {
Expand Down

0 comments on commit 520c6ae

Please sign in to comment.