Skip to content

Commit

Permalink
use std API instead of exp API
Browse files Browse the repository at this point in the history
Signed-off-by: sivchari <[email protected]>
  • Loading branch information
sivchari committed Feb 4, 2025
1 parent 850efe7 commit ad332b3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
go.etcd.io/etcd/client/pkg/v3 v3.5.18
go.etcd.io/etcd/client/v3 v3.5.18
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/oauth2 v0.25.0
golang.org/x/text v0.21.0
gomodules.xyz/jsonpatch/v2 v2.4.0
Expand Down
6 changes: 3 additions & 3 deletions internal/controllers/machine/drain/drain.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ package drain
import (
"context"
"fmt"
"maps"
"math"
"slices"
"sort"
"strings"
"time"

"github.com/pkg/errors"
"golang.org/x/exp/maps"
corev1 "k8s.io/api/core/v1"
policyv1 "k8s.io/api/policy/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -484,8 +485,7 @@ func (r EvictionResult) ConditionMessage(nodeDrainStartTime *metav1.Time) string
conditionMessage, kind, PodListToString(r.PodsDeletionTimestampSet, 3))
}
if len(r.PodsFailedEviction) > 0 {
sortedFailureMessages := maps.Keys(r.PodsFailedEviction)
sort.Strings(sortedFailureMessages)
sortedFailureMessages := slices.Sorted(maps.Keys(r.PodsFailedEviction))

skippedFailureMessages := []string{}
if len(sortedFailureMessages) > 5 {
Expand Down
5 changes: 3 additions & 2 deletions internal/controllers/topology/cluster/current_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ limitations under the License.
package cluster

import (
"maps"
"slices"
"testing"
"time"

"github.com/google/go-cmp/cmp"
. "github.com/onsi/gomega"
"golang.org/x/exp/maps"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand Down Expand Up @@ -1166,7 +1167,7 @@ func TestGetCurrentState(t *testing.T) {
}

// Don't compare the deletionTimestamps as there are some minor differences in how they are stored pre/post fake client.
for _, md := range append(maps.Values(got.MachineDeployments), maps.Values(tt.want.MachineDeployments)...) {
for _, md := range append(slices.Collect(maps.Values(got.MachineDeployments)), slices.Collect(maps.Values(tt.want.MachineDeployments))...) {
md.Object.DeletionTimestamp = nil
}

Expand Down

0 comments on commit ad332b3

Please sign in to comment.