Compare commits

...

6 Commits

Author SHA1 Message Date
Kubernetes Publisher
9d43434511 Update dependencies to v0.32.1 tag 2025-01-16 00:52:22 +00:00
Kubernetes Publisher
4765adee37 Merge remote-tracking branch 'origin/master' into release-1.32
Kubernetes-commit: 22b14e54a4caac0a20428e51ba874b1af8b0e4cb
2024-12-06 18:37:07 +00:00
Jordan Liggitt
692a511189 Drop use of winreadlinkvolume godebug option
Kubernetes-commit: 3046fe23d4fe4ba86713ffd61bf0e07156b2b7c3
2024-12-06 02:40:53 -05:00
Kubernetes Publisher
9df5099247 Merge remote-tracking branch 'origin/master' into release-1.32
Kubernetes-commit: f5900aab680c34bea040b39ac83dfc48f466b573
2024-12-05 02:29:58 +00:00
Jordan Liggitt
120beb2407 Revert to go1.22 windows filesystem stdlib behavior
Kubernetes-commit: 3878a3a6de64660e356a35f70471c27a09698090
2024-12-04 09:52:56 -05:00
Stephen Kitt
55d23e26d5 Align fake client-go clients with the main interface
"Real" clients use objectWithMeta to enforce support for meta.Object;
strictly speaking, fakes don't need this, but it's best to align them
with the real clients to ensure that fakes don't end up allowing types
that can't be used with the real clients.

Signed-off-by: Stephen Kitt <skitt@redhat.com>

Kubernetes-commit: 736e5560ba6b21247c21f8ed12007e1d6d5fec1a
2024-11-27 16:48:45 +00:00
3 changed files with 18 additions and 16 deletions

View File

