mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 11:18:16 +00:00
Merge pull request #125314 from enj/enj/i/proto_for_core
Use protobuf for core clients
This commit is contained in:
@@ -73,12 +73,14 @@ func Test_buildClientCertificateManager(t *testing.T) {
|
||||
defer s.Close()
|
||||
|
||||
config1 := &restclient.Config{
|
||||
UserAgent: "FirstClient",
|
||||
Host: s.URL,
|
||||
UserAgent: "FirstClient",
|
||||
Host: s.URL,
|
||||
ContentConfig: restclient.ContentConfig{ContentType: runtime.ContentTypeJSON},
|
||||
}
|
||||
config2 := &restclient.Config{
|
||||
UserAgent: "SecondClient",
|
||||
Host: s.URL,
|
||||
UserAgent: "SecondClient",
|
||||
Host: s.URL,
|
||||
ContentConfig: restclient.ContentConfig{ContentType: runtime.ContentTypeJSON},
|
||||
}
|
||||
|
||||
nodeName := types.NodeName("test")
|
||||
|
||||
@@ -645,6 +645,7 @@ function codegen::clients() {
|
||||
--input-base="k8s.io/api" \
|
||||
--plural-exceptions "${PLURAL_EXCEPTIONS}" \
|
||||
--apply-configuration-package "${APPLYCONFIG_PKG}" \
|
||||
--prefers-protobuf \
|
||||
$(printf -- " --input %s" "${gv_dirs[@]}") \
|
||||
"$@"
|
||||
|
||||
|
||||
186
pkg/client/tests/clientset_test.go
Normal file
186
pkg/client/tests/clientset_test.go
Normal file
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
Copyright 2024 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package tests
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
crv1 "k8s.io/apiextensions-apiserver/examples/client-go/pkg/apis/cr/v1"
|
||||
crv1client "k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/clientset/versioned"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
func TestClientContentType(t *testing.T) {
|
||||
createPodFunc := func(t *testing.T, config *rest.Config) {
|
||||
client, err := kubernetes.NewForConfig(config)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create REST client: %v", err)
|
||||
}
|
||||
|
||||
_, err = client.CoreV1().Pods("panda").
|
||||
Create(context.TODO(), &corev1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "snorlax"}}, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
updateScaleFunc := func(t *testing.T, config *rest.Config) {
|
||||
client, err := kubernetes.NewForConfig(config)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create REST client: %v", err)
|
||||
}
|
||||
|
||||
_, err = client.AppsV1().Deployments("panda").
|
||||
UpdateScale(context.TODO(), "snorlax", &autoscalingv1.Scale{ObjectMeta: metav1.ObjectMeta{Name: "snorlax"}}, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
createExampleViaRESTClientFunc := func(t *testing.T, config *rest.Config) {
|
||||
kubeClient, err := kubernetes.NewForConfig(config)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create REST client: %v", err)
|
||||
}
|
||||
|
||||
client := crv1client.New(kubeClient.CoreV1().RESTClient())
|
||||
|
||||
_, err = client.CrV1().Examples("panda").
|
||||
Create(context.TODO(), &crv1.Example{ObjectMeta: metav1.ObjectMeta{Name: "snorlax"}}, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
createFunc func(*testing.T, *rest.Config)
|
||||
contentType string
|
||||
expectedPath string
|
||||
expectContentType string
|
||||
expectBody string
|
||||
}{
|
||||
{
|
||||
name: "default",
|
||||
createFunc: createPodFunc,
|
||||
contentType: "",
|
||||
expectedPath: "/api/v1/namespaces/panda/pods",
|
||||
expectContentType: "application/vnd.kubernetes.protobuf",
|
||||
expectBody: "k8s\x00\n\t\n\x02v1\x12\x03Pod\x12I\n\x17\n\asnorlax\x12\x00\x1a\x00\"\x00*\x002\x008\x00B\x00\x12\x1c\x1a\x002\x00B\x00J\x00R\x00X\x00`\x00h\x00\x82\x01\x00\x8a\x01\x00\x9a\x01\x00\xc2\x01\x00\x1a\x10\n\x00\x1a\x00\"\x00*\x002\x00J\x00Z\x00r\x00\x1a\x00\"\x00",
|
||||
},
|
||||
{
|
||||
name: "json",
|
||||
createFunc: createPodFunc,
|
||||
contentType: "application/json",
|
||||
expectedPath: "/api/v1/namespaces/panda/pods",
|
||||
expectContentType: "application/json",
|
||||
expectBody: `{"kind":"Pod","apiVersion":"v1","metadata":{"name":"snorlax","creationTimestamp":null},"spec":{"containers":null},"status":{}}
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: "default update scale",
|
||||
createFunc: updateScaleFunc,
|
||||
contentType: "",
|
||||
expectedPath: "/apis/apps/v1/namespaces/panda/deployments/snorlax/scale",
|
||||
expectContentType: "application/vnd.kubernetes.protobuf",
|
||||
expectBody: "k8s\u0000\n\u0017\n\u000Eautoscaling/v1\u0012\u0005Scale\u0012#\n\u0017\n\asnorlax\u0012\u0000\u001A\u0000\"\u0000*\u00002\u00008\u0000B\u0000\u0012\u0002\b\u0000\u001A\u0004\b\u0000\u0012\u0000\u001A\u0000\"\u0000",
|
||||
},
|
||||
{
|
||||
name: "json update scale",
|
||||
createFunc: updateScaleFunc,
|
||||
contentType: "application/json",
|
||||
expectedPath: "/apis/apps/v1/namespaces/panda/deployments/snorlax/scale",
|
||||
expectContentType: "application/json",
|
||||
expectBody: `{"kind":"Scale","apiVersion":"autoscaling/v1","metadata":{"name":"snorlax","creationTimestamp":null},"spec":{},"status":{"replicas":0}}
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: "default via RESTClient",
|
||||
createFunc: createExampleViaRESTClientFunc,
|
||||
contentType: "",
|
||||
expectedPath: "/api/v1/namespaces/panda/examples",
|
||||
expectContentType: "application/json",
|
||||
expectBody: `{"metadata":{"name":"snorlax","creationTimestamp":null},"spec":{"foo":"","bar":false},"status":{}}
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: "json via RESTClient",
|
||||
createFunc: createExampleViaRESTClientFunc,
|
||||
contentType: "application/json",
|
||||
expectedPath: "/api/v1/namespaces/panda/examples",
|
||||
expectContentType: "application/json",
|
||||
expectBody: `{"metadata":{"name":"snorlax","creationTimestamp":null},"spec":{"foo":"","bar":false},"status":{}}
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
var calls atomic.Uint64
|
||||
ts := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
calls.Add(1)
|
||||
|
||||
if got, want := r.URL.Path, tc.expectedPath; got != want {
|
||||
t.Errorf("unexpected path, got=%q, want=%q", got, want)
|
||||
}
|
||||
|
||||
if got, want := r.Header.Get("content-type"), tc.expectContentType; got != want {
|
||||
t.Errorf("unexpected content-type, got=%q, want=%q", got, want)
|
||||
}
|
||||
|
||||
if r.Body == nil {
|
||||
t.Fatal("request body is nil")
|
||||
}
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_ = r.Body.Close()
|
||||
if diff := cmp.Diff(tc.expectBody, string(body)); len(diff) > 0 {
|
||||
t.Errorf("body diff (-want, +got):\n%s", diff)
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_, _ = w.Write([]byte("{}"))
|
||||
}))
|
||||
ts.Start()
|
||||
defer ts.Close()
|
||||
|
||||
config := &rest.Config{
|
||||
Host: ts.URL,
|
||||
ContentConfig: rest.ContentConfig{ContentType: tc.contentType},
|
||||
}
|
||||
|
||||
tc.createFunc(t, config)
|
||||
|
||||
if calls.Load() != 1 {
|
||||
t.Errorf("unexpected handler call count: %d", calls.Load())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -375,7 +375,7 @@ func TestCreatePodsWithGenerateName(t *testing.T) {
|
||||
}
|
||||
testServer := httptest.NewServer(&fakeHandler)
|
||||
defer testServer.Close()
|
||||
clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: testServer.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}})
|
||||
clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: testServer.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}, ContentType: runtime.ContentTypeJSON}})
|
||||
|
||||
podControl := RealPodControl{
|
||||
KubeClient: clientset,
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
@@ -225,7 +226,7 @@ type endpointController struct {
|
||||
}
|
||||
|
||||
func newController(ctx context.Context, url string, batchPeriod time.Duration) *endpointController {
|
||||
client := clientset.NewForConfigOrDie(&restclient.Config{Host: url, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}})
|
||||
client := clientset.NewForConfigOrDie(&restclient.Config{Host: url, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}, ContentType: runtime.ContentTypeJSON}})
|
||||
informerFactory := informers.NewSharedInformerFactory(client, controllerpkg.NoResyncPeriodFunc())
|
||||
endpoints := NewEndpointController(ctx, informerFactory.Core().V1().Pods(), informerFactory.Core().V1().Services(),
|
||||
informerFactory.Core().V1().Endpoints(), client, batchPeriod)
|
||||
|
||||
@@ -64,6 +64,7 @@ func newExamples(c *CrV1Client, namespace string) *examples {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *crv1.Example { return &crv1.Example{} },
|
||||
func() *crv1.ExampleList { return &crv1.ExampleList{} }),
|
||||
func() *crv1.ExampleList { return &crv1.ExampleList{} },
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,4 +52,5 @@ kube::codegen::gen_client \
|
||||
--output-pkg "${THIS_PKG}/pkg/client" \
|
||||
--versioned-name "clientset" \
|
||||
--boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||
--prefers-protobuf \
|
||||
"${SCRIPT_ROOT}/pkg/apis"
|
||||
|
||||
@@ -70,6 +70,8 @@ func newCustomResourceDefinitions(c *ApiextensionsV1Client) *customResourceDefin
|
||||
func() *apiextensionsv1.CustomResourceDefinition { return &apiextensionsv1.CustomResourceDefinition{} },
|
||||
func() *apiextensionsv1.CustomResourceDefinitionList {
|
||||
return &apiextensionsv1.CustomResourceDefinitionList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*apiextensionsv1.CustomResourceDefinition](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ func newCustomResourceDefinitions(c *ApiextensionsV1beta1Client) *customResource
|
||||
},
|
||||
func() *apiextensionsv1beta1.CustomResourceDefinitionList {
|
||||
return &apiextensionsv1beta1.CustomResourceDefinitionList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*apiextensionsv1beta1.CustomResourceDefinition](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,8 @@ type Client[T objectWithMeta] struct {
|
||||
namespace string // "" for non-namespaced clients
|
||||
newObject func() T
|
||||
parameterCodec runtime.ParameterCodec
|
||||
|
||||
prefersProtobuf bool
|
||||
}
|
||||
|
||||
// ClientWithList represents a client with support for lists.
|
||||
@@ -82,26 +84,37 @@ type alsoApplier[T objectWithMeta, C namedObject] struct {
|
||||
client *Client[T]
|
||||
}
|
||||
|
||||
type Option[T objectWithMeta] func(*Client[T])
|
||||
|
||||
func PrefersProtobuf[T objectWithMeta]() Option[T] {
|
||||
return func(c *Client[T]) { c.prefersProtobuf = true }
|
||||
}
|
||||
|
||||
// NewClient constructs a client, namespaced or not, with no support for lists or apply.
|
||||
// Non-namespaced clients are constructed by passing an empty namespace ("").
|
||||
func NewClient[T objectWithMeta](
|
||||
resource string, client rest.Interface, parameterCodec runtime.ParameterCodec, namespace string, emptyObjectCreator func() T,
|
||||
options ...Option[T],
|
||||
) *Client[T] {
|
||||
return &Client[T]{
|
||||
c := &Client[T]{
|
||||
resource: resource,
|
||||
client: client,
|
||||
parameterCodec: parameterCodec,
|
||||
namespace: namespace,
|
||||
newObject: emptyObjectCreator,
|
||||
}
|
||||
for _, option := range options {
|
||||
option(c)
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
// NewClientWithList constructs a namespaced client with support for lists.
|
||||
func NewClientWithList[T objectWithMeta, L runtime.Object](
|
||||
resource string, client rest.Interface, parameterCodec runtime.ParameterCodec, namespace string, emptyObjectCreator func() T,
|
||||
emptyListCreator func() L,
|
||||
emptyListCreator func() L, options ...Option[T],
|
||||
) *ClientWithList[T, L] {
|
||||
typeClient := NewClient[T](resource, client, parameterCodec, namespace, emptyObjectCreator)
|
||||
typeClient := NewClient[T](resource, client, parameterCodec, namespace, emptyObjectCreator, options...)
|
||||
return &ClientWithList[T, L]{
|
||||
typeClient,
|
||||
alsoLister[T, L]{typeClient, emptyListCreator},
|
||||
@@ -111,8 +124,9 @@ func NewClientWithList[T objectWithMeta, L runtime.Object](
|
||||
// NewClientWithApply constructs a namespaced client with support for apply declarative configurations.
|
||||
func NewClientWithApply[T objectWithMeta, C namedObject](
|
||||
resource string, client rest.Interface, parameterCodec runtime.ParameterCodec, namespace string, emptyObjectCreator func() T,
|
||||
options ...Option[T],
|
||||
) *ClientWithApply[T, C] {
|
||||
typeClient := NewClient[T](resource, client, parameterCodec, namespace, emptyObjectCreator)
|
||||
typeClient := NewClient[T](resource, client, parameterCodec, namespace, emptyObjectCreator, options...)
|
||||
return &ClientWithApply[T, C]{
|
||||
typeClient,
|
||||
alsoApplier[T, C]{typeClient},
|
||||
@@ -122,9 +136,9 @@ func NewClientWithApply[T objectWithMeta, C namedObject](
|
||||
// NewClientWithListAndApply constructs a client with support for lists and applying declarative configurations.
|
||||
func NewClientWithListAndApply[T objectWithMeta, L runtime.Object, C namedObject](
|
||||
resource string, client rest.Interface, parameterCodec runtime.ParameterCodec, namespace string, emptyObjectCreator func() T,
|
||||
emptyListCreator func() L,
|
||||
emptyListCreator func() L, options ...Option[T],
|
||||
) *ClientWithListAndApply[T, L, C] {
|
||||
typeClient := NewClient[T](resource, client, parameterCodec, namespace, emptyObjectCreator)
|
||||
typeClient := NewClient[T](resource, client, parameterCodec, namespace, emptyObjectCreator, options...)
|
||||
return &ClientWithListAndApply[T, L, C]{
|
||||
typeClient,
|
||||
alsoLister[T, L]{typeClient, emptyListCreator},
|
||||
@@ -146,6 +160,7 @@ func (c *Client[T]) GetNamespace() string {
|
||||
func (c *Client[T]) Get(ctx context.Context, name string, options metav1.GetOptions) (T, error) {
|
||||
result := c.newObject()
|
||||
err := c.client.Get().
|
||||
UseProtobufAsDefaultIfPreferred(c.prefersProtobuf).
|
||||
NamespaceIfScoped(c.namespace, c.namespace != "").
|
||||
Resource(c.resource).
|
||||
Name(name).
|
||||
@@ -181,6 +196,7 @@ func (l *alsoLister[T, L]) list(ctx context.Context, opts metav1.ListOptions) (L
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
err := l.client.client.Get().
|
||||
UseProtobufAsDefaultIfPreferred(l.client.prefersProtobuf).
|
||||
NamespaceIfScoped(l.client.namespace, l.client.namespace != "").
|
||||
Resource(l.client.resource).
|
||||
VersionedParams(&opts, l.client.parameterCodec).
|
||||
@@ -198,6 +214,7 @@ func (l *alsoLister[T, L]) watchList(ctx context.Context, opts metav1.ListOption
|
||||
}
|
||||
result = l.newList()
|
||||
err = l.client.client.Get().
|
||||
UseProtobufAsDefaultIfPreferred(l.client.prefersProtobuf).
|
||||
NamespaceIfScoped(l.client.namespace, l.client.namespace != "").
|
||||
Resource(l.client.resource).
|
||||
VersionedParams(&opts, l.client.parameterCodec).
|
||||
@@ -215,6 +232,7 @@ func (c *Client[T]) Watch(ctx context.Context, opts metav1.ListOptions) (watch.I
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
UseProtobufAsDefaultIfPreferred(c.prefersProtobuf).
|
||||
NamespaceIfScoped(c.namespace, c.namespace != "").
|
||||
Resource(c.resource).
|
||||
VersionedParams(&opts, c.parameterCodec).
|
||||
@@ -226,6 +244,7 @@ func (c *Client[T]) Watch(ctx context.Context, opts metav1.ListOptions) (watch.I
|
||||
func (c *Client[T]) Create(ctx context.Context, obj T, opts metav1.CreateOptions) (T, error) {
|
||||
result := c.newObject()
|
||||
err := c.client.Post().
|
||||
UseProtobufAsDefaultIfPreferred(c.prefersProtobuf).
|
||||
NamespaceIfScoped(c.namespace, c.namespace != "").
|
||||
Resource(c.resource).
|
||||
VersionedParams(&opts, c.parameterCodec).
|
||||
@@ -239,6 +258,7 @@ func (c *Client[T]) Create(ctx context.Context, obj T, opts metav1.CreateOptions
|
||||
func (c *Client[T]) Update(ctx context.Context, obj T, opts metav1.UpdateOptions) (T, error) {
|
||||
result := c.newObject()
|
||||
err := c.client.Put().
|
||||
UseProtobufAsDefaultIfPreferred(c.prefersProtobuf).
|
||||
NamespaceIfScoped(c.namespace, c.namespace != "").
|
||||
Resource(c.resource).
|
||||
Name(obj.GetName()).
|
||||
@@ -253,6 +273,7 @@ func (c *Client[T]) Update(ctx context.Context, obj T, opts metav1.UpdateOptions
|
||||
func (c *Client[T]) UpdateStatus(ctx context.Context, obj T, opts metav1.UpdateOptions) (T, error) {
|
||||
result := c.newObject()
|
||||
err := c.client.Put().
|
||||
UseProtobufAsDefaultIfPreferred(c.prefersProtobuf).
|
||||
NamespaceIfScoped(c.namespace, c.namespace != "").
|
||||
Resource(c.resource).
|
||||
Name(obj.GetName()).
|
||||
@@ -267,6 +288,7 @@ func (c *Client[T]) UpdateStatus(ctx context.Context, obj T, opts metav1.UpdateO
|
||||
// Delete takes name of the resource and deletes it. Returns an error if one occurs.
|
||||
func (c *Client[T]) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
UseProtobufAsDefaultIfPreferred(c.prefersProtobuf).
|
||||
NamespaceIfScoped(c.namespace, c.namespace != "").
|
||||
Resource(c.resource).
|
||||
Name(name).
|
||||
@@ -282,6 +304,7 @@ func (l *alsoLister[T, L]) DeleteCollection(ctx context.Context, opts metav1.Del
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return l.client.client.Delete().
|
||||
UseProtobufAsDefaultIfPreferred(l.client.prefersProtobuf).
|
||||
NamespaceIfScoped(l.client.namespace, l.client.namespace != "").
|
||||
Resource(l.client.resource).
|
||||
VersionedParams(&listOpts, l.client.parameterCodec).
|
||||
@@ -295,6 +318,7 @@ func (l *alsoLister[T, L]) DeleteCollection(ctx context.Context, opts metav1.Del
|
||||
func (c *Client[T]) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (T, error) {
|
||||
result := c.newObject()
|
||||
err := c.client.Patch(pt).
|
||||
UseProtobufAsDefaultIfPreferred(c.prefersProtobuf).
|
||||
NamespaceIfScoped(c.namespace, c.namespace != "").
|
||||
Resource(c.resource).
|
||||
Name(name).
|
||||
@@ -321,6 +345,7 @@ func (a *alsoApplier[T, C]) Apply(ctx context.Context, obj C, opts metav1.ApplyO
|
||||
return *new(T), fmt.Errorf("obj.Name must be provided to Apply")
|
||||
}
|
||||
err = a.client.client.Patch(types.ApplyPatchType).
|
||||
UseProtobufAsDefaultIfPreferred(a.client.prefersProtobuf).
|
||||
NamespaceIfScoped(a.client.namespace, a.client.namespace != "").
|
||||
Resource(a.client.resource).
|
||||
Name(*obj.GetName()).
|
||||
@@ -348,6 +373,7 @@ func (a *alsoApplier[T, C]) ApplyStatus(ctx context.Context, obj C, opts metav1.
|
||||
|
||||
result := a.client.newObject()
|
||||
err = a.client.client.Patch(types.ApplyPatchType).
|
||||
UseProtobufAsDefaultIfPreferred(a.client.prefersProtobuf).
|
||||
NamespaceIfScoped(a.client.namespace, a.client.namespace != "").
|
||||
Resource(a.client.resource).
|
||||
Name(*obj.GetName()).
|
||||
|
||||
@@ -68,6 +68,8 @@ func newMutatingWebhookConfigurations(c *AdmissionregistrationV1Client) *mutatin
|
||||
},
|
||||
func() *admissionregistrationv1.MutatingWebhookConfigurationList {
|
||||
return &admissionregistrationv1.MutatingWebhookConfigurationList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*admissionregistrationv1.MutatingWebhookConfiguration](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ func newValidatingAdmissionPolicies(c *AdmissionregistrationV1Client) *validatin
|
||||
},
|
||||
func() *admissionregistrationv1.ValidatingAdmissionPolicyList {
|
||||
return &admissionregistrationv1.ValidatingAdmissionPolicyList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*admissionregistrationv1.ValidatingAdmissionPolicy](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newValidatingAdmissionPolicyBindings(c *AdmissionregistrationV1Client) *val
|
||||
},
|
||||
func() *admissionregistrationv1.ValidatingAdmissionPolicyBindingList {
|
||||
return &admissionregistrationv1.ValidatingAdmissionPolicyBindingList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*admissionregistrationv1.ValidatingAdmissionPolicyBinding](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newValidatingWebhookConfigurations(c *AdmissionregistrationV1Client) *valid
|
||||
},
|
||||
func() *admissionregistrationv1.ValidatingWebhookConfigurationList {
|
||||
return &admissionregistrationv1.ValidatingWebhookConfigurationList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*admissionregistrationv1.ValidatingWebhookConfiguration](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ func newValidatingAdmissionPolicies(c *AdmissionregistrationV1alpha1Client) *val
|
||||
},
|
||||
func() *admissionregistrationv1alpha1.ValidatingAdmissionPolicyList {
|
||||
return &admissionregistrationv1alpha1.ValidatingAdmissionPolicyList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*admissionregistrationv1alpha1.ValidatingAdmissionPolicy](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newValidatingAdmissionPolicyBindings(c *AdmissionregistrationV1alpha1Client
|
||||
},
|
||||
func() *admissionregistrationv1alpha1.ValidatingAdmissionPolicyBindingList {
|
||||
return &admissionregistrationv1alpha1.ValidatingAdmissionPolicyBindingList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*admissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newMutatingWebhookConfigurations(c *AdmissionregistrationV1beta1Client) *mu
|
||||
},
|
||||
func() *admissionregistrationv1beta1.MutatingWebhookConfigurationList {
|
||||
return &admissionregistrationv1beta1.MutatingWebhookConfigurationList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*admissionregistrationv1beta1.MutatingWebhookConfiguration](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ func newValidatingAdmissionPolicies(c *AdmissionregistrationV1beta1Client) *vali
|
||||
},
|
||||
func() *admissionregistrationv1beta1.ValidatingAdmissionPolicyList {
|
||||
return &admissionregistrationv1beta1.ValidatingAdmissionPolicyList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*admissionregistrationv1beta1.ValidatingAdmissionPolicy](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newValidatingAdmissionPolicyBindings(c *AdmissionregistrationV1beta1Client)
|
||||
},
|
||||
func() *admissionregistrationv1beta1.ValidatingAdmissionPolicyBindingList {
|
||||
return &admissionregistrationv1beta1.ValidatingAdmissionPolicyBindingList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*admissionregistrationv1beta1.ValidatingAdmissionPolicyBinding](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newValidatingWebhookConfigurations(c *AdmissionregistrationV1beta1Client) *
|
||||
},
|
||||
func() *admissionregistrationv1beta1.ValidatingWebhookConfigurationList {
|
||||
return &admissionregistrationv1beta1.ValidatingWebhookConfigurationList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*admissionregistrationv1beta1.ValidatingWebhookConfiguration](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,8 @@ func newStorageVersions(c *InternalV1alpha1Client) *storageVersions {
|
||||
func() *apiserverinternalv1alpha1.StorageVersion { return &apiserverinternalv1alpha1.StorageVersion{} },
|
||||
func() *apiserverinternalv1alpha1.StorageVersionList {
|
||||
return &apiserverinternalv1alpha1.StorageVersionList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*apiserverinternalv1alpha1.StorageVersion](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newControllerRevisions(c *AppsV1Client, namespace string) *controllerRevisi
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *appsv1.ControllerRevision { return &appsv1.ControllerRevision{} },
|
||||
func() *appsv1.ControllerRevisionList { return &appsv1.ControllerRevisionList{} }),
|
||||
func() *appsv1.ControllerRevisionList { return &appsv1.ControllerRevisionList{} },
|
||||
gentype.PrefersProtobuf[*appsv1.ControllerRevision](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newDaemonSets(c *AppsV1Client, namespace string) *daemonSets {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *appsv1.DaemonSet { return &appsv1.DaemonSet{} },
|
||||
func() *appsv1.DaemonSetList { return &appsv1.DaemonSetList{} }),
|
||||
func() *appsv1.DaemonSetList { return &appsv1.DaemonSetList{} },
|
||||
gentype.PrefersProtobuf[*appsv1.DaemonSet](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,9 @@ func newDeployments(c *AppsV1Client, namespace string) *deployments {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *appsv1.Deployment { return &appsv1.Deployment{} },
|
||||
func() *appsv1.DeploymentList { return &appsv1.DeploymentList{} }),
|
||||
func() *appsv1.DeploymentList { return &appsv1.DeploymentList{} },
|
||||
gentype.PrefersProtobuf[*appsv1.Deployment](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +86,7 @@ func newDeployments(c *AppsV1Client, namespace string) *deployments {
|
||||
func (c *deployments) GetScale(ctx context.Context, deploymentName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
|
||||
result = &autoscalingv1.Scale{}
|
||||
err = c.GetClient().Get().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("deployments").
|
||||
Name(deploymentName).
|
||||
@@ -98,6 +101,7 @@ func (c *deployments) GetScale(ctx context.Context, deploymentName string, optio
|
||||
func (c *deployments) UpdateScale(ctx context.Context, deploymentName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
|
||||
result = &autoscalingv1.Scale{}
|
||||
err = c.GetClient().Put().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("deployments").
|
||||
Name(deploymentName).
|
||||
@@ -123,6 +127,7 @@ func (c *deployments) ApplyScale(ctx context.Context, deploymentName string, sca
|
||||
|
||||
result = &autoscalingv1.Scale{}
|
||||
err = c.GetClient().Patch(types.ApplyPatchType).
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("deployments").
|
||||
Name(deploymentName).
|
||||
|
||||
@@ -76,7 +76,9 @@ func newReplicaSets(c *AppsV1Client, namespace string) *replicaSets {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *appsv1.ReplicaSet { return &appsv1.ReplicaSet{} },
|
||||
func() *appsv1.ReplicaSetList { return &appsv1.ReplicaSetList{} }),
|
||||
func() *appsv1.ReplicaSetList { return &appsv1.ReplicaSetList{} },
|
||||
gentype.PrefersProtobuf[*appsv1.ReplicaSet](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +86,7 @@ func newReplicaSets(c *AppsV1Client, namespace string) *replicaSets {
|
||||
func (c *replicaSets) GetScale(ctx context.Context, replicaSetName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
|
||||
result = &autoscalingv1.Scale{}
|
||||
err = c.GetClient().Get().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("replicasets").
|
||||
Name(replicaSetName).
|
||||
@@ -98,6 +101,7 @@ func (c *replicaSets) GetScale(ctx context.Context, replicaSetName string, optio
|
||||
func (c *replicaSets) UpdateScale(ctx context.Context, replicaSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
|
||||
result = &autoscalingv1.Scale{}
|
||||
err = c.GetClient().Put().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("replicasets").
|
||||
Name(replicaSetName).
|
||||
@@ -123,6 +127,7 @@ func (c *replicaSets) ApplyScale(ctx context.Context, replicaSetName string, sca
|
||||
|
||||
result = &autoscalingv1.Scale{}
|
||||
err = c.GetClient().Patch(types.ApplyPatchType).
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("replicasets").
|
||||
Name(replicaSetName).
|
||||
|
||||
@@ -76,7 +76,9 @@ func newStatefulSets(c *AppsV1Client, namespace string) *statefulSets {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *appsv1.StatefulSet { return &appsv1.StatefulSet{} },
|
||||
func() *appsv1.StatefulSetList { return &appsv1.StatefulSetList{} }),
|
||||
func() *appsv1.StatefulSetList { return &appsv1.StatefulSetList{} },
|
||||
gentype.PrefersProtobuf[*appsv1.StatefulSet](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +86,7 @@ func newStatefulSets(c *AppsV1Client, namespace string) *statefulSets {
|
||||
func (c *statefulSets) GetScale(ctx context.Context, statefulSetName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
|
||||
result = &autoscalingv1.Scale{}
|
||||
err = c.GetClient().Get().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("statefulsets").
|
||||
Name(statefulSetName).
|
||||
@@ -98,6 +101,7 @@ func (c *statefulSets) GetScale(ctx context.Context, statefulSetName string, opt
|
||||
func (c *statefulSets) UpdateScale(ctx context.Context, statefulSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
|
||||
result = &autoscalingv1.Scale{}
|
||||
err = c.GetClient().Put().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("statefulsets").
|
||||
Name(statefulSetName).
|
||||
@@ -123,6 +127,7 @@ func (c *statefulSets) ApplyScale(ctx context.Context, statefulSetName string, s
|
||||
|
||||
result = &autoscalingv1.Scale{}
|
||||
err = c.GetClient().Patch(types.ApplyPatchType).
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("statefulsets").
|
||||
Name(statefulSetName).
|
||||
|
||||
@@ -64,6 +64,8 @@ func newControllerRevisions(c *AppsV1beta1Client, namespace string) *controllerR
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *appsv1beta1.ControllerRevision { return &appsv1beta1.ControllerRevision{} },
|
||||
func() *appsv1beta1.ControllerRevisionList { return &appsv1beta1.ControllerRevisionList{} }),
|
||||
func() *appsv1beta1.ControllerRevisionList { return &appsv1beta1.ControllerRevisionList{} },
|
||||
gentype.PrefersProtobuf[*appsv1beta1.ControllerRevision](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newDeployments(c *AppsV1beta1Client, namespace string) *deployments {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *appsv1beta1.Deployment { return &appsv1beta1.Deployment{} },
|
||||
func() *appsv1beta1.DeploymentList { return &appsv1beta1.DeploymentList{} }),
|
||||
func() *appsv1beta1.DeploymentList { return &appsv1beta1.DeploymentList{} },
|
||||
gentype.PrefersProtobuf[*appsv1beta1.Deployment](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newStatefulSets(c *AppsV1beta1Client, namespace string) *statefulSets {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *appsv1beta1.StatefulSet { return &appsv1beta1.StatefulSet{} },
|
||||
func() *appsv1beta1.StatefulSetList { return &appsv1beta1.StatefulSetList{} }),
|
||||
func() *appsv1beta1.StatefulSetList { return &appsv1beta1.StatefulSetList{} },
|
||||
gentype.PrefersProtobuf[*appsv1beta1.StatefulSet](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newControllerRevisions(c *AppsV1beta2Client, namespace string) *controllerR
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *appsv1beta2.ControllerRevision { return &appsv1beta2.ControllerRevision{} },
|
||||
func() *appsv1beta2.ControllerRevisionList { return &appsv1beta2.ControllerRevisionList{} }),
|
||||
func() *appsv1beta2.ControllerRevisionList { return &appsv1beta2.ControllerRevisionList{} },
|
||||
gentype.PrefersProtobuf[*appsv1beta2.ControllerRevision](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newDaemonSets(c *AppsV1beta2Client, namespace string) *daemonSets {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *appsv1beta2.DaemonSet { return &appsv1beta2.DaemonSet{} },
|
||||
func() *appsv1beta2.DaemonSetList { return &appsv1beta2.DaemonSetList{} }),
|
||||
func() *appsv1beta2.DaemonSetList { return &appsv1beta2.DaemonSetList{} },
|
||||
gentype.PrefersProtobuf[*appsv1beta2.DaemonSet](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newDeployments(c *AppsV1beta2Client, namespace string) *deployments {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *appsv1beta2.Deployment { return &appsv1beta2.Deployment{} },
|
||||
func() *appsv1beta2.DeploymentList { return &appsv1beta2.DeploymentList{} }),
|
||||
func() *appsv1beta2.DeploymentList { return &appsv1beta2.DeploymentList{} },
|
||||
gentype.PrefersProtobuf[*appsv1beta2.Deployment](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newReplicaSets(c *AppsV1beta2Client, namespace string) *replicaSets {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *appsv1beta2.ReplicaSet { return &appsv1beta2.ReplicaSet{} },
|
||||
func() *appsv1beta2.ReplicaSetList { return &appsv1beta2.ReplicaSetList{} }),
|
||||
func() *appsv1beta2.ReplicaSetList { return &appsv1beta2.ReplicaSetList{} },
|
||||
gentype.PrefersProtobuf[*appsv1beta2.ReplicaSet](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,9 @@ func newStatefulSets(c *AppsV1beta2Client, namespace string) *statefulSets {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *appsv1beta2.StatefulSet { return &appsv1beta2.StatefulSet{} },
|
||||
func() *appsv1beta2.StatefulSetList { return &appsv1beta2.StatefulSetList{} }),
|
||||
func() *appsv1beta2.StatefulSetList { return &appsv1beta2.StatefulSetList{} },
|
||||
gentype.PrefersProtobuf[*appsv1beta2.StatefulSet](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +84,7 @@ func newStatefulSets(c *AppsV1beta2Client, namespace string) *statefulSets {
|
||||
func (c *statefulSets) GetScale(ctx context.Context, statefulSetName string, options v1.GetOptions) (result *appsv1beta2.Scale, err error) {
|
||||
result = &appsv1beta2.Scale{}
|
||||
err = c.GetClient().Get().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("statefulsets").
|
||||
Name(statefulSetName).
|
||||
@@ -96,6 +99,7 @@ func (c *statefulSets) GetScale(ctx context.Context, statefulSetName string, opt
|
||||
func (c *statefulSets) UpdateScale(ctx context.Context, statefulSetName string, scale *appsv1beta2.Scale, opts v1.UpdateOptions) (result *appsv1beta2.Scale, err error) {
|
||||
result = &appsv1beta2.Scale{}
|
||||
err = c.GetClient().Put().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("statefulsets").
|
||||
Name(statefulSetName).
|
||||
@@ -121,6 +125,7 @@ func (c *statefulSets) ApplyScale(ctx context.Context, statefulSetName string, s
|
||||
|
||||
result = &appsv1beta2.Scale{}
|
||||
err = c.GetClient().Patch(types.ApplyPatchType).
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("statefulsets").
|
||||
Name(statefulSetName).
|
||||
|
||||
@@ -52,6 +52,8 @@ func newSelfSubjectReviews(c *AuthenticationV1Client) *selfSubjectReviews {
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *authenticationv1.SelfSubjectReview { return &authenticationv1.SelfSubjectReview{} }),
|
||||
func() *authenticationv1.SelfSubjectReview { return &authenticationv1.SelfSubjectReview{} },
|
||||
gentype.PrefersProtobuf[*authenticationv1.SelfSubjectReview](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ func newTokenReviews(c *AuthenticationV1Client) *tokenReviews {
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *authenticationv1.TokenReview { return &authenticationv1.TokenReview{} }),
|
||||
func() *authenticationv1.TokenReview { return &authenticationv1.TokenReview{} },
|
||||
gentype.PrefersProtobuf[*authenticationv1.TokenReview](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ func newSelfSubjectReviews(c *AuthenticationV1alpha1Client) *selfSubjectReviews
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *authenticationv1alpha1.SelfSubjectReview { return &authenticationv1alpha1.SelfSubjectReview{} }),
|
||||
func() *authenticationv1alpha1.SelfSubjectReview { return &authenticationv1alpha1.SelfSubjectReview{} },
|
||||
gentype.PrefersProtobuf[*authenticationv1alpha1.SelfSubjectReview](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ func newSelfSubjectReviews(c *AuthenticationV1beta1Client) *selfSubjectReviews {
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *authenticationv1beta1.SelfSubjectReview { return &authenticationv1beta1.SelfSubjectReview{} }),
|
||||
func() *authenticationv1beta1.SelfSubjectReview { return &authenticationv1beta1.SelfSubjectReview{} },
|
||||
gentype.PrefersProtobuf[*authenticationv1beta1.SelfSubjectReview](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ func newTokenReviews(c *AuthenticationV1beta1Client) *tokenReviews {
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *authenticationv1beta1.TokenReview { return &authenticationv1beta1.TokenReview{} }),
|
||||
func() *authenticationv1beta1.TokenReview { return &authenticationv1beta1.TokenReview{} },
|
||||
gentype.PrefersProtobuf[*authenticationv1beta1.TokenReview](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ func newLocalSubjectAccessReviews(c *AuthorizationV1Client, namespace string) *l
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *authorizationv1.LocalSubjectAccessReview { return &authorizationv1.LocalSubjectAccessReview{} }),
|
||||
func() *authorizationv1.LocalSubjectAccessReview { return &authorizationv1.LocalSubjectAccessReview{} },
|
||||
gentype.PrefersProtobuf[*authorizationv1.LocalSubjectAccessReview](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ func newSelfSubjectAccessReviews(c *AuthorizationV1Client) *selfSubjectAccessRev
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *authorizationv1.SelfSubjectAccessReview { return &authorizationv1.SelfSubjectAccessReview{} }),
|
||||
func() *authorizationv1.SelfSubjectAccessReview { return &authorizationv1.SelfSubjectAccessReview{} },
|
||||
gentype.PrefersProtobuf[*authorizationv1.SelfSubjectAccessReview](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ func newSelfSubjectRulesReviews(c *AuthorizationV1Client) *selfSubjectRulesRevie
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *authorizationv1.SelfSubjectRulesReview { return &authorizationv1.SelfSubjectRulesReview{} }),
|
||||
func() *authorizationv1.SelfSubjectRulesReview { return &authorizationv1.SelfSubjectRulesReview{} },
|
||||
gentype.PrefersProtobuf[*authorizationv1.SelfSubjectRulesReview](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ func newSubjectAccessReviews(c *AuthorizationV1Client) *subjectAccessReviews {
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *authorizationv1.SubjectAccessReview { return &authorizationv1.SubjectAccessReview{} }),
|
||||
func() *authorizationv1.SubjectAccessReview { return &authorizationv1.SubjectAccessReview{} },
|
||||
gentype.PrefersProtobuf[*authorizationv1.SubjectAccessReview](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ func newLocalSubjectAccessReviews(c *AuthorizationV1beta1Client, namespace strin
|
||||
namespace,
|
||||
func() *authorizationv1beta1.LocalSubjectAccessReview {
|
||||
return &authorizationv1beta1.LocalSubjectAccessReview{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*authorizationv1beta1.LocalSubjectAccessReview](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ func newSelfSubjectAccessReviews(c *AuthorizationV1beta1Client) *selfSubjectAcce
|
||||
"",
|
||||
func() *authorizationv1beta1.SelfSubjectAccessReview {
|
||||
return &authorizationv1beta1.SelfSubjectAccessReview{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*authorizationv1beta1.SelfSubjectAccessReview](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ func newSelfSubjectRulesReviews(c *AuthorizationV1beta1Client) *selfSubjectRules
|
||||
"",
|
||||
func() *authorizationv1beta1.SelfSubjectRulesReview {
|
||||
return &authorizationv1beta1.SelfSubjectRulesReview{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*authorizationv1beta1.SelfSubjectRulesReview](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ func newSubjectAccessReviews(c *AuthorizationV1beta1Client) *subjectAccessReview
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *authorizationv1beta1.SubjectAccessReview { return &authorizationv1beta1.SubjectAccessReview{} }),
|
||||
func() *authorizationv1beta1.SubjectAccessReview { return &authorizationv1beta1.SubjectAccessReview{} },
|
||||
gentype.PrefersProtobuf[*authorizationv1beta1.SubjectAccessReview](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newHorizontalPodAutoscalers(c *AutoscalingV1Client, namespace string) *hori
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *autoscalingv1.HorizontalPodAutoscaler { return &autoscalingv1.HorizontalPodAutoscaler{} },
|
||||
func() *autoscalingv1.HorizontalPodAutoscalerList { return &autoscalingv1.HorizontalPodAutoscalerList{} }),
|
||||
func() *autoscalingv1.HorizontalPodAutoscalerList { return &autoscalingv1.HorizontalPodAutoscalerList{} },
|
||||
gentype.PrefersProtobuf[*autoscalingv1.HorizontalPodAutoscaler](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newHorizontalPodAutoscalers(c *AutoscalingV2Client, namespace string) *hori
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *autoscalingv2.HorizontalPodAutoscaler { return &autoscalingv2.HorizontalPodAutoscaler{} },
|
||||
func() *autoscalingv2.HorizontalPodAutoscalerList { return &autoscalingv2.HorizontalPodAutoscalerList{} }),
|
||||
func() *autoscalingv2.HorizontalPodAutoscalerList { return &autoscalingv2.HorizontalPodAutoscalerList{} },
|
||||
gentype.PrefersProtobuf[*autoscalingv2.HorizontalPodAutoscaler](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ func newHorizontalPodAutoscalers(c *AutoscalingV2beta1Client, namespace string)
|
||||
},
|
||||
func() *autoscalingv2beta1.HorizontalPodAutoscalerList {
|
||||
return &autoscalingv2beta1.HorizontalPodAutoscalerList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*autoscalingv2beta1.HorizontalPodAutoscaler](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ func newHorizontalPodAutoscalers(c *AutoscalingV2beta2Client, namespace string)
|
||||
},
|
||||
func() *autoscalingv2beta2.HorizontalPodAutoscalerList {
|
||||
return &autoscalingv2beta2.HorizontalPodAutoscalerList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*autoscalingv2beta2.HorizontalPodAutoscaler](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newCronJobs(c *BatchV1Client, namespace string) *cronJobs {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *batchv1.CronJob { return &batchv1.CronJob{} },
|
||||
func() *batchv1.CronJobList { return &batchv1.CronJobList{} }),
|
||||
func() *batchv1.CronJobList { return &batchv1.CronJobList{} },
|
||||
gentype.PrefersProtobuf[*batchv1.CronJob](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newJobs(c *BatchV1Client, namespace string) *jobs {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *batchv1.Job { return &batchv1.Job{} },
|
||||
func() *batchv1.JobList { return &batchv1.JobList{} }),
|
||||
func() *batchv1.JobList { return &batchv1.JobList{} },
|
||||
gentype.PrefersProtobuf[*batchv1.Job](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newCronJobs(c *BatchV1beta1Client, namespace string) *cronJobs {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *batchv1beta1.CronJob { return &batchv1beta1.CronJob{} },
|
||||
func() *batchv1beta1.CronJobList { return &batchv1beta1.CronJobList{} }),
|
||||
func() *batchv1beta1.CronJobList { return &batchv1beta1.CronJobList{} },
|
||||
gentype.PrefersProtobuf[*batchv1beta1.CronJob](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,9 @@ func newCertificateSigningRequests(c *CertificatesV1Client) *certificateSigningR
|
||||
func() *certificatesv1.CertificateSigningRequest { return &certificatesv1.CertificateSigningRequest{} },
|
||||
func() *certificatesv1.CertificateSigningRequestList {
|
||||
return &certificatesv1.CertificateSigningRequestList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*certificatesv1.CertificateSigningRequest](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +82,7 @@ func newCertificateSigningRequests(c *CertificatesV1Client) *certificateSigningR
|
||||
func (c *certificateSigningRequests) UpdateApproval(ctx context.Context, certificateSigningRequestName string, certificateSigningRequest *certificatesv1.CertificateSigningRequest, opts metav1.UpdateOptions) (result *certificatesv1.CertificateSigningRequest, err error) {
|
||||
result = &certificatesv1.CertificateSigningRequest{}
|
||||
err = c.GetClient().Put().
|
||||
UseProtobufAsDefault().
|
||||
Resource("certificatesigningrequests").
|
||||
Name(certificateSigningRequestName).
|
||||
SubResource("approval").
|
||||
|
||||
@@ -66,6 +66,8 @@ func newClusterTrustBundles(c *CertificatesV1alpha1Client) *clusterTrustBundles
|
||||
func() *certificatesv1alpha1.ClusterTrustBundle { return &certificatesv1alpha1.ClusterTrustBundle{} },
|
||||
func() *certificatesv1alpha1.ClusterTrustBundleList {
|
||||
return &certificatesv1alpha1.ClusterTrustBundleList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*certificatesv1alpha1.ClusterTrustBundle](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ func newCertificateSigningRequests(c *CertificatesV1beta1Client) *certificateSig
|
||||
},
|
||||
func() *certificatesv1beta1.CertificateSigningRequestList {
|
||||
return &certificatesv1beta1.CertificateSigningRequestList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*certificatesv1beta1.CertificateSigningRequest](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newLeases(c *CoordinationV1Client, namespace string) *leases {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *coordinationv1.Lease { return &coordinationv1.Lease{} },
|
||||
func() *coordinationv1.LeaseList { return &coordinationv1.LeaseList{} }),
|
||||
func() *coordinationv1.LeaseList { return &coordinationv1.LeaseList{} },
|
||||
gentype.PrefersProtobuf[*coordinationv1.Lease](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newLeaseCandidates(c *CoordinationV1alpha1Client, namespace string) *leaseC
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *coordinationv1alpha1.LeaseCandidate { return &coordinationv1alpha1.LeaseCandidate{} },
|
||||
func() *coordinationv1alpha1.LeaseCandidateList { return &coordinationv1alpha1.LeaseCandidateList{} }),
|
||||
func() *coordinationv1alpha1.LeaseCandidateList { return &coordinationv1alpha1.LeaseCandidateList{} },
|
||||
gentype.PrefersProtobuf[*coordinationv1alpha1.LeaseCandidate](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newLeases(c *CoordinationV1beta1Client, namespace string) *leases {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *coordinationv1beta1.Lease { return &coordinationv1beta1.Lease{} },
|
||||
func() *coordinationv1beta1.LeaseList { return &coordinationv1beta1.LeaseList{} }),
|
||||
func() *coordinationv1beta1.LeaseList { return &coordinationv1beta1.LeaseList{} },
|
||||
gentype.PrefersProtobuf[*coordinationv1beta1.Lease](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newComponentStatuses(c *CoreV1Client) *componentStatuses {
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *corev1.ComponentStatus { return &corev1.ComponentStatus{} },
|
||||
func() *corev1.ComponentStatusList { return &corev1.ComponentStatusList{} }),
|
||||
func() *corev1.ComponentStatusList { return &corev1.ComponentStatusList{} },
|
||||
gentype.PrefersProtobuf[*corev1.ComponentStatus](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newConfigMaps(c *CoreV1Client, namespace string) *configMaps {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *corev1.ConfigMap { return &corev1.ConfigMap{} },
|
||||
func() *corev1.ConfigMapList { return &corev1.ConfigMapList{} }),
|
||||
func() *corev1.ConfigMapList { return &corev1.ConfigMapList{} },
|
||||
gentype.PrefersProtobuf[*corev1.ConfigMap](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newEndpoints(c *CoreV1Client, namespace string) *endpoints {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *corev1.Endpoints { return &corev1.Endpoints{} },
|
||||
func() *corev1.EndpointsList { return &corev1.EndpointsList{} }),
|
||||
func() *corev1.EndpointsList { return &corev1.EndpointsList{} },
|
||||
gentype.PrefersProtobuf[*corev1.Endpoints](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newEvents(c *CoreV1Client, namespace string) *events {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *corev1.Event { return &corev1.Event{} },
|
||||
func() *corev1.EventList { return &corev1.EventList{} }),
|
||||
func() *corev1.EventList { return &corev1.EventList{} },
|
||||
gentype.PrefersProtobuf[*corev1.Event](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newLimitRanges(c *CoreV1Client, namespace string) *limitRanges {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *corev1.LimitRange { return &corev1.LimitRange{} },
|
||||
func() *corev1.LimitRangeList { return &corev1.LimitRangeList{} }),
|
||||
func() *corev1.LimitRangeList { return &corev1.LimitRangeList{} },
|
||||
gentype.PrefersProtobuf[*corev1.LimitRange](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ func newNamespaces(c *CoreV1Client) *namespaces {
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *corev1.Namespace { return &corev1.Namespace{} },
|
||||
func() *corev1.NamespaceList { return &corev1.NamespaceList{} }),
|
||||
func() *corev1.NamespaceList { return &corev1.NamespaceList{} },
|
||||
gentype.PrefersProtobuf[*corev1.Namespace](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newNodes(c *CoreV1Client) *nodes {
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *corev1.Node { return &corev1.Node{} },
|
||||
func() *corev1.NodeList { return &corev1.NodeList{} }),
|
||||
func() *corev1.NodeList { return &corev1.NodeList{} },
|
||||
gentype.PrefersProtobuf[*corev1.Node](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newPersistentVolumes(c *CoreV1Client) *persistentVolumes {
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *corev1.PersistentVolume { return &corev1.PersistentVolume{} },
|
||||
func() *corev1.PersistentVolumeList { return &corev1.PersistentVolumeList{} }),
|
||||
func() *corev1.PersistentVolumeList { return &corev1.PersistentVolumeList{} },
|
||||
gentype.PrefersProtobuf[*corev1.PersistentVolume](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newPersistentVolumeClaims(c *CoreV1Client, namespace string) *persistentVol
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *corev1.PersistentVolumeClaim { return &corev1.PersistentVolumeClaim{} },
|
||||
func() *corev1.PersistentVolumeClaimList { return &corev1.PersistentVolumeClaimList{} }),
|
||||
func() *corev1.PersistentVolumeClaimList { return &corev1.PersistentVolumeClaimList{} },
|
||||
gentype.PrefersProtobuf[*corev1.PersistentVolumeClaim](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,9 @@ func newPods(c *CoreV1Client, namespace string) *pods {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *corev1.Pod { return &corev1.Pod{} },
|
||||
func() *corev1.PodList { return &corev1.PodList{} }),
|
||||
func() *corev1.PodList { return &corev1.PodList{} },
|
||||
gentype.PrefersProtobuf[*corev1.Pod](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +80,7 @@ func newPods(c *CoreV1Client, namespace string) *pods {
|
||||
func (c *pods) UpdateEphemeralContainers(ctx context.Context, podName string, pod *corev1.Pod, opts metav1.UpdateOptions) (result *corev1.Pod, err error) {
|
||||
result = &corev1.Pod{}
|
||||
err = c.GetClient().Put().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("pods").
|
||||
Name(podName).
|
||||
|
||||
@@ -64,6 +64,8 @@ func newPodTemplates(c *CoreV1Client, namespace string) *podTemplates {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *corev1.PodTemplate { return &corev1.PodTemplate{} },
|
||||
func() *corev1.PodTemplateList { return &corev1.PodTemplateList{} }),
|
||||
func() *corev1.PodTemplateList { return &corev1.PodTemplateList{} },
|
||||
gentype.PrefersProtobuf[*corev1.PodTemplate](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,9 @@ func newReplicationControllers(c *CoreV1Client, namespace string) *replicationCo
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *corev1.ReplicationController { return &corev1.ReplicationController{} },
|
||||
func() *corev1.ReplicationControllerList { return &corev1.ReplicationControllerList{} }),
|
||||
func() *corev1.ReplicationControllerList { return &corev1.ReplicationControllerList{} },
|
||||
gentype.PrefersProtobuf[*corev1.ReplicationController](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +82,7 @@ func newReplicationControllers(c *CoreV1Client, namespace string) *replicationCo
|
||||
func (c *replicationControllers) GetScale(ctx context.Context, replicationControllerName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
|
||||
result = &autoscalingv1.Scale{}
|
||||
err = c.GetClient().Get().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("replicationcontrollers").
|
||||
Name(replicationControllerName).
|
||||
@@ -94,6 +97,7 @@ func (c *replicationControllers) GetScale(ctx context.Context, replicationContro
|
||||
func (c *replicationControllers) UpdateScale(ctx context.Context, replicationControllerName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
|
||||
result = &autoscalingv1.Scale{}
|
||||
err = c.GetClient().Put().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("replicationcontrollers").
|
||||
Name(replicationControllerName).
|
||||
|
||||
@@ -68,6 +68,8 @@ func newResourceQuotas(c *CoreV1Client, namespace string) *resourceQuotas {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *corev1.ResourceQuota { return &corev1.ResourceQuota{} },
|
||||
func() *corev1.ResourceQuotaList { return &corev1.ResourceQuotaList{} }),
|
||||
func() *corev1.ResourceQuotaList { return &corev1.ResourceQuotaList{} },
|
||||
gentype.PrefersProtobuf[*corev1.ResourceQuota](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newSecrets(c *CoreV1Client, namespace string) *secrets {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *corev1.Secret { return &corev1.Secret{} },
|
||||
func() *corev1.SecretList { return &corev1.SecretList{} }),
|
||||
func() *corev1.SecretList { return &corev1.SecretList{} },
|
||||
gentype.PrefersProtobuf[*corev1.Secret](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ func newServices(c *CoreV1Client, namespace string) *services {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *corev1.Service { return &corev1.Service{} },
|
||||
func() *corev1.ServiceList { return &corev1.ServiceList{} }),
|
||||
func() *corev1.ServiceList { return &corev1.ServiceList{} },
|
||||
gentype.PrefersProtobuf[*corev1.Service](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,9 @@ func newServiceAccounts(c *CoreV1Client, namespace string) *serviceAccounts {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *corev1.ServiceAccount { return &corev1.ServiceAccount{} },
|
||||
func() *corev1.ServiceAccountList { return &corev1.ServiceAccountList{} }),
|
||||
func() *corev1.ServiceAccountList { return &corev1.ServiceAccountList{} },
|
||||
gentype.PrefersProtobuf[*corev1.ServiceAccount](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +77,7 @@ func newServiceAccounts(c *CoreV1Client, namespace string) *serviceAccounts {
|
||||
func (c *serviceAccounts) CreateToken(ctx context.Context, serviceAccountName string, tokenRequest *authenticationv1.TokenRequest, opts metav1.CreateOptions) (result *authenticationv1.TokenRequest, err error) {
|
||||
result = &authenticationv1.TokenRequest{}
|
||||
err = c.GetClient().Post().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("serviceaccounts").
|
||||
Name(serviceAccountName).
|
||||
|
||||
@@ -64,6 +64,8 @@ func newEndpointSlices(c *DiscoveryV1Client, namespace string) *endpointSlices {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *discoveryv1.EndpointSlice { return &discoveryv1.EndpointSlice{} },
|
||||
func() *discoveryv1.EndpointSliceList { return &discoveryv1.EndpointSliceList{} }),
|
||||
func() *discoveryv1.EndpointSliceList { return &discoveryv1.EndpointSliceList{} },
|
||||
gentype.PrefersProtobuf[*discoveryv1.EndpointSlice](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newEndpointSlices(c *DiscoveryV1beta1Client, namespace string) *endpointSli
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *discoveryv1beta1.EndpointSlice { return &discoveryv1beta1.EndpointSlice{} },
|
||||
func() *discoveryv1beta1.EndpointSliceList { return &discoveryv1beta1.EndpointSliceList{} }),
|
||||
func() *discoveryv1beta1.EndpointSliceList { return &discoveryv1beta1.EndpointSliceList{} },
|
||||
gentype.PrefersProtobuf[*discoveryv1beta1.EndpointSlice](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newEvents(c *EventsV1Client, namespace string) *events {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *eventsv1.Event { return &eventsv1.Event{} },
|
||||
func() *eventsv1.EventList { return &eventsv1.EventList{} }),
|
||||
func() *eventsv1.EventList { return &eventsv1.EventList{} },
|
||||
gentype.PrefersProtobuf[*eventsv1.Event](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newEvents(c *EventsV1beta1Client, namespace string) *events {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *eventsv1beta1.Event { return &eventsv1beta1.Event{} },
|
||||
func() *eventsv1beta1.EventList { return &eventsv1beta1.EventList{} }),
|
||||
func() *eventsv1beta1.EventList { return &eventsv1beta1.EventList{} },
|
||||
gentype.PrefersProtobuf[*eventsv1beta1.Event](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newDaemonSets(c *ExtensionsV1beta1Client, namespace string) *daemonSets {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *extensionsv1beta1.DaemonSet { return &extensionsv1beta1.DaemonSet{} },
|
||||
func() *extensionsv1beta1.DaemonSetList { return &extensionsv1beta1.DaemonSetList{} }),
|
||||
func() *extensionsv1beta1.DaemonSetList { return &extensionsv1beta1.DaemonSetList{} },
|
||||
gentype.PrefersProtobuf[*extensionsv1beta1.DaemonSet](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,9 @@ func newDeployments(c *ExtensionsV1beta1Client, namespace string) *deployments {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *extensionsv1beta1.Deployment { return &extensionsv1beta1.Deployment{} },
|
||||
func() *extensionsv1beta1.DeploymentList { return &extensionsv1beta1.DeploymentList{} }),
|
||||
func() *extensionsv1beta1.DeploymentList { return &extensionsv1beta1.DeploymentList{} },
|
||||
gentype.PrefersProtobuf[*extensionsv1beta1.Deployment](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +84,7 @@ func newDeployments(c *ExtensionsV1beta1Client, namespace string) *deployments {
|
||||
func (c *deployments) GetScale(ctx context.Context, deploymentName string, options v1.GetOptions) (result *extensionsv1beta1.Scale, err error) {
|
||||
result = &extensionsv1beta1.Scale{}
|
||||
err = c.GetClient().Get().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("deployments").
|
||||
Name(deploymentName).
|
||||
@@ -96,6 +99,7 @@ func (c *deployments) GetScale(ctx context.Context, deploymentName string, optio
|
||||
func (c *deployments) UpdateScale(ctx context.Context, deploymentName string, scale *extensionsv1beta1.Scale, opts v1.UpdateOptions) (result *extensionsv1beta1.Scale, err error) {
|
||||
result = &extensionsv1beta1.Scale{}
|
||||
err = c.GetClient().Put().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("deployments").
|
||||
Name(deploymentName).
|
||||
@@ -121,6 +125,7 @@ func (c *deployments) ApplyScale(ctx context.Context, deploymentName string, sca
|
||||
|
||||
result = &extensionsv1beta1.Scale{}
|
||||
err = c.GetClient().Patch(types.ApplyPatchType).
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("deployments").
|
||||
Name(deploymentName).
|
||||
|
||||
@@ -68,6 +68,8 @@ func newIngresses(c *ExtensionsV1beta1Client, namespace string) *ingresses {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *extensionsv1beta1.Ingress { return &extensionsv1beta1.Ingress{} },
|
||||
func() *extensionsv1beta1.IngressList { return &extensionsv1beta1.IngressList{} }),
|
||||
func() *extensionsv1beta1.IngressList { return &extensionsv1beta1.IngressList{} },
|
||||
gentype.PrefersProtobuf[*extensionsv1beta1.Ingress](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newNetworkPolicies(c *ExtensionsV1beta1Client, namespace string) *networkPo
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *extensionsv1beta1.NetworkPolicy { return &extensionsv1beta1.NetworkPolicy{} },
|
||||
func() *extensionsv1beta1.NetworkPolicyList { return &extensionsv1beta1.NetworkPolicyList{} }),
|
||||
func() *extensionsv1beta1.NetworkPolicyList { return &extensionsv1beta1.NetworkPolicyList{} },
|
||||
gentype.PrefersProtobuf[*extensionsv1beta1.NetworkPolicy](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,9 @@ func newReplicaSets(c *ExtensionsV1beta1Client, namespace string) *replicaSets {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *extensionsv1beta1.ReplicaSet { return &extensionsv1beta1.ReplicaSet{} },
|
||||
func() *extensionsv1beta1.ReplicaSetList { return &extensionsv1beta1.ReplicaSetList{} }),
|
||||
func() *extensionsv1beta1.ReplicaSetList { return &extensionsv1beta1.ReplicaSetList{} },
|
||||
gentype.PrefersProtobuf[*extensionsv1beta1.ReplicaSet](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +84,7 @@ func newReplicaSets(c *ExtensionsV1beta1Client, namespace string) *replicaSets {
|
||||
func (c *replicaSets) GetScale(ctx context.Context, replicaSetName string, options v1.GetOptions) (result *extensionsv1beta1.Scale, err error) {
|
||||
result = &extensionsv1beta1.Scale{}
|
||||
err = c.GetClient().Get().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("replicasets").
|
||||
Name(replicaSetName).
|
||||
@@ -96,6 +99,7 @@ func (c *replicaSets) GetScale(ctx context.Context, replicaSetName string, optio
|
||||
func (c *replicaSets) UpdateScale(ctx context.Context, replicaSetName string, scale *extensionsv1beta1.Scale, opts v1.UpdateOptions) (result *extensionsv1beta1.Scale, err error) {
|
||||
result = &extensionsv1beta1.Scale{}
|
||||
err = c.GetClient().Put().
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("replicasets").
|
||||
Name(replicaSetName).
|
||||
@@ -121,6 +125,7 @@ func (c *replicaSets) ApplyScale(ctx context.Context, replicaSetName string, sca
|
||||
|
||||
result = &extensionsv1beta1.Scale{}
|
||||
err = c.GetClient().Patch(types.ApplyPatchType).
|
||||
UseProtobufAsDefault().
|
||||
Namespace(c.GetNamespace()).
|
||||
Resource("replicasets").
|
||||
Name(replicaSetName).
|
||||
|
||||
@@ -68,6 +68,8 @@ func newFlowSchemas(c *FlowcontrolV1Client) *flowSchemas {
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *flowcontrolv1.FlowSchema { return &flowcontrolv1.FlowSchema{} },
|
||||
func() *flowcontrolv1.FlowSchemaList { return &flowcontrolv1.FlowSchemaList{} }),
|
||||
func() *flowcontrolv1.FlowSchemaList { return &flowcontrolv1.FlowSchemaList{} },
|
||||
gentype.PrefersProtobuf[*flowcontrolv1.FlowSchema](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,8 @@ func newPriorityLevelConfigurations(c *FlowcontrolV1Client) *priorityLevelConfig
|
||||
func() *flowcontrolv1.PriorityLevelConfiguration { return &flowcontrolv1.PriorityLevelConfiguration{} },
|
||||
func() *flowcontrolv1.PriorityLevelConfigurationList {
|
||||
return &flowcontrolv1.PriorityLevelConfigurationList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*flowcontrolv1.PriorityLevelConfiguration](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newFlowSchemas(c *FlowcontrolV1beta1Client) *flowSchemas {
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *flowcontrolv1beta1.FlowSchema { return &flowcontrolv1beta1.FlowSchema{} },
|
||||
func() *flowcontrolv1beta1.FlowSchemaList { return &flowcontrolv1beta1.FlowSchemaList{} }),
|
||||
func() *flowcontrolv1beta1.FlowSchemaList { return &flowcontrolv1beta1.FlowSchemaList{} },
|
||||
gentype.PrefersProtobuf[*flowcontrolv1beta1.FlowSchema](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ func newPriorityLevelConfigurations(c *FlowcontrolV1beta1Client) *priorityLevelC
|
||||
},
|
||||
func() *flowcontrolv1beta1.PriorityLevelConfigurationList {
|
||||
return &flowcontrolv1beta1.PriorityLevelConfigurationList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*flowcontrolv1beta1.PriorityLevelConfiguration](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newFlowSchemas(c *FlowcontrolV1beta2Client) *flowSchemas {
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *flowcontrolv1beta2.FlowSchema { return &flowcontrolv1beta2.FlowSchema{} },
|
||||
func() *flowcontrolv1beta2.FlowSchemaList { return &flowcontrolv1beta2.FlowSchemaList{} }),
|
||||
func() *flowcontrolv1beta2.FlowSchemaList { return &flowcontrolv1beta2.FlowSchemaList{} },
|
||||
gentype.PrefersProtobuf[*flowcontrolv1beta2.FlowSchema](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ func newPriorityLevelConfigurations(c *FlowcontrolV1beta2Client) *priorityLevelC
|
||||
},
|
||||
func() *flowcontrolv1beta2.PriorityLevelConfigurationList {
|
||||
return &flowcontrolv1beta2.PriorityLevelConfigurationList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*flowcontrolv1beta2.PriorityLevelConfiguration](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newFlowSchemas(c *FlowcontrolV1beta3Client) *flowSchemas {
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *flowcontrolv1beta3.FlowSchema { return &flowcontrolv1beta3.FlowSchema{} },
|
||||
func() *flowcontrolv1beta3.FlowSchemaList { return &flowcontrolv1beta3.FlowSchemaList{} }),
|
||||
func() *flowcontrolv1beta3.FlowSchemaList { return &flowcontrolv1beta3.FlowSchemaList{} },
|
||||
gentype.PrefersProtobuf[*flowcontrolv1beta3.FlowSchema](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ func newPriorityLevelConfigurations(c *FlowcontrolV1beta3Client) *priorityLevelC
|
||||
},
|
||||
func() *flowcontrolv1beta3.PriorityLevelConfigurationList {
|
||||
return &flowcontrolv1beta3.PriorityLevelConfigurationList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*flowcontrolv1beta3.PriorityLevelConfiguration](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newIngresses(c *NetworkingV1Client, namespace string) *ingresses {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *networkingv1.Ingress { return &networkingv1.Ingress{} },
|
||||
func() *networkingv1.IngressList { return &networkingv1.IngressList{} }),
|
||||
func() *networkingv1.IngressList { return &networkingv1.IngressList{} },
|
||||
gentype.PrefersProtobuf[*networkingv1.Ingress](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newIngressClasses(c *NetworkingV1Client) *ingressClasses {
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *networkingv1.IngressClass { return &networkingv1.IngressClass{} },
|
||||
func() *networkingv1.IngressClassList { return &networkingv1.IngressClassList{} }),
|
||||
func() *networkingv1.IngressClassList { return &networkingv1.IngressClassList{} },
|
||||
gentype.PrefersProtobuf[*networkingv1.IngressClass](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newNetworkPolicies(c *NetworkingV1Client, namespace string) *networkPolicie
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *networkingv1.NetworkPolicy { return &networkingv1.NetworkPolicy{} },
|
||||
func() *networkingv1.NetworkPolicyList { return &networkingv1.NetworkPolicyList{} }),
|
||||
func() *networkingv1.NetworkPolicyList { return &networkingv1.NetworkPolicyList{} },
|
||||
gentype.PrefersProtobuf[*networkingv1.NetworkPolicy](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newIPAddresses(c *NetworkingV1alpha1Client) *iPAddresses {
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *networkingv1alpha1.IPAddress { return &networkingv1alpha1.IPAddress{} },
|
||||
func() *networkingv1alpha1.IPAddressList { return &networkingv1alpha1.IPAddressList{} }),
|
||||
func() *networkingv1alpha1.IPAddressList { return &networkingv1alpha1.IPAddressList{} },
|
||||
gentype.PrefersProtobuf[*networkingv1alpha1.IPAddress](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newServiceCIDRs(c *NetworkingV1alpha1Client) *serviceCIDRs {
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *networkingv1alpha1.ServiceCIDR { return &networkingv1alpha1.ServiceCIDR{} },
|
||||
func() *networkingv1alpha1.ServiceCIDRList { return &networkingv1alpha1.ServiceCIDRList{} }),
|
||||
func() *networkingv1alpha1.ServiceCIDRList { return &networkingv1alpha1.ServiceCIDRList{} },
|
||||
gentype.PrefersProtobuf[*networkingv1alpha1.ServiceCIDR](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func newIngresses(c *NetworkingV1beta1Client, namespace string) *ingresses {
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *networkingv1beta1.Ingress { return &networkingv1beta1.Ingress{} },
|
||||
func() *networkingv1beta1.IngressList { return &networkingv1beta1.IngressList{} }),
|
||||
func() *networkingv1beta1.IngressList { return &networkingv1beta1.IngressList{} },
|
||||
gentype.PrefersProtobuf[*networkingv1beta1.Ingress](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ func newIngressClasses(c *NetworkingV1beta1Client) *ingressClasses {
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *networkingv1beta1.IngressClass { return &networkingv1beta1.IngressClass{} },
|
||||
func() *networkingv1beta1.IngressClassList { return &networkingv1beta1.IngressClassList{} }),
|
||||
func() *networkingv1beta1.IngressClassList { return &networkingv1beta1.IngressClassList{} },
|
||||
gentype.PrefersProtobuf[*networkingv1beta1.IngressClass](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user