From 520c6ae107e1a33c8a3c0b235910885e66aa5baa Mon Sep 17 00:00:00 2001 From: BenHinthorne Date: Tue, 18 Jun 2024 13:46:19 -0400 Subject: [PATCH] dont use slices.contains apparently --- .../expander/grpcplugin/grpc_client.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cluster-autoscaler/expander/grpcplugin/grpc_client.go b/cluster-autoscaler/expander/grpcplugin/grpc_client.go index c488b420bbdd..679dce80e288 100644 --- a/cluster-autoscaler/expander/grpcplugin/grpc_client.go +++ b/cluster-autoscaler/expander/grpcplugin/grpc_client.go @@ -19,7 +19,6 @@ package grpcplugin import ( "context" "log" - "slices" "time" v1 "k8s.io/api/core/v1" @@ -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 {