@@ -32,7 +32,7 @@ import (
)
// FakeClient represents a fake client
type FakeClient[T runtime.Object] struct {
type FakeClient[T objectWithMeta] struct {
*testing.Fake
ns string
resource schema.GroupVersionResource
@@ -41,26 +41,26 @@ type FakeClient[T runtime.Object] struct {
}
// FakeClientWithList represents a fake client with support for lists.
type FakeClientWithList[T runtime.Object, L runtime.Object] struct {
type FakeClientWithList[T objectWithMeta, L runtime.Object] struct {
*FakeClient[T]
alsoFakeLister[T, L]
}
// FakeClientWithApply represents a fake client with support for apply declarative configurations.
type FakeClientWithApply[T runtime.Object, C namedObject] struct {
type FakeClientWithApply[T objectWithMeta, C namedObject] struct {
*FakeClient[T]
alsoFakeApplier[T, C]
}
// FakeClientWithListAndApply represents a fake client with support for lists and apply declarative configurations.
type FakeClientWithListAndApply[T runtime.Object, L runtime.Object, C namedObject] struct {
type FakeClientWithListAndApply[T objectWithMeta, L runtime.Object, C namedObject] struct {
*FakeClient[T]
alsoFakeLister[T, L]
alsoFakeApplier[T, C]
}
// Helper types for composition
type alsoFakeLister[T runtime.Object, L runtime.Object] struct {
type alsoFakeLister[T objectWithMeta, L runtime.Object] struct {
client *FakeClient[T]
newList func() L
copyListMeta func(L, L)
@@ -68,20 +68,20 @@ type alsoFakeLister[T runtime.Object, L runtime.Object] struct {
setItems func(L, []T)
}
type alsoFakeApplier[T runtime.Object, C namedObject] struct {
type alsoFakeApplier[T objectWithMeta, C namedObject] struct {
client *FakeClient[T]
}
// NewFakeClient constructs a fake client, namespaced or not, with no support for lists or apply.
// Non-namespaced clients are constructed by passing an empty namespace ("").
func NewFakeClient[T runtime.Object](
func NewFakeClient[T objectWithMeta](
fake *testing.Fake, namespace string, resource schema.GroupVersionResource, kind schema.GroupVersionKind, emptyObjectCreator func() T,
) *FakeClient[T] {
return &FakeClient[T]{fake, namespace, resource, kind, emptyObjectCreator}
}
// NewFakeClientWithList constructs a namespaced client with support for lists.
func NewFakeClientWithList[T runtime.Object, L runtime.Object](
func NewFakeClientWithList[T objectWithMeta, L runtime.Object](
fake *testing.Fake, namespace string, resource schema.GroupVersionResource, kind schema.GroupVersionKind, emptyObjectCreator func() T,
emptyListCreator func() L, listMetaCopier func(L, L), itemGetter func(L) []T, itemSetter func(L, []T),
) *FakeClientWithList[T, L] {
@@ -93,7 +93,7 @@ func NewFakeClientWithList[T runtime.Object, L runtime.Object](
}
// NewFakeClientWithApply constructs a namespaced client with support for apply declarative configurations.
func NewFakeClientWithApply[T runtime.Object, C namedObject](
func NewFakeClientWithApply[T objectWithMeta, C namedObject](
fake *testing.Fake, namespace string, resource schema.GroupVersionResource, kind schema.GroupVersionKind, emptyObjectCreator func() T,
) *FakeClientWithApply[T, C] {
fakeClient := NewFakeClient[T](fake, namespace, resource, kind, emptyObjectCreator)
@@ -104,7 +104,7 @@ func NewFakeClientWithApply[T runtime.Object, C namedObject](
}
// NewFakeClientWithListAndApply constructs a client with support for lists and applying declarative configurations.
func NewFakeClientWithListAndApply[T runtime.Object, L runtime.Object, C namedObject](
func NewFakeClientWithListAndApply[T objectWithMeta, L runtime.Object, C namedObject](
fake *testing.Fake, namespace string, resource schema.GroupVersionResource, kind schema.GroupVersionKind, emptyObjectCreator func() T,
emptyListCreator func() L, listMetaCopier func(L, L), itemGetter func(L) []T, itemSetter func(L, []T),
) *FakeClientWithListAndApply[T, L, C] {

6
go.mod
View File

@@ -6,6 +6,8 @@ go 1.23.0
godebug default=go1.23
godebug winsymlink=0
require (
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.4
@@ -26,8 +28,8 @@ require (
golang.org/x/time v0.7.0
google.golang.org/protobuf v1.35.1
gopkg.in/evanphx/json-patch.v4 v4.12.0
k8s.io/api v0.0.0-20241108114318-6cc44b8953ae
k8s.io/apimachinery v0.0.0-20241108022104-96b97de8d6ba
k8s.io/api v0.32.1
k8s.io/apimachinery v0.32.1
k8s.io/klog/v2 v2.130.1
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738

8
go.sum
View File

@@ -150,10 +150,10 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.0.0-20241108114318-6cc44b8953ae h1:XX7vEVBchw0xx4YJZ6OyPxOq3e5hX2PTZ5wu8dw0vco=
k8s.io/api v0.0.0-20241108114318-6cc44b8953ae/go.mod h1:jw6pQTESH9mdZL2vOK3twojvpPxipl5TpLZpPyl5ZYU=
k8s.io/apimachinery v0.0.0-20241108022104-96b97de8d6ba h1:ghB5Iygt6Ge8UyIwW7C1kJx4kP7AUTCL9Qg6GCsUUOY=
k8s.io/apimachinery v0.0.0-20241108022104-96b97de8d6ba/go.mod h1:HqhdaJUgQqky29T1V0o2yFkt/pZqLFIDyn9Zi/8rxoY=
k8s.io/api v0.32.1 h1:f562zw9cy+GvXzXf0CKlVQ7yHJVYzLfL6JAS4kOAaOc=
k8s.io/api v0.32.1/go.mod h1:/Yi/BqkuueW1BgpoePYBRdDYfjPF5sgTr5+YqDZra5k=
k8s.io/apimachinery v0.32.1 h1:683ENpaCBjma4CYqsmZyhEzrGz6cjn1MY/X2jB2hkZs=
k8s.io/apimachinery v0.32.1/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y=