Regenerate clients to support application/apply-patch+cbor.

This commit is contained in:
Ben Luddy
2024-10-29 13:38:12 -04:00
parent 37ed906a33
commit 41f55d7117
7 changed files with 26 additions and 34 deletions

View File

@@ -20,7 +20,6 @@ package v1
import ( import (
context "context" context "context"
json "encoding/json"
fmt "fmt" fmt "fmt"
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
@@ -32,6 +31,7 @@ import (
applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1"
gentype "k8s.io/client-go/gentype" gentype "k8s.io/client-go/gentype"
scheme "k8s.io/client-go/kubernetes/scheme" scheme "k8s.io/client-go/kubernetes/scheme"
apply "k8s.io/client-go/util/apply"
) )
// DeploymentsGetter has a method to return a DeploymentInterface. // DeploymentsGetter has a method to return a DeploymentInterface.
@@ -120,20 +120,19 @@ func (c *deployments) ApplyScale(ctx context.Context, deploymentName string, sca
return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
} }
patchOpts := opts.ToPatchOptions() patchOpts := opts.ToPatchOptions()
data, err := json.Marshal(scale) request, err := apply.NewRequest(c.GetClient(), scale)
if err != nil { if err != nil {
return nil, err return nil, err
} }
result = &autoscalingv1.Scale{} result = &autoscalingv1.Scale{}
err = c.GetClient().Patch(types.ApplyPatchType). err = request.
UseProtobufAsDefault(). UseProtobufAsDefault().
Namespace(c.GetNamespace()). Namespace(c.GetNamespace()).
Resource("deployments"). Resource("deployments").
Name(deploymentName). Name(deploymentName).
SubResource("scale"). SubResource("scale").
VersionedParams(&patchOpts, scheme.ParameterCodec). VersionedParams(&patchOpts, scheme.ParameterCodec).
Body(data).
Do(ctx). Do(ctx).
Into(result) Into(result)
return return

View File

@@ -20,7 +20,6 @@ package v1
import ( import (
context "context" context "context"
json "encoding/json"
fmt "fmt" fmt "fmt"
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
@@ -32,6 +31,7 @@ import (
applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1"
gentype "k8s.io/client-go/gentype" gentype "k8s.io/client-go/gentype"
scheme "k8s.io/client-go/kubernetes/scheme" scheme "k8s.io/client-go/kubernetes/scheme"
apply "k8s.io/client-go/util/apply"
) )
// ReplicaSetsGetter has a method to return a ReplicaSetInterface. // ReplicaSetsGetter has a method to return a ReplicaSetInterface.
@@ -120,20 +120,19 @@ func (c *replicaSets) ApplyScale(ctx context.Context, replicaSetName string, sca
return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
} }
patchOpts := opts.ToPatchOptions() patchOpts := opts.ToPatchOptions()
data, err := json.Marshal(scale) request, err := apply.NewRequest(c.GetClient(), scale)
if err != nil { if err != nil {
return nil, err return nil, err
} }
result = &autoscalingv1.Scale{} result = &autoscalingv1.Scale{}
err = c.GetClient().Patch(types.ApplyPatchType). err = request.
UseProtobufAsDefault(). UseProtobufAsDefault().
Namespace(c.GetNamespace()). Namespace(c.GetNamespace()).
Resource("replicasets"). Resource("replicasets").
Name(replicaSetName). Name(replicaSetName).
SubResource("scale"). SubResource("scale").
VersionedParams(&patchOpts, scheme.ParameterCodec). VersionedParams(&patchOpts, scheme.ParameterCodec).
Body(data).
Do(ctx). Do(ctx).
Into(result) Into(result)
return return

View File

@@ -20,7 +20,6 @@ package v1
import ( import (
context "context" context "context"
json "encoding/json"
fmt "fmt" fmt "fmt"
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
@@ -32,6 +31,7 @@ import (
applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1"
gentype "k8s.io/client-go/gentype" gentype "k8s.io/client-go/gentype"
scheme "k8s.io/client-go/kubernetes/scheme" scheme "k8s.io/client-go/kubernetes/scheme"
apply "k8s.io/client-go/util/apply"
) )
// StatefulSetsGetter has a method to return a StatefulSetInterface. // StatefulSetsGetter has a method to return a StatefulSetInterface.
@@ -120,20 +120,19 @@ func (c *statefulSets) ApplyScale(ctx context.Context, statefulSetName string, s
return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
} }
patchOpts := opts.ToPatchOptions() patchOpts := opts.ToPatchOptions()
data, err := json.Marshal(scale) request, err := apply.NewRequest(c.GetClient(), scale)
if err != nil { if err != nil {
return nil, err return nil, err
} }
result = &autoscalingv1.Scale{} result = &autoscalingv1.Scale{}
err = c.GetClient().Patch(types.ApplyPatchType). err = request.
UseProtobufAsDefault(). UseProtobufAsDefault().
Namespace(c.GetNamespace()). Namespace(c.GetNamespace()).
Resource("statefulsets"). Resource("statefulsets").
Name(statefulSetName). Name(statefulSetName).
SubResource("scale"). SubResource("scale").
VersionedParams(&patchOpts, scheme.ParameterCodec). VersionedParams(&patchOpts, scheme.ParameterCodec).
Body(data).
Do(ctx). Do(ctx).
Into(result) Into(result)
return return

View File

@@ -20,7 +20,6 @@ package v1beta2
import ( import (
context "context" context "context"
json "encoding/json"
fmt "fmt" fmt "fmt"
appsv1beta2 "k8s.io/api/apps/v1beta2" appsv1beta2 "k8s.io/api/apps/v1beta2"
@@ -30,6 +29,7 @@ import (
applyconfigurationsappsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2" applyconfigurationsappsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2"
gentype "k8s.io/client-go/gentype" gentype "k8s.io/client-go/gentype"
scheme "k8s.io/client-go/kubernetes/scheme" scheme "k8s.io/client-go/kubernetes/scheme"
apply "k8s.io/client-go/util/apply"
) )
// StatefulSetsGetter has a method to return a StatefulSetInterface. // StatefulSetsGetter has a method to return a StatefulSetInterface.
@@ -118,20 +118,19 @@ func (c *statefulSets) ApplyScale(ctx context.Context, statefulSetName string, s
return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
} }
patchOpts := opts.ToPatchOptions() patchOpts := opts.ToPatchOptions()
data, err := json.Marshal(scale) request, err := apply.NewRequest(c.GetClient(), scale)
if err != nil { if err != nil {
return nil, err return nil, err
} }
result = &appsv1beta2.Scale{} result = &appsv1beta2.Scale{}
err = c.GetClient().Patch(types.ApplyPatchType). err = request.
UseProtobufAsDefault(). UseProtobufAsDefault().
Namespace(c.GetNamespace()). Namespace(c.GetNamespace()).
Resource("statefulsets"). Resource("statefulsets").
Name(statefulSetName). Name(statefulSetName).
SubResource("scale"). SubResource("scale").
VersionedParams(&patchOpts, scheme.ParameterCodec). VersionedParams(&patchOpts, scheme.ParameterCodec).
Body(data).
Do(ctx). Do(ctx).
Into(result) Into(result)
return return

View File

@@ -20,7 +20,6 @@ package v1beta1
import ( import (
context "context" context "context"
json "encoding/json"
fmt "fmt" fmt "fmt"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1" extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
@@ -30,6 +29,7 @@ import (
applyconfigurationsextensionsv1beta1 "k8s.io/client-go/applyconfigurations/extensions/v1beta1" applyconfigurationsextensionsv1beta1 "k8s.io/client-go/applyconfigurations/extensions/v1beta1"
gentype "k8s.io/client-go/gentype" gentype "k8s.io/client-go/gentype"
scheme "k8s.io/client-go/kubernetes/scheme" scheme "k8s.io/client-go/kubernetes/scheme"
apply "k8s.io/client-go/util/apply"
) )
// DeploymentsGetter has a method to return a DeploymentInterface. // DeploymentsGetter has a method to return a DeploymentInterface.
@@ -118,20 +118,19 @@ func (c *deployments) ApplyScale(ctx context.Context, deploymentName string, sca
return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
} }
patchOpts := opts.ToPatchOptions() patchOpts := opts.ToPatchOptions()
data, err := json.Marshal(scale) request, err := apply.NewRequest(c.GetClient(), scale)
if err != nil { if err != nil {
return nil, err return nil, err
} }
result = &extensionsv1beta1.Scale{} result = &extensionsv1beta1.Scale{}
err = c.GetClient().Patch(types.ApplyPatchType). err = request.
UseProtobufAsDefault(). UseProtobufAsDefault().
Namespace(c.GetNamespace()). Namespace(c.GetNamespace()).
Resource("deployments"). Resource("deployments").
Name(deploymentName). Name(deploymentName).
SubResource("scale"). SubResource("scale").
VersionedParams(&patchOpts, scheme.ParameterCodec). VersionedParams(&patchOpts, scheme.ParameterCodec).
Body(data).
Do(ctx). Do(ctx).
Into(result) Into(result)
return return

View File

@@ -20,7 +20,6 @@ package v1beta1
import ( import (
context "context" context "context"
json "encoding/json"
fmt "fmt" fmt "fmt"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1" extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
@@ -30,6 +29,7 @@ import (
applyconfigurationsextensionsv1beta1 "k8s.io/client-go/applyconfigurations/extensions/v1beta1" applyconfigurationsextensionsv1beta1 "k8s.io/client-go/applyconfigurations/extensions/v1beta1"
gentype "k8s.io/client-go/gentype" gentype "k8s.io/client-go/gentype"
scheme "k8s.io/client-go/kubernetes/scheme" scheme "k8s.io/client-go/kubernetes/scheme"
apply "k8s.io/client-go/util/apply"
) )
// ReplicaSetsGetter has a method to return a ReplicaSetInterface. // ReplicaSetsGetter has a method to return a ReplicaSetInterface.
@@ -118,20 +118,19 @@ func (c *replicaSets) ApplyScale(ctx context.Context, replicaSetName string, sca
return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
} }
patchOpts := opts.ToPatchOptions() patchOpts := opts.ToPatchOptions()
data, err := json.Marshal(scale) request, err := apply.NewRequest(c.GetClient(), scale)
if err != nil { if err != nil {
return nil, err return nil, err
} }
result = &extensionsv1beta1.Scale{} result = &extensionsv1beta1.Scale{}
err = c.GetClient().Patch(types.ApplyPatchType). err = request.
UseProtobufAsDefault(). UseProtobufAsDefault().
Namespace(c.GetNamespace()). Namespace(c.GetNamespace()).
Resource("replicasets"). Resource("replicasets").
Name(replicaSetName). Name(replicaSetName).
SubResource("scale"). SubResource("scale").
VersionedParams(&patchOpts, scheme.ParameterCodec). VersionedParams(&patchOpts, scheme.ParameterCodec).
Body(data).
Do(ctx). Do(ctx).
Into(result) Into(result)
return return

View File

@@ -20,7 +20,6 @@ package v1
import ( import (
context "context" context "context"
json "encoding/json"
fmt "fmt" fmt "fmt"
time "time" time "time"
@@ -28,6 +27,7 @@ import (
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
gentype "k8s.io/client-go/gentype" gentype "k8s.io/client-go/gentype"
apply "k8s.io/client-go/util/apply"
consistencydetector "k8s.io/client-go/util/consistencydetector" consistencydetector "k8s.io/client-go/util/consistencydetector"
watchlist "k8s.io/client-go/util/watchlist" watchlist "k8s.io/client-go/util/watchlist"
extensionsv1 "k8s.io/code-generator/examples/crd/apis/extensions/v1" extensionsv1 "k8s.io/code-generator/examples/crd/apis/extensions/v1"
@@ -204,21 +204,20 @@ func (c *testTypes) ApplyExtended(ctx context.Context, testType *applyconfigurat
return nil, fmt.Errorf("testType provided to ApplyExtended must not be nil") return nil, fmt.Errorf("testType provided to ApplyExtended must not be nil")
} }
patchOpts := opts.ToPatchOptions() patchOpts := opts.ToPatchOptions()
data, err := json.Marshal(testType)
if err != nil {
return nil, err
}
name := testType.Name name := testType.Name
if name == nil { if name == nil {
return nil, fmt.Errorf("testType.Name must be provided to ApplyExtended") return nil, fmt.Errorf("testType.Name must be provided to ApplyExtended")
} }
request, err := apply.NewRequest(c.GetClient(), testType)
if err != nil {
return nil, err
}
result = &extensionsv1.TestType{} result = &extensionsv1.TestType{}
err = c.GetClient().Patch(types.ApplyPatchType). err = request.
Namespace(c.GetNamespace()). Namespace(c.GetNamespace()).
Resource("testtypes"). Resource("testtypes").
Name(*name). Name(*name).
VersionedParams(&patchOpts, scheme.ParameterCodec). VersionedParams(&patchOpts, scheme.ParameterCodec).
Body(data).
Do(ctx). Do(ctx).
Into(result) Into(result)
return return
@@ -275,19 +274,18 @@ func (c *testTypes) ApplySubresource(ctx context.Context, testTypeName string, t
return nil, fmt.Errorf("testSubresource provided to ApplySubresource must not be nil") return nil, fmt.Errorf("testSubresource provided to ApplySubresource must not be nil")
} }
patchOpts := opts.ToPatchOptions() patchOpts := opts.ToPatchOptions()
data, err := json.Marshal(testSubresource) request, err := apply.NewRequest(c.GetClient(), testSubresource)
if err != nil { if err != nil {
return nil, err return nil, err
} }
result = &extensionsv1.TestSubresource{} result = &extensionsv1.TestSubresource{}
err = c.GetClient().Patch(types.ApplyPatchType). err = request.
Namespace(c.GetNamespace()). Namespace(c.GetNamespace()).
Resource("testtypes"). Resource("testtypes").
Name(testTypeName). Name(testTypeName).
SubResource("subresource"). SubResource("subresource").
VersionedParams(&patchOpts, scheme.ParameterCodec). VersionedParams(&patchOpts, scheme.ParameterCodec).
Body(data).
Do(ctx). Do(ctx).
Into(result) Into(result)
return return