Skip to content

Commit 195e1d0

Browse files
committed
Update expansions for code-generator/v3 output
Signed-off-by: Nelo-T. Wallus <[email protected]>
1 parent 25b4e6e commit 195e1d0

File tree

10 files changed

+74
-47
lines changed

10 files changed

+74
-47
lines changed

kubernetes/typed/certificates/v1beta1/fake/fake_certificatesigningrequest_expansion.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ import (
2222

2323
certificates "k8s.io/api/certificates/v1beta1"
2424
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
25+
"k8s.io/apimachinery/pkg/runtime/schema"
2526

2627
core "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing"
2728
)
2829

29-
func (c *certificateSigningRequestsClient) UpdateApproval(ctx context.Context, certificateSigningRequest *certificates.CertificateSigningRequest, opts metav1.UpdateOptions) (result *certificates.CertificateSigningRequest, err error) {
30+
var certificateSigningRequestsResource = schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1beta1", Resource: "certificatesigningrequests"}
31+
32+
func (c *certificateSigningRequestScopedClient) UpdateApproval(ctx context.Context, certificateSigningRequest *certificates.CertificateSigningRequest, opts metav1.UpdateOptions) (result *certificates.CertificateSigningRequest, err error) {
3033
obj, err := c.Fake.Invokes(core.NewRootUpdateSubresourceAction(certificateSigningRequestsResource, c.ClusterPath, "approval", certificateSigningRequest), &certificates.CertificateSigningRequest{})
3134
if obj == nil {
3235
return nil, err

kubernetes/typed/core/v1/fake/fake_event_expansion.go

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,23 @@ limitations under the License.
1818
package fake
1919

2020
import (
21-
"k8s.io/api/core/v1"
21+
v1 "k8s.io/api/core/v1"
2222
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2323
"k8s.io/apimachinery/pkg/fields"
2424
"k8s.io/apimachinery/pkg/runtime"
25+
"k8s.io/apimachinery/pkg/runtime/schema"
2526
"k8s.io/apimachinery/pkg/types"
2627

2728
core "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing"
2829
)
2930

30-
func (c *eventsClient) CreateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
31+
var eventsResource = schema.GroupVersionResource{Group: "events.k8s.io", Version: "v1beta1", Resource: "events"}
32+
var eventsKind = schema.GroupVersionKind{Group: "events.k8s.io", Version: "v1beta1", Kind: "Event"}
33+
34+
func (c *eventScopedClient) CreateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
3135
action := core.NewRootCreateAction(eventsResource, c.ClusterPath, event)
32-
if c.Namespace != "" {
33-
action = core.NewCreateAction(eventsResource, c.ClusterPath, c.Namespace, event)
36+
if c.Namespace() != "" {
37+
action = core.NewCreateAction(eventsResource, c.ClusterPath, c.Namespace(), event)
3438
}
3539
obj, err := c.Fake.Invokes(action, event)
3640
if obj == nil {
@@ -41,10 +45,10 @@ func (c *eventsClient) CreateWithEventNamespace(event *v1.Event) (*v1.Event, err
4145
}
4246

4347
// Update replaces an existing event. Returns the copy of the event the server returns, or an error.
44-
func (c *eventsClient) UpdateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
48+
func (c *eventScopedClient) UpdateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
4549
action := core.NewRootUpdateAction(eventsResource, c.ClusterPath, event)
46-
if c.Namespace != "" {
47-
action = core.NewUpdateAction(eventsResource, c.ClusterPath, c.Namespace, event)
50+
if c.Namespace() != "" {
51+
action = core.NewUpdateAction(eventsResource, c.ClusterPath, c.Namespace(), event)
4852
}
4953
obj, err := c.Fake.Invokes(action, event)
5054
if obj == nil {
@@ -56,12 +60,12 @@ func (c *eventsClient) UpdateWithEventNamespace(event *v1.Event) (*v1.Event, err
5660

5761
// PatchWithEventNamespace patches an existing event. Returns the copy of the event the server returns, or an error.
5862
// TODO: Should take a PatchType as an argument probably.
59-
func (c *eventsClient) PatchWithEventNamespace(event *v1.Event, data []byte) (*v1.Event, error) {
63+
func (c *eventScopedClient) PatchWithEventNamespace(event *v1.Event, data []byte) (*v1.Event, error) {
6064
// TODO: Should be configurable to support additional patch strategies.
6165
pt := types.StrategicMergePatchType
6266
action := core.NewRootPatchAction(eventsResource, c.ClusterPath, event.Name, pt, data)
63-
if c.Namespace != "" {
64-
action = core.NewPatchAction(eventsResource, c.ClusterPath, c.Namespace, event.Name, pt, data)
67+
if c.Namespace() != "" {
68+
action = core.NewPatchAction(eventsResource, c.ClusterPath, c.Namespace(), event.Name, pt, data)
6569
}
6670
obj, err := c.Fake.Invokes(action, event)
6771
if obj == nil {
@@ -72,10 +76,10 @@ func (c *eventsClient) PatchWithEventNamespace(event *v1.Event, data []byte) (*v
7276
}
7377

7478
// Search returns a list of events matching the specified object.
75-
func (c *eventsClient) Search(scheme *runtime.Scheme, objOrRef runtime.Object) (*v1.EventList, error) {
79+
func (c *eventScopedClient) Search(scheme *runtime.Scheme, objOrRef runtime.Object) (*v1.EventList, error) {
7680
action := core.NewRootListAction(eventsResource, eventsKind, c.ClusterPath, metav1.ListOptions{})
77-
if c.Namespace != "" {
78-
action = core.NewListAction(eventsResource, eventsKind, c.ClusterPath, c.Namespace, metav1.ListOptions{})
81+
if c.Namespace() != "" {
82+
action = core.NewListAction(eventsResource, eventsKind, c.ClusterPath, c.Namespace(), metav1.ListOptions{})
7983
}
8084
obj, err := c.Fake.Invokes(action, &v1.EventList{})
8185
if obj == nil {
@@ -85,7 +89,7 @@ func (c *eventsClient) Search(scheme *runtime.Scheme, objOrRef runtime.Object) (
8589
return obj.(*v1.EventList), err
8690
}
8791

88-
func (c *eventsClient) GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector {
92+
func (c *eventScopedClient) GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector {
8993
action := core.GenericActionImpl{}
9094
action.Verb = "get-field-selector"
9195
action.Resource = eventsResource

kubernetes/typed/core/v1/fake/fake_namespace_expansion.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@ package fake
2020
import (
2121
"context"
2222

23-
"k8s.io/api/core/v1"
23+
v1 "k8s.io/api/core/v1"
2424
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
25+
"k8s.io/apimachinery/pkg/runtime/schema"
2526

2627
core "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing"
2728
)
2829

29-
func (c *namespacesClient) Finalize(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (*v1.Namespace, error) {
30+
var namespacesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "namespaces"}
31+
32+
func (c *namespaceScopedClient) Finalize(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (*v1.Namespace, error) {
3033
action := core.CreateActionImpl{}
3134
action.Verb = "create"
3235
action.Resource = namespacesResource

kubernetes/typed/core/v1/fake/fake_node_expansion.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ import (
2121
"context"
2222

2323
v1 "k8s.io/api/core/v1"
24+
"k8s.io/apimachinery/pkg/runtime/schema"
2425
"k8s.io/apimachinery/pkg/types"
2526

2627
core "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing"
2728
)
2829

30+
var nodesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "nodes"}
31+
2932
// TODO: Should take a PatchType as an argument probably.
30-
func (c *nodesClient) PatchStatus(_ context.Context, nodeName string, data []byte) (*v1.Node, error) {
33+
func (c *nodeScopedClient) PatchStatus(_ context.Context, nodeName string, data []byte) (*v1.Node, error) {
3134
// TODO: Should be configurable to support additional patch strategies.
3235
pt := types.StrategicMergePatchType
3336
obj, err := c.Fake.Invokes(core.NewRootPatchSubresourceAction(nodesResource, c.ClusterPath, nodeName, pt, data, "status"), &v1.Node{})

kubernetes/typed/core/v1/fake/fake_pod_expansion.go

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ import (
2828
policyv1 "k8s.io/api/policy/v1"
2929
policyv1beta1 "k8s.io/api/policy/v1beta1"
3030
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
31+
"k8s.io/apimachinery/pkg/runtime/schema"
3132
"k8s.io/client-go/kubernetes/scheme"
3233
restclient "k8s.io/client-go/rest"
3334
fakerest "k8s.io/client-go/rest/fake"
3435

3536
core "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing"
3637
)
3738

38-
func (c *podsClient) Bind(ctx context.Context, binding *v1.Binding, opts metav1.CreateOptions) error {
39+
var podsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}
40+
var podsKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Pod"}
41+
42+
func (c *podScopedClient) Bind(ctx context.Context, binding *v1.Binding, opts metav1.CreateOptions) error {
3943
action := core.CreateActionImpl{}
4044
action.Verb = "create"
4145
action.Namespace = binding.Namespace
@@ -48,20 +52,20 @@ func (c *podsClient) Bind(ctx context.Context, binding *v1.Binding, opts metav1.
4852
return err
4953
}
5054

51-
func (c *podsClient) GetBinding(name string) (result *v1.Binding, err error) {
55+
func (c *podScopedClient) GetBinding(name string) (result *v1.Binding, err error) {
5256
obj, err := c.Fake.
53-
Invokes(core.NewGetSubresourceAction(podsResource, c.ClusterPath, c.Namespace, "binding", name), &v1.Binding{})
57+
Invokes(core.NewGetSubresourceAction(podsResource, c.ClusterPath, c.Namespace(), "binding", name), &v1.Binding{})
5458

5559
if obj == nil {
5660
return nil, err
5761
}
5862
return obj.(*v1.Binding), err
5963
}
6064

61-
func (c *podsClient) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request {
65+
func (c *podScopedClient) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request {
6266
action := core.GenericActionImpl{}
6367
action.Verb = "get"
64-
action.Namespace = c.Namespace
68+
action.Namespace = c.Namespace()
6569
action.Resource = podsResource
6670
action.Subresource = "log"
6771
action.Value = opts
@@ -78,19 +82,19 @@ func (c *podsClient) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Re
7882
}),
7983
NegotiatedSerializer: scheme.Codecs.WithoutConversion(),
8084
GroupVersion: podsKind.GroupVersion(),
81-
VersionedAPIPath: fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/log", c.Namespace, name),
85+
VersionedAPIPath: fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/log", c.Namespace(), name),
8286
}
8387
return fakeClient.Request()
8488
}
8589

86-
func (c *podsClient) Evict(ctx context.Context, eviction *policyv1beta1.Eviction) error {
90+
func (c *podScopedClient) Evict(ctx context.Context, eviction *policyv1beta1.Eviction) error {
8791
return c.EvictV1beta1(ctx, eviction)
8892
}
8993

90-
func (c *podsClient) EvictV1(ctx context.Context, eviction *policyv1.Eviction) error {
94+
func (c *podScopedClient) EvictV1(ctx context.Context, eviction *policyv1.Eviction) error {
9195
action := core.CreateActionImpl{}
9296
action.Verb = "create"
93-
action.Namespace = c.Namespace
97+
action.Namespace = c.Namespace()
9498
action.Resource = podsResource
9599
action.Subresource = "eviction"
96100
action.Object = eviction
@@ -100,10 +104,10 @@ func (c *podsClient) EvictV1(ctx context.Context, eviction *policyv1.Eviction) e
100104
return err
101105
}
102106

103-
func (c *podsClient) EvictV1beta1(ctx context.Context, eviction *policyv1beta1.Eviction) error {
107+
func (c *podScopedClient) EvictV1beta1(ctx context.Context, eviction *policyv1beta1.Eviction) error {
104108
action := core.CreateActionImpl{}
105109
action.Verb = "create"
106-
action.Namespace = c.Namespace
110+
action.Namespace = c.Namespace()
107111
action.Resource = podsResource
108112
action.Subresource = "eviction"
109113
action.Object = eviction
@@ -113,6 +117,6 @@ func (c *podsClient) EvictV1beta1(ctx context.Context, eviction *policyv1beta1.E
113117
return err
114118
}
115119

116-
func (c *podsClient) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper {
117-
return c.Fake.InvokesProxy(core.NewProxyGetAction(podsResource, c.ClusterPath, c.Namespace, scheme, name, port, path, params))
120+
func (c *podScopedClient) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper {
121+
return c.Fake.InvokesProxy(core.NewProxyGetAction(podsResource, c.ClusterPath, c.Namespace(), scheme, name, port, path, params))
118122
}

kubernetes/typed/core/v1/fake/fake_service_expansion.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ limitations under the License.
1818
package fake
1919

2020
import (
21+
"k8s.io/apimachinery/pkg/runtime/schema"
2122
restclient "k8s.io/client-go/rest"
2223

2324
core "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing"
2425
)
2526

26-
func (c *servicesClient) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper {
27-
return c.Fake.InvokesProxy(core.NewProxyGetAction(servicesResource, c.ClusterPath, c.Namespace, scheme, name, port, path, params))
27+
var servicesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "services"}
28+
29+
func (c *serviceScopedClient) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper {
30+
return c.Fake.InvokesProxy(core.NewProxyGetAction(servicesResource, c.ClusterPath, c.Namespace(), scheme, name, port, path, params))
2831
}

kubernetes/typed/events/v1beta1/fake/fake_event_expansion.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,19 @@ package fake
1919

2020
import (
2121
"k8s.io/api/events/v1beta1"
22+
"k8s.io/apimachinery/pkg/runtime/schema"
2223
"k8s.io/apimachinery/pkg/types"
2324

2425
core "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing"
2526
)
2627

28+
var eventsResource = schema.GroupVersionResource{Group: "events.k8s.io", Version: "v1beta1", Resource: "events"}
29+
2730
// CreateWithEventNamespace creats a new event. Returns the copy of the event the server returns, or an error.
28-
func (c *eventsClient) CreateWithEventNamespace(event *v1beta1.Event) (*v1beta1.Event, error) {
31+
func (c *eventScopedClient) CreateWithEventNamespace(event *v1beta1.Event) (*v1beta1.Event, error) {
2932
action := core.NewRootCreateAction(eventsResource, c.ClusterPath, event)
30-
if c.Namespace != "" {
31-
action = core.NewCreateAction(eventsResource, c.ClusterPath, c.Namespace, event)
33+
if c.Namespace() != "" {
34+
action = core.NewCreateAction(eventsResource, c.ClusterPath, c.Namespace(), event)
3235
}
3336
obj, err := c.Fake.Invokes(action, event)
3437
if obj == nil {
@@ -39,10 +42,10 @@ func (c *eventsClient) CreateWithEventNamespace(event *v1beta1.Event) (*v1beta1.
3942
}
4043

4144
// UpdateWithEventNamespace replaces an existing event. Returns the copy of the event the server returns, or an error.
42-
func (c *eventsClient) UpdateWithEventNamespace(event *v1beta1.Event) (*v1beta1.Event, error) {
45+
func (c *eventScopedClient) UpdateWithEventNamespace(event *v1beta1.Event) (*v1beta1.Event, error) {
4346
action := core.NewRootUpdateAction(eventsResource, c.ClusterPath, event)
44-
if c.Namespace != "" {
45-
action = core.NewUpdateAction(eventsResource, c.ClusterPath, c.Namespace, event)
47+
if c.Namespace() != "" {
48+
action = core.NewUpdateAction(eventsResource, c.ClusterPath, c.Namespace(), event)
4649
}
4750
obj, err := c.Fake.Invokes(action, event)
4851
if obj == nil {
@@ -53,11 +56,11 @@ func (c *eventsClient) UpdateWithEventNamespace(event *v1beta1.Event) (*v1beta1.
5356
}
5457

5558
// PatchWithEventNamespace patches an existing event. Returns the copy of the event the server returns, or an error.
56-
func (c *eventsClient) PatchWithEventNamespace(event *v1beta1.Event, data []byte) (*v1beta1.Event, error) {
59+
func (c *eventScopedClient) PatchWithEventNamespace(event *v1beta1.Event, data []byte) (*v1beta1.Event, error) {
5760
pt := types.StrategicMergePatchType
5861
action := core.NewRootPatchAction(eventsResource, c.ClusterPath, event.Name, pt, data)
59-
if c.Namespace != "" {
60-
action = core.NewPatchAction(eventsResource, c.ClusterPath, c.Namespace, event.Name, pt, data)
62+
if c.Namespace() != "" {
63+
action = core.NewPatchAction(eventsResource, c.ClusterPath, c.Namespace(), event.Name, pt, data)
6164
}
6265
obj, err := c.Fake.Invokes(action, event)
6366
if obj == nil {

kubernetes/typed/extensions/v1beta1/fake/fake_deployment_expansion.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ import (
2222

2323
"k8s.io/api/extensions/v1beta1"
2424
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
25+
"k8s.io/apimachinery/pkg/runtime/schema"
2526

2627
core "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing"
2728
)
2829

29-
func (c *deploymentsClient) Rollback(ctx context.Context, deploymentRollback *v1beta1.DeploymentRollback, opts metav1.CreateOptions) error {
30+
var deploymentsResource = schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "deployments"}
31+
var deploymentsKind = schema.GroupVersionKind{Group: "extensions", Version: "v1beta1", Kind: "Deployment"}
32+
33+
func (c *deploymentScopedClient) Rollback(ctx context.Context, deploymentRollback *v1beta1.DeploymentRollback, opts metav1.CreateOptions) error {
3034
action := core.CreateActionImpl{}
3135
action.Verb = "create"
3236
action.Resource = deploymentsResource

kubernetes/typed/policy/v1/fake/fake_eviction_expansion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ import (
2626
core "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing"
2727
)
2828

29-
func (c *evictionsClient) Evict(ctx context.Context, eviction *policy.Eviction) error {
29+
func (c *evictionScopedClient) Evict(ctx context.Context, eviction *policy.Eviction) error {
3030
action := core.CreateActionImpl{}
3131
action.Verb = "create"
32-
action.Namespace = c.Namespace
32+
action.Namespace = c.Namespace()
3333
action.ClusterPath = c.ClusterPath
3434
action.Resource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}
3535
action.Subresource = "eviction"

kubernetes/typed/policy/v1beta1/fake/fake_eviction_expansion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ import (
2626
core "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing"
2727
)
2828

29-
func (c *evictionsClient) Evict(ctx context.Context, eviction *policy.Eviction) error {
29+
func (c *evictionScopedClient) Evict(ctx context.Context, eviction *policy.Eviction) error {
3030
action := core.CreateActionImpl{}
3131
action.Verb = "create"
32-
action.Namespace = c.Namespace
32+
action.Namespace = c.Namespace()
3333
action.ClusterPath = c.ClusterPath
3434
action.Resource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}
3535
action.Subresource = "eviction"

0 commit comments

Comments
 (0)