Skip to content

Commit

Permalink
Use k8s.io/utils set instead of apimachinery
Browse files Browse the repository at this point in the history
The k8s.io/utils version is the implementation planned to be
maintained in the long term.

Signed-off-by: Stephen Kitt <[email protected]>
  • Loading branch information
skitt authored and sridhargaddam committed Jul 5, 2023
1 parent 1971f06 commit 572446f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ updates:
- dependency-name: k8s.io/apimachinery
- dependency-name: k8s.io/client-go
- dependency-name: k8s.io/klog
- dependency-name: k8s.io/utils
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ require (
k8s.io/apimachinery v0.27.3
k8s.io/client-go v0.27.3
k8s.io/klog v1.0.0
k8s.io/utils v0.0.0-20230505201702-9f6742963106
sigs.k8s.io/controller-runtime v0.15.0
sigs.k8s.io/yaml v1.3.0
)
Expand Down Expand Up @@ -69,7 +70,6 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/mcs-api v0.1.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,8 @@ k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5F
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg=
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
k8s.io/utils v0.0.0-20230505201702-9f6742963106 h1:EObNQ3TW2D+WptiYXlApGNLVy0zm/JIBVY9i+M4wpAU=
k8s.io/utils v0.0.0-20230505201702-9f6742963106/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.7/go.mod h1:PHgbrJT7lCHcxMU+mDHEm+nx46H4zuuHZkDP6icnhu0=
sigs.k8s.io/controller-runtime v0.6.1/go.mod h1:XRYBPdbf5XJu9kpS84VJiZ7h/u1hF3gEORz0efEja7A=
sigs.k8s.io/controller-runtime v0.15.0 h1:ML+5Adt3qZnMSYxZ7gAverBLNPSMQEibtzAgp0UPojU=
Expand Down
4 changes: 2 additions & 2 deletions pkg/slices/slices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/submariner-io/admiral/pkg/slices"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/utils/set"
)

type Status struct {
Expand All @@ -33,7 +33,7 @@ var _ = Describe("Intersect", func() {
Specify("with non-empty slices", func() {
testIntersect := func(s1, s2 []string, exp ...string) {
actual := slices.Intersect(s1, s2, key)
Expect(sets.New(actual...).Equal(sets.New(exp...))).To(BeTrue(), "Expected: %s. Actual: %s", exp, actual)
Expect(set.New(actual...).Equal(set.New(exp...))).To(BeTrue(), "Expected: %s. Actual: %s", exp, actual)
}

testIntersect([]string{"1", "2"}, []string{"1", "2"}, "1", "2")
Expand Down
4 changes: 2 additions & 2 deletions pkg/test/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/client-go/testing"
"k8s.io/utils/set"
)

func EnsureNoActionsForResource(f *testing.Fake, resourceType string, expectedVerbs ...string) {
Expand All @@ -46,7 +46,7 @@ func EnsureActionsForResource(f *testing.Fake, resourceType string, expectedVerb
}

func GetOccurredActionVerbs(f *testing.Fake, resourceType string, expectedVerbs ...string) []string {
expSet := sets.NewString(expectedVerbs...)
expSet := set.New(expectedVerbs...)
verbs := []string{}

subresource := ""
Expand Down

0 comments on commit 572446f

Please sign in to comment.