mirror of
https://github.com/kubernetes/client-go.git
synced 2026-06-17 07:15:34 +00:00
Compare commits
50 Commits
v0.32.0-al
...
v0.32.0-al
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79a7334678 | ||
|
|
a887e579c0 | ||
|
|
886262a3de | ||
|
|
c957b59518 | ||
|
|
9d19c65cdb | ||
|
|
d8fc5bb524 | ||
|
|
3dc7fd5f4c | ||
|
|
abe0e99c21 | ||
|
|
1cca19dc02 | ||
|
|
86e81b0a37 | ||
|
|
6f44458e5e | ||
|
|
1647efd5c4 | ||
|
|
c5146a9031 | ||
|
|
f05f3ca8bc | ||
|
|
65ed08a834 | ||
|
|
23900f4929 | ||
|
|
6a276b2b95 | ||
|
|
607869c7d9 | ||
|
|
d366fa7737 | ||
|
|
235936510e | ||
|
|
43e9ea4bb5 | ||
|
|
e4db112974 | ||
|
|
29ce700614 | ||
|
|
3c2f0814df | ||
|
|
de60f3ccb5 | ||
|
|
ee51eaf9d0 | ||
|
|
c38ce11939 | ||
|
|
9cff3e43bd | ||
|
|
ce42c297f4 | ||
|
|
64f5574f09 | ||
|
|
2717ef67e3 | ||
|
|
9f84a0d8ed | ||
|
|
6b8f524c7c | ||
|
|
d13452aae7 | ||
|
|
d274c7ba36 | ||
|
|
3cd3050ffd | ||
|
|
cd6681f3c4 | ||
|
|
bbcb9ac523 | ||
|
|
cae730524e | ||
|
|
ba20fcad8f | ||
|
|
3c28f81659 | ||
|
|
0dfea60d7a | ||
|
|
5fceb99b61 | ||
|
|
7416b2ea43 | ||
|
|
146d03f559 | ||
|
|
5b31113588 | ||
|
|
ca4a13f6de | ||
|
|
105983d93c | ||
|
|
3ecd72cc0b | ||
|
|
1d3f0e5617 |
@@ -12247,9 +12247,6 @@ var schemaYAML = typed.YAMLObject(`types:
|
||||
- name: io.k8s.api.resource.v1alpha3.AllocationResult
|
||||
map:
|
||||
fields:
|
||||
- name: controller
|
||||
type:
|
||||
scalar: string
|
||||
- name: devices
|
||||
type:
|
||||
namedType: io.k8s.api.resource.v1alpha3.DeviceAllocationResult
|
||||
@@ -12404,9 +12401,6 @@ var schemaYAML = typed.YAMLObject(`types:
|
||||
elementType:
|
||||
namedType: io.k8s.api.resource.v1alpha3.DeviceSelector
|
||||
elementRelationship: atomic
|
||||
- name: suitableNodes
|
||||
type:
|
||||
namedType: io.k8s.api.core.v1.NodeSelector
|
||||
- name: io.k8s.api.resource.v1alpha3.DeviceConstraint
|
||||
map:
|
||||
fields:
|
||||
@@ -12481,50 +12475,6 @@ var schemaYAML = typed.YAMLObject(`types:
|
||||
- name: parameters
|
||||
type:
|
||||
namedType: __untyped_atomic_
|
||||
- name: io.k8s.api.resource.v1alpha3.PodSchedulingContext
|
||||
map:
|
||||
fields:
|
||||
- name: apiVersion
|
||||
type:
|
||||
scalar: string
|
||||
- name: kind
|
||||
type:
|
||||
scalar: string
|
||||
- name: metadata
|
||||
type:
|
||||
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
|
||||
default: {}
|
||||
- name: spec
|
||||
type:
|
||||
namedType: io.k8s.api.resource.v1alpha3.PodSchedulingContextSpec
|
||||
default: {}
|
||||
- name: status
|
||||
type:
|
||||
namedType: io.k8s.api.resource.v1alpha3.PodSchedulingContextStatus
|
||||
default: {}
|
||||
- name: io.k8s.api.resource.v1alpha3.PodSchedulingContextSpec
|
||||
map:
|
||||
fields:
|
||||
- name: potentialNodes
|
||||
type:
|
||||
list:
|
||||
elementType:
|
||||
scalar: string
|
||||
elementRelationship: atomic
|
||||
- name: selectedNode
|
||||
type:
|
||||
scalar: string
|
||||
- name: io.k8s.api.resource.v1alpha3.PodSchedulingContextStatus
|
||||
map:
|
||||
fields:
|
||||
- name: resourceClaims
|
||||
type:
|
||||
list:
|
||||
elementType:
|
||||
namedType: io.k8s.api.resource.v1alpha3.ResourceClaimSchedulingStatus
|
||||
elementRelationship: associative
|
||||
keys:
|
||||
- name
|
||||
- name: io.k8s.api.resource.v1alpha3.ResourceClaim
|
||||
map:
|
||||
fields:
|
||||
@@ -12564,25 +12514,9 @@ var schemaYAML = typed.YAMLObject(`types:
|
||||
type:
|
||||
scalar: string
|
||||
default: ""
|
||||
- name: io.k8s.api.resource.v1alpha3.ResourceClaimSchedulingStatus
|
||||
map:
|
||||
fields:
|
||||
- name: name
|
||||
type:
|
||||
scalar: string
|
||||
default: ""
|
||||
- name: unsuitableNodes
|
||||
type:
|
||||
list:
|
||||
elementType:
|
||||
scalar: string
|
||||
elementRelationship: atomic
|
||||
- name: io.k8s.api.resource.v1alpha3.ResourceClaimSpec
|
||||
map:
|
||||
fields:
|
||||
- name: controller
|
||||
type:
|
||||
scalar: string
|
||||
- name: devices
|
||||
type:
|
||||
namedType: io.k8s.api.resource.v1alpha3.DeviceClaim
|
||||
@@ -12593,9 +12527,6 @@ var schemaYAML = typed.YAMLObject(`types:
|
||||
- name: allocation
|
||||
type:
|
||||
namedType: io.k8s.api.resource.v1alpha3.AllocationResult
|
||||
- name: deallocationRequested
|
||||
type:
|
||||
scalar: boolean
|
||||
- name: reservedFor
|
||||
type:
|
||||
list:
|
||||
|
||||
@@ -27,7 +27,6 @@ import (
|
||||
type AllocationResultApplyConfiguration struct {
|
||||
Devices *DeviceAllocationResultApplyConfiguration `json:"devices,omitempty"`
|
||||
NodeSelector *v1.NodeSelectorApplyConfiguration `json:"nodeSelector,omitempty"`
|
||||
Controller *string `json:"controller,omitempty"`
|
||||
}
|
||||
|
||||
// AllocationResultApplyConfiguration constructs a declarative configuration of the AllocationResult type for use with
|
||||
@@ -51,11 +50,3 @@ func (b *AllocationResultApplyConfiguration) WithNodeSelector(value *v1.NodeSele
|
||||
b.NodeSelector = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithController sets the Controller field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Controller field is set to the value of the last call.
|
||||
func (b *AllocationResultApplyConfiguration) WithController(value string) *AllocationResultApplyConfiguration {
|
||||
b.Controller = &value
|
||||
return b
|
||||
}
|
||||
|
||||
@@ -18,16 +18,11 @@ limitations under the License.
|
||||
|
||||
package v1alpha3
|
||||
|
||||
import (
|
||||
v1 "k8s.io/client-go/applyconfigurations/core/v1"
|
||||
)
|
||||
|
||||
// DeviceClassSpecApplyConfiguration represents a declarative configuration of the DeviceClassSpec type for use
|
||||
// with apply.
|
||||
type DeviceClassSpecApplyConfiguration struct {
|
||||
Selectors []DeviceSelectorApplyConfiguration `json:"selectors,omitempty"`
|
||||
Config []DeviceClassConfigurationApplyConfiguration `json:"config,omitempty"`
|
||||
SuitableNodes *v1.NodeSelectorApplyConfiguration `json:"suitableNodes,omitempty"`
|
||||
Selectors []DeviceSelectorApplyConfiguration `json:"selectors,omitempty"`
|
||||
Config []DeviceClassConfigurationApplyConfiguration `json:"config,omitempty"`
|
||||
}
|
||||
|
||||
// DeviceClassSpecApplyConfiguration constructs a declarative configuration of the DeviceClassSpec type for use with
|
||||
@@ -61,11 +56,3 @@ func (b *DeviceClassSpecApplyConfiguration) WithConfig(values ...*DeviceClassCon
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithSuitableNodes sets the SuitableNodes field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the SuitableNodes field is set to the value of the last call.
|
||||
func (b *DeviceClassSpecApplyConfiguration) WithSuitableNodes(value *v1.NodeSelectorApplyConfiguration) *DeviceClassSpecApplyConfiguration {
|
||||
b.SuitableNodes = value
|
||||
return b
|
||||
}
|
||||
|
||||
@@ -1,264 +0,0 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha3
|
||||
|
||||
import (
|
||||
resourcev1alpha3 "k8s.io/api/resource/v1alpha3"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
|
||||
internal "k8s.io/client-go/applyconfigurations/internal"
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// PodSchedulingContextApplyConfiguration represents a declarative configuration of the PodSchedulingContext type for use
|
||||
// with apply.
|
||||
type PodSchedulingContextApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Spec *PodSchedulingContextSpecApplyConfiguration `json:"spec,omitempty"`
|
||||
Status *PodSchedulingContextStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// PodSchedulingContext constructs a declarative configuration of the PodSchedulingContext type for use with
|
||||
// apply.
|
||||
func PodSchedulingContext(name, namespace string) *PodSchedulingContextApplyConfiguration {
|
||||
b := &PodSchedulingContextApplyConfiguration{}
|
||||
b.WithName(name)
|
||||
b.WithNamespace(namespace)
|
||||
b.WithKind("PodSchedulingContext")
|
||||
b.WithAPIVersion("resource.k8s.io/v1alpha3")
|
||||
return b
|
||||
}
|
||||
|
||||
// ExtractPodSchedulingContext extracts the applied configuration owned by fieldManager from
|
||||
// podSchedulingContext. If no managedFields are found in podSchedulingContext for fieldManager, a
|
||||
// PodSchedulingContextApplyConfiguration is returned with only the Name, Namespace (if applicable),
|
||||
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
|
||||
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
|
||||
// the fieldManager never owned fields any fields.
|
||||
// podSchedulingContext must be a unmodified PodSchedulingContext API object that was retrieved from the Kubernetes API.
|
||||
// ExtractPodSchedulingContext provides a way to perform a extract/modify-in-place/apply workflow.
|
||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
// Experimental!
|
||||
func ExtractPodSchedulingContext(podSchedulingContext *resourcev1alpha3.PodSchedulingContext, fieldManager string) (*PodSchedulingContextApplyConfiguration, error) {
|
||||
return extractPodSchedulingContext(podSchedulingContext, fieldManager, "")
|
||||
}
|
||||
|
||||
// ExtractPodSchedulingContextStatus is the same as ExtractPodSchedulingContext except
|
||||
// that it extracts the status subresource applied configuration.
|
||||
// Experimental!
|
||||
func ExtractPodSchedulingContextStatus(podSchedulingContext *resourcev1alpha3.PodSchedulingContext, fieldManager string) (*PodSchedulingContextApplyConfiguration, error) {
|
||||
return extractPodSchedulingContext(podSchedulingContext, fieldManager, "status")
|
||||
}
|
||||
|
||||
func extractPodSchedulingContext(podSchedulingContext *resourcev1alpha3.PodSchedulingContext, fieldManager string, subresource string) (*PodSchedulingContextApplyConfiguration, error) {
|
||||
b := &PodSchedulingContextApplyConfiguration{}
|
||||
err := managedfields.ExtractInto(podSchedulingContext, internal.Parser().Type("io.k8s.api.resource.v1alpha3.PodSchedulingContext"), fieldManager, b, subresource)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b.WithName(podSchedulingContext.Name)
|
||||
b.WithNamespace(podSchedulingContext.Namespace)
|
||||
|
||||
b.WithKind("PodSchedulingContext")
|
||||
b.WithAPIVersion("resource.k8s.io/v1alpha3")
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// WithKind sets the Kind field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Kind field is set to the value of the last call.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithKind(value string) *PodSchedulingContextApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.Kind = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the APIVersion field is set to the value of the last call.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithAPIVersion(value string) *PodSchedulingContextApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.APIVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithName sets the Name field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Name field is set to the value of the last call.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithName(value string) *PodSchedulingContextApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Name = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the GenerateName field is set to the value of the last call.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithGenerateName(value string) *PodSchedulingContextApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.GenerateName = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithNamespace(value string) *PodSchedulingContextApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Namespace = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithUID sets the UID field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the UID field is set to the value of the last call.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithUID(value types.UID) *PodSchedulingContextApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.UID = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ResourceVersion field is set to the value of the last call.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithResourceVersion(value string) *PodSchedulingContextApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGeneration sets the Generation field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Generation field is set to the value of the last call.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithGeneration(value int64) *PodSchedulingContextApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Generation = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PodSchedulingContextApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PodSchedulingContextApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PodSchedulingContextApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithLabels puts the entries into the Labels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Labels field,
|
||||
// overwriting an existing map entries in Labels field with the same key.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithLabels(entries map[string]string) *PodSchedulingContextApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Labels[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Annotations field,
|
||||
// overwriting an existing map entries in Annotations field with the same key.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithAnnotations(entries map[string]string) *PodSchedulingContextApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Annotations[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PodSchedulingContextApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithOwnerReferences")
|
||||
}
|
||||
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Finalizers field.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithFinalizers(values ...string) *PodSchedulingContextApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *PodSchedulingContextApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
|
||||
if b.ObjectMetaApplyConfiguration == nil {
|
||||
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
|
||||
}
|
||||
}
|
||||
|
||||
// WithSpec sets the Spec field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Spec field is set to the value of the last call.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithSpec(value *PodSchedulingContextSpecApplyConfiguration) *PodSchedulingContextApplyConfiguration {
|
||||
b.Spec = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *PodSchedulingContextApplyConfiguration) WithStatus(value *PodSchedulingContextStatusApplyConfiguration) *PodSchedulingContextApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||
func (b *PodSchedulingContextApplyConfiguration) GetName() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.ObjectMetaApplyConfiguration.Name
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha3
|
||||
|
||||
// PodSchedulingContextSpecApplyConfiguration represents a declarative configuration of the PodSchedulingContextSpec type for use
|
||||
// with apply.
|
||||
type PodSchedulingContextSpecApplyConfiguration struct {
|
||||
SelectedNode *string `json:"selectedNode,omitempty"`
|
||||
PotentialNodes []string `json:"potentialNodes,omitempty"`
|
||||
}
|
||||
|
||||
// PodSchedulingContextSpecApplyConfiguration constructs a declarative configuration of the PodSchedulingContextSpec type for use with
|
||||
// apply.
|
||||
func PodSchedulingContextSpec() *PodSchedulingContextSpecApplyConfiguration {
|
||||
return &PodSchedulingContextSpecApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithSelectedNode sets the SelectedNode field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the SelectedNode field is set to the value of the last call.
|
||||
func (b *PodSchedulingContextSpecApplyConfiguration) WithSelectedNode(value string) *PodSchedulingContextSpecApplyConfiguration {
|
||||
b.SelectedNode = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithPotentialNodes adds the given value to the PotentialNodes field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the PotentialNodes field.
|
||||
func (b *PodSchedulingContextSpecApplyConfiguration) WithPotentialNodes(values ...string) *PodSchedulingContextSpecApplyConfiguration {
|
||||
for i := range values {
|
||||
b.PotentialNodes = append(b.PotentialNodes, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha3
|
||||
|
||||
// PodSchedulingContextStatusApplyConfiguration represents a declarative configuration of the PodSchedulingContextStatus type for use
|
||||
// with apply.
|
||||
type PodSchedulingContextStatusApplyConfiguration struct {
|
||||
ResourceClaims []ResourceClaimSchedulingStatusApplyConfiguration `json:"resourceClaims,omitempty"`
|
||||
}
|
||||
|
||||
// PodSchedulingContextStatusApplyConfiguration constructs a declarative configuration of the PodSchedulingContextStatus type for use with
|
||||
// apply.
|
||||
func PodSchedulingContextStatus() *PodSchedulingContextStatusApplyConfiguration {
|
||||
return &PodSchedulingContextStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithResourceClaims adds the given value to the ResourceClaims field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the ResourceClaims field.
|
||||
func (b *PodSchedulingContextStatusApplyConfiguration) WithResourceClaims(values ...*ResourceClaimSchedulingStatusApplyConfiguration) *PodSchedulingContextStatusApplyConfiguration {
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithResourceClaims")
|
||||
}
|
||||
b.ResourceClaims = append(b.ResourceClaims, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha3
|
||||
|
||||
// ResourceClaimSchedulingStatusApplyConfiguration represents a declarative configuration of the ResourceClaimSchedulingStatus type for use
|
||||
// with apply.
|
||||
type ResourceClaimSchedulingStatusApplyConfiguration struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
UnsuitableNodes []string `json:"unsuitableNodes,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceClaimSchedulingStatusApplyConfiguration constructs a declarative configuration of the ResourceClaimSchedulingStatus type for use with
|
||||
// apply.
|
||||
func ResourceClaimSchedulingStatus() *ResourceClaimSchedulingStatusApplyConfiguration {
|
||||
return &ResourceClaimSchedulingStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithName sets the Name field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Name field is set to the value of the last call.
|
||||
func (b *ResourceClaimSchedulingStatusApplyConfiguration) WithName(value string) *ResourceClaimSchedulingStatusApplyConfiguration {
|
||||
b.Name = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithUnsuitableNodes adds the given value to the UnsuitableNodes field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the UnsuitableNodes field.
|
||||
func (b *ResourceClaimSchedulingStatusApplyConfiguration) WithUnsuitableNodes(values ...string) *ResourceClaimSchedulingStatusApplyConfiguration {
|
||||
for i := range values {
|
||||
b.UnsuitableNodes = append(b.UnsuitableNodes, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
@@ -21,8 +21,7 @@ package v1alpha3
|
||||
// ResourceClaimSpecApplyConfiguration represents a declarative configuration of the ResourceClaimSpec type for use
|
||||
// with apply.
|
||||
type ResourceClaimSpecApplyConfiguration struct {
|
||||
Devices *DeviceClaimApplyConfiguration `json:"devices,omitempty"`
|
||||
Controller *string `json:"controller,omitempty"`
|
||||
Devices *DeviceClaimApplyConfiguration `json:"devices,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceClaimSpecApplyConfiguration constructs a declarative configuration of the ResourceClaimSpec type for use with
|
||||
@@ -38,11 +37,3 @@ func (b *ResourceClaimSpecApplyConfiguration) WithDevices(value *DeviceClaimAppl
|
||||
b.Devices = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithController sets the Controller field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Controller field is set to the value of the last call.
|
||||
func (b *ResourceClaimSpecApplyConfiguration) WithController(value string) *ResourceClaimSpecApplyConfiguration {
|
||||
b.Controller = &value
|
||||
return b
|
||||
}
|
||||
|
||||
@@ -21,9 +21,8 @@ package v1alpha3
|
||||
// ResourceClaimStatusApplyConfiguration represents a declarative configuration of the ResourceClaimStatus type for use
|
||||
// with apply.
|
||||
type ResourceClaimStatusApplyConfiguration struct {
|
||||
Allocation *AllocationResultApplyConfiguration `json:"allocation,omitempty"`
|
||||
ReservedFor []ResourceClaimConsumerReferenceApplyConfiguration `json:"reservedFor,omitempty"`
|
||||
DeallocationRequested *bool `json:"deallocationRequested,omitempty"`
|
||||
Allocation *AllocationResultApplyConfiguration `json:"allocation,omitempty"`
|
||||
ReservedFor []ResourceClaimConsumerReferenceApplyConfiguration `json:"reservedFor,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceClaimStatusApplyConfiguration constructs a declarative configuration of the ResourceClaimStatus type for use with
|
||||
@@ -52,11 +51,3 @@ func (b *ResourceClaimStatusApplyConfiguration) WithReservedFor(values ...*Resou
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeallocationRequested sets the DeallocationRequested field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeallocationRequested field is set to the value of the last call.
|
||||
func (b *ResourceClaimStatusApplyConfiguration) WithDeallocationRequested(value bool) *ResourceClaimStatusApplyConfiguration {
|
||||
b.DeallocationRequested = &value
|
||||
return b
|
||||
}
|
||||
|
||||
@@ -1602,18 +1602,10 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
return &resourcev1alpha3.DeviceSelectorApplyConfiguration{}
|
||||
case v1alpha3.SchemeGroupVersion.WithKind("OpaqueDeviceConfiguration"):
|
||||
return &resourcev1alpha3.OpaqueDeviceConfigurationApplyConfiguration{}
|
||||
case v1alpha3.SchemeGroupVersion.WithKind("PodSchedulingContext"):
|
||||
return &resourcev1alpha3.PodSchedulingContextApplyConfiguration{}
|
||||
case v1alpha3.SchemeGroupVersion.WithKind("PodSchedulingContextSpec"):
|
||||
return &resourcev1alpha3.PodSchedulingContextSpecApplyConfiguration{}
|
||||
case v1alpha3.SchemeGroupVersion.WithKind("PodSchedulingContextStatus"):
|
||||
return &resourcev1alpha3.PodSchedulingContextStatusApplyConfiguration{}
|
||||
case v1alpha3.SchemeGroupVersion.WithKind("ResourceClaim"):
|
||||
return &resourcev1alpha3.ResourceClaimApplyConfiguration{}
|
||||
case v1alpha3.SchemeGroupVersion.WithKind("ResourceClaimConsumerReference"):
|
||||
return &resourcev1alpha3.ResourceClaimConsumerReferenceApplyConfiguration{}
|
||||
case v1alpha3.SchemeGroupVersion.WithKind("ResourceClaimSchedulingStatus"):
|
||||
return &resourcev1alpha3.ResourceClaimSchedulingStatusApplyConfiguration{}
|
||||
case v1alpha3.SchemeGroupVersion.WithKind("ResourceClaimSpec"):
|
||||
return &resourcev1alpha3.ResourceClaimSpecApplyConfiguration{}
|
||||
case v1alpha3.SchemeGroupVersion.WithKind("ResourceClaimStatus"):
|
||||
|
||||
@@ -19,6 +19,7 @@ package dynamic
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@@ -183,7 +184,10 @@ func TestWatchList(t *testing.T) {
|
||||
{Type: watch.Bookmark, Object: func() runtime.Object {
|
||||
obj := getObject("gtest/vTest", "rTest", "item2")
|
||||
obj.SetResourceVersion("10")
|
||||
obj.SetAnnotations(map[string]string{metav1.InitialEventsAnnotationKey: "true"})
|
||||
obj.SetAnnotations(map[string]string{
|
||||
metav1.InitialEventsAnnotationKey: "true",
|
||||
metav1.InitialEventsListBlueprintAnnotationKey: base64.StdEncoding.EncodeToString(getJSON("vTest", "rTests", "")),
|
||||
})
|
||||
return obj
|
||||
}()},
|
||||
},
|
||||
@@ -195,9 +199,10 @@ func TestWatchList(t *testing.T) {
|
||||
},
|
||||
expectedList: &unstructured.UnstructuredList{
|
||||
Object: map[string]interface{}{
|
||||
"apiVersion": "",
|
||||
"kind": "UnstructuredList",
|
||||
"apiVersion": "vTest",
|
||||
"kind": "rTests",
|
||||
"metadata": map[string]interface{}{
|
||||
"name": "",
|
||||
"resourceVersion": "10",
|
||||
},
|
||||
},
|
||||
@@ -215,7 +220,10 @@ func TestWatchList(t *testing.T) {
|
||||
{Type: watch.Bookmark, Object: func() runtime.Object {
|
||||
obj := getObject("gtest/vTest", "rTest", "item2")
|
||||
obj.SetResourceVersion("39")
|
||||
obj.SetAnnotations(map[string]string{metav1.InitialEventsAnnotationKey: "true"})
|
||||
obj.SetAnnotations(map[string]string{
|
||||
metav1.InitialEventsAnnotationKey: "true",
|
||||
metav1.InitialEventsListBlueprintAnnotationKey: base64.StdEncoding.EncodeToString(getJSON("vTest", "rTests", "")),
|
||||
})
|
||||
return obj
|
||||
}()},
|
||||
},
|
||||
@@ -227,9 +235,10 @@ func TestWatchList(t *testing.T) {
|
||||
},
|
||||
expectedList: &unstructured.UnstructuredList{
|
||||
Object: map[string]interface{}{
|
||||
"apiVersion": "",
|
||||
"kind": "UnstructuredList",
|
||||
"apiVersion": "vTest",
|
||||
"kind": "rTests",
|
||||
"metadata": map[string]interface{}{
|
||||
"name": "",
|
||||
"resourceVersion": "39",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/equality"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
@@ -37,6 +38,7 @@ type triggerFunc func(gvr schema.GroupVersionResource, ns string, fakeClient *fa
|
||||
func triggerFactory(t *testing.T) triggerFunc {
|
||||
return func(gvr schema.GroupVersionResource, ns string, fakeClient *fake.FakeDynamicClient, _ *unstructured.Unstructured) *unstructured.Unstructured {
|
||||
testObject := newUnstructured("apps/v1", "Deployment", "ns-foo", "name-foo")
|
||||
testObject.SetLabels(map[string]string{"environment": "test"})
|
||||
createdObj, err := fakeClient.Resource(gvr).Namespace(ns).Create(context.TODO(), testObject, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
@@ -55,13 +57,14 @@ func handler(rcvCh chan<- *unstructured.Unstructured) *cache.ResourceEventHandle
|
||||
|
||||
func TestFilteredDynamicSharedInformerFactory(t *testing.T) {
|
||||
scenarios := []struct {
|
||||
name string
|
||||
existingObj *unstructured.Unstructured
|
||||
gvr schema.GroupVersionResource
|
||||
informNS string
|
||||
ns string
|
||||
trigger func(gvr schema.GroupVersionResource, ns string, fakeClient *fake.FakeDynamicClient, testObject *unstructured.Unstructured) *unstructured.Unstructured
|
||||
handler func(rcvCh chan<- *unstructured.Unstructured) *cache.ResourceEventHandlerFuncs
|
||||
name string
|
||||
existingObj *unstructured.Unstructured
|
||||
gvr schema.GroupVersionResource
|
||||
informNS string
|
||||
ns string
|
||||
trigger func(gvr schema.GroupVersionResource, ns string, fakeClient *fake.FakeDynamicClient, testObject *unstructured.Unstructured) *unstructured.Unstructured
|
||||
handler func(rcvCh chan<- *unstructured.Unstructured) *cache.ResourceEventHandlerFuncs
|
||||
tweakListOptions dynamicinformer.TweakListOptionsFunc
|
||||
}{
|
||||
// scenario 1
|
||||
{
|
||||
@@ -81,6 +84,50 @@ func TestFilteredDynamicSharedInformerFactory(t *testing.T) {
|
||||
trigger: triggerFactory(t),
|
||||
handler: handler,
|
||||
},
|
||||
{
|
||||
name: "tweak options: test adding an object not matching field selector should not trigger AddFunc",
|
||||
informNS: "ns-foo",
|
||||
ns: "ns-foo",
|
||||
gvr: schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "deployments"},
|
||||
trigger: triggerFactory(t),
|
||||
handler: handler,
|
||||
tweakListOptions: func(opts *metav1.ListOptions) {
|
||||
opts.FieldSelector = "metadata.name=name-bar"
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "tweak options: test adding an object matching field selector should trigger AddFunc",
|
||||
informNS: "ns-foo",
|
||||
ns: "ns-foo",
|
||||
gvr: schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "deployments"},
|
||||
trigger: triggerFactory(t),
|
||||
handler: handler,
|
||||
tweakListOptions: func(opts *metav1.ListOptions) {
|
||||
opts.FieldSelector = "metadata.name=name-foo"
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "tweak options: test adding an object not matching label selector should not trigger AddFunc",
|
||||
informNS: "ns-foo",
|
||||
ns: "ns-foo",
|
||||
gvr: schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "deployments"},
|
||||
trigger: triggerFactory(t),
|
||||
handler: handler,
|
||||
tweakListOptions: func(opts *metav1.ListOptions) {
|
||||
opts.LabelSelector = "environment=production"
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "tweak options: test adding an object matching label selector should trigger AddFunc",
|
||||
informNS: "ns-foo",
|
||||
ns: "ns-foo",
|
||||
gvr: schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "deployments"},
|
||||
trigger: triggerFactory(t),
|
||||
handler: handler,
|
||||
tweakListOptions: func(opts *metav1.ListOptions) {
|
||||
opts.LabelSelector = "environment=test"
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, ts := range scenarios {
|
||||
|
||||
@@ -21,31 +21,24 @@ import (
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/cbor"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/json"
|
||||
"k8s.io/client-go/features"
|
||||
)
|
||||
|
||||
var watchScheme = runtime.NewScheme()
|
||||
var basicScheme = runtime.NewScheme()
|
||||
var deleteScheme = runtime.NewScheme()
|
||||
var parameterScheme = runtime.NewScheme()
|
||||
var deleteOptionsCodec = serializer.NewCodecFactory(deleteScheme)
|
||||
var dynamicParameterCodec = runtime.NewParameterCodec(parameterScheme)
|
||||
|
||||
var versionV1 = schema.GroupVersion{Version: "v1"}
|
||||
|
||||
func init() {
|
||||
metav1.AddToGroupVersion(watchScheme, versionV1)
|
||||
metav1.AddToGroupVersion(basicScheme, versionV1)
|
||||
metav1.AddToGroupVersion(parameterScheme, versionV1)
|
||||
metav1.AddToGroupVersion(deleteScheme, versionV1)
|
||||
}
|
||||
|
||||
// basicNegotiatedSerializer is used to handle discovery and error handling serialization
|
||||
type basicNegotiatedSerializer struct{}
|
||||
|
||||
func (s basicNegotiatedSerializer) SupportedMediaTypes() []runtime.SerializerInfo {
|
||||
return []runtime.SerializerInfo{
|
||||
func newBasicNegotiatedSerializer() basicNegotiatedSerializer {
|
||||
supportedMediaTypes := []runtime.SerializerInfo{
|
||||
{
|
||||
MediaType: "application/json",
|
||||
MediaTypeType: "application",
|
||||
@@ -60,13 +53,34 @@ func (s basicNegotiatedSerializer) SupportedMediaTypes() []runtime.SerializerInf
|
||||
},
|
||||
},
|
||||
}
|
||||
if features.TestOnlyFeatureGates.Enabled(features.TestOnlyClientAllowsCBOR) {
|
||||
supportedMediaTypes = append(supportedMediaTypes, runtime.SerializerInfo{
|
||||
MediaType: "application/cbor",
|
||||
MediaTypeType: "application",
|
||||
MediaTypeSubType: "cbor",
|
||||
Serializer: cbor.NewSerializer(unstructuredCreater{basicScheme}, unstructuredTyper{basicScheme}),
|
||||
StreamSerializer: &runtime.StreamSerializerInfo{
|
||||
Serializer: cbor.NewSerializer(basicScheme, basicScheme, cbor.Transcode(false)),
|
||||
Framer: cbor.NewFramer(),
|
||||
},
|
||||
})
|
||||
}
|
||||
return basicNegotiatedSerializer{supportedMediaTypes: supportedMediaTypes}
|
||||
}
|
||||
|
||||
type basicNegotiatedSerializer struct {
|
||||
supportedMediaTypes []runtime.SerializerInfo
|
||||
}
|
||||
|
||||
func (s basicNegotiatedSerializer) SupportedMediaTypes() []runtime.SerializerInfo {
|
||||
return s.supportedMediaTypes
|
||||
}
|
||||
|
||||
func (s basicNegotiatedSerializer) EncoderForVersion(encoder runtime.Encoder, gv runtime.GroupVersioner) runtime.Encoder {
|
||||
return runtime.WithVersionEncoder{
|
||||
Version: gv,
|
||||
Encoder: encoder,
|
||||
ObjectTyper: unstructuredTyper{basicScheme},
|
||||
ObjectTyper: permissiveTyper{basicScheme},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,3 +120,25 @@ func (t unstructuredTyper) ObjectKinds(obj runtime.Object) ([]schema.GroupVersio
|
||||
func (t unstructuredTyper) Recognizes(gvk schema.GroupVersionKind) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// The dynamic client has historically accepted Unstructured objects with missing or empty
|
||||
// apiVersion and/or kind as arguments to its write request methods. This typer will return the type
|
||||
// of a runtime.Unstructured with no error, even if the type is missing or empty.
|
||||
type permissiveTyper struct {
|
||||
nested runtime.ObjectTyper
|
||||
}
|
||||
|
||||
func (t permissiveTyper) ObjectKinds(obj runtime.Object) ([]schema.GroupVersionKind, bool, error) {
|
||||
kinds, unversioned, err := t.nested.ObjectKinds(obj)
|
||||
if err == nil {
|
||||
return kinds, unversioned, nil
|
||||
}
|
||||
if _, ok := obj.(runtime.Unstructured); ok {
|
||||
return []schema.GroupVersionKind{obj.GetObjectKind().GroupVersionKind()}, false, nil
|
||||
}
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
func (t permissiveTyper) Recognizes(gvk schema.GroupVersionKind) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/features"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/util/consistencydetector"
|
||||
"k8s.io/client-go/util/watchlist"
|
||||
@@ -45,9 +46,17 @@ var _ Interface = &DynamicClient{}
|
||||
// appropriate dynamic client defaults set.
|
||||
func ConfigFor(inConfig *rest.Config) *rest.Config {
|
||||
config := rest.CopyConfig(inConfig)
|
||||
config.AcceptContentTypes = "application/json"
|
||||
|
||||
config.ContentType = "application/json"
|
||||
config.NegotiatedSerializer = basicNegotiatedSerializer{} // this gets used for discovery and error handling types
|
||||
config.AcceptContentTypes = "application/json"
|
||||
if features.TestOnlyFeatureGates.Enabled(features.TestOnlyClientAllowsCBOR) {
|
||||
config.AcceptContentTypes = "application/json;q=0.9,application/cbor;q=1"
|
||||
if features.TestOnlyFeatureGates.Enabled(features.TestOnlyClientPrefersCBOR) {
|
||||
config.ContentType = "application/cbor"
|
||||
}
|
||||
}
|
||||
|
||||
config.NegotiatedSerializer = newBasicNegotiatedSerializer()
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
@@ -86,11 +95,10 @@ func NewForConfig(inConfig *rest.Config) (*DynamicClient, error) {
|
||||
// Note the http client provided takes precedence over the configured transport values.
|
||||
func NewForConfigAndClient(inConfig *rest.Config, h *http.Client) (*DynamicClient, error) {
|
||||
config := ConfigFor(inConfig)
|
||||
// for serializing the options
|
||||
config.GroupVersion = &schema.GroupVersion{}
|
||||
config.GroupVersion = nil
|
||||
config.APIPath = "/if-you-see-this-search-for-the-break"
|
||||
|
||||
restClient, err := rest.RESTClientForConfigAndClient(config, h)
|
||||
restClient, err := rest.UnversionedRESTClientForConfigAndClient(config, h)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -114,10 +122,6 @@ func (c *dynamicResourceClient) Namespace(ns string) ResourceInterface {
|
||||
}
|
||||
|
||||
func (c *dynamicResourceClient) Create(ctx context.Context, obj *unstructured.Unstructured, opts metav1.CreateOptions, subresources ...string) (*unstructured.Unstructured, error) {
|
||||
outBytes, err := runtime.Encode(unstructured.UnstructuredJSONScheme, obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
name := ""
|
||||
if len(subresources) > 0 {
|
||||
accessor, err := meta.Accessor(obj)
|
||||
@@ -133,26 +137,17 @@ func (c *dynamicResourceClient) Create(ctx context.Context, obj *unstructured.Un
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := c.client.client.
|
||||
var out unstructured.Unstructured
|
||||
if err := c.client.client.
|
||||
Post().
|
||||
AbsPath(append(c.makeURLSegments(name), subresources...)...).
|
||||
SetHeader("Content-Type", runtime.ContentTypeJSON).
|
||||
Body(outBytes).
|
||||
Body(obj).
|
||||
SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1).
|
||||
Do(ctx)
|
||||
if err := result.Error(); err != nil {
|
||||
Do(ctx).Into(&out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
retBytes, err := result.Raw()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uncastObj, err := runtime.Decode(unstructured.UnstructuredJSONScheme, retBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return uncastObj.(*unstructured.Unstructured), nil
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *dynamicResourceClient) Update(ctx context.Context, obj *unstructured.Unstructured, opts metav1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error) {
|
||||
@@ -167,31 +162,18 @@ func (c *dynamicResourceClient) Update(ctx context.Context, obj *unstructured.Un
|
||||
if err := validateNamespaceWithOptionalName(c.namespace, name); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
outBytes, err := runtime.Encode(unstructured.UnstructuredJSONScheme, obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := c.client.client.
|
||||
var out unstructured.Unstructured
|
||||
if err := c.client.client.
|
||||
Put().
|
||||
AbsPath(append(c.makeURLSegments(name), subresources...)...).
|
||||
SetHeader("Content-Type", runtime.ContentTypeJSON).
|
||||
Body(outBytes).
|
||||
Body(obj).
|
||||
SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1).
|
||||
Do(ctx)
|
||||
if err := result.Error(); err != nil {
|
||||
Do(ctx).Into(&out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
retBytes, err := result.Raw()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uncastObj, err := runtime.Decode(unstructured.UnstructuredJSONScheme, retBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return uncastObj.(*unstructured.Unstructured), nil
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *dynamicResourceClient) UpdateStatus(ctx context.Context, obj *unstructured.Unstructured, opts metav1.UpdateOptions) (*unstructured.Unstructured, error) {
|
||||
@@ -206,31 +188,18 @@ func (c *dynamicResourceClient) UpdateStatus(ctx context.Context, obj *unstructu
|
||||
if err := validateNamespaceWithOptionalName(c.namespace, name); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
outBytes, err := runtime.Encode(unstructured.UnstructuredJSONScheme, obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := c.client.client.
|
||||
var out unstructured.Unstructured
|
||||
if err := c.client.client.
|
||||
Put().
|
||||
AbsPath(append(c.makeURLSegments(name), "status")...).
|
||||
SetHeader("Content-Type", runtime.ContentTypeJSON).
|
||||
Body(outBytes).
|
||||
Body(obj).
|
||||
SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1).
|
||||
Do(ctx)
|
||||
if err := result.Error(); err != nil {
|
||||
Do(ctx).Into(&out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
retBytes, err := result.Raw()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uncastObj, err := runtime.Decode(unstructured.UnstructuredJSONScheme, retBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return uncastObj.(*unstructured.Unstructured), nil
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *dynamicResourceClient) Delete(ctx context.Context, name string, opts metav1.DeleteOptions, subresources ...string) error {
|
||||
@@ -240,16 +209,11 @@ func (c *dynamicResourceClient) Delete(ctx context.Context, name string, opts me
|
||||
if err := validateNamespaceWithOptionalName(c.namespace, name); err != nil {
|
||||
return err
|
||||
}
|
||||
deleteOptionsByte, err := runtime.Encode(deleteOptionsCodec.LegacyCodec(schema.GroupVersion{Version: "v1"}), &opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
result := c.client.client.
|
||||
Delete().
|
||||
AbsPath(append(c.makeURLSegments(name), subresources...)...).
|
||||
SetHeader("Content-Type", runtime.ContentTypeJSON).
|
||||
Body(deleteOptionsByte).
|
||||
Body(&opts).
|
||||
Do(ctx)
|
||||
return result.Error()
|
||||
}
|
||||
@@ -259,16 +223,10 @@ func (c *dynamicResourceClient) DeleteCollection(ctx context.Context, opts metav
|
||||
return err
|
||||
}
|
||||
|
||||
deleteOptionsByte, err := runtime.Encode(deleteOptionsCodec.LegacyCodec(schema.GroupVersion{Version: "v1"}), &opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
result := c.client.client.
|
||||
Delete().
|
||||
AbsPath(c.makeURLSegments("")...).
|
||||
SetHeader("Content-Type", runtime.ContentTypeJSON).
|
||||
Body(deleteOptionsByte).
|
||||
Body(&opts).
|
||||
SpecificallyVersionedParams(&listOptions, dynamicParameterCodec, versionV1).
|
||||
Do(ctx)
|
||||
return result.Error()
|
||||
@@ -281,20 +239,15 @@ func (c *dynamicResourceClient) Get(ctx context.Context, name string, opts metav
|
||||
if err := validateNamespaceWithOptionalName(c.namespace, name); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := c.client.client.Get().AbsPath(append(c.makeURLSegments(name), subresources...)...).SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1).Do(ctx)
|
||||
if err := result.Error(); err != nil {
|
||||
var out unstructured.Unstructured
|
||||
if err := c.client.client.
|
||||
Get().
|
||||
AbsPath(append(c.makeURLSegments(name), subresources...)...).
|
||||
SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1).
|
||||
Do(ctx).Into(&out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
retBytes, err := result.Raw()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
obj := &unstructured.Unstructured{}
|
||||
err = runtime.DecodeInto(unstructured.UnstructuredJSONScheme, retBytes, obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj, nil
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *dynamicResourceClient) List(ctx context.Context, opts metav1.ListOptions) (*unstructured.UnstructuredList, error) {
|
||||
@@ -319,27 +272,15 @@ func (c *dynamicResourceClient) list(ctx context.Context, opts metav1.ListOption
|
||||
if err := validateNamespaceWithOptionalName(c.namespace); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := c.client.client.Get().AbsPath(c.makeURLSegments("")...).SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1).Do(ctx)
|
||||
if err := result.Error(); err != nil {
|
||||
var out unstructured.UnstructuredList
|
||||
if err := c.client.client.
|
||||
Get().
|
||||
AbsPath(c.makeURLSegments("")...).
|
||||
SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1).
|
||||
Do(ctx).Into(&out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
retBytes, err := result.Raw()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uncastObj, err := runtime.Decode(unstructured.UnstructuredJSONScheme, retBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list, ok := uncastObj.(*unstructured.UnstructuredList); ok {
|
||||
return list, nil
|
||||
}
|
||||
|
||||
list, err := uncastObj.(*unstructured.Unstructured).ToList()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return list, nil
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
// watchList establishes a watch stream with the server and returns an unstructured list.
|
||||
@@ -380,24 +321,16 @@ func (c *dynamicResourceClient) Patch(ctx context.Context, name string, pt types
|
||||
if err := validateNamespaceWithOptionalName(c.namespace, name); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := c.client.client.
|
||||
var out unstructured.Unstructured
|
||||
if err := c.client.client.
|
||||
Patch(pt).
|
||||
AbsPath(append(c.makeURLSegments(name), subresources...)...).
|
||||
Body(data).
|
||||
SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1).
|
||||
Do(ctx)
|
||||
if err := result.Error(); err != nil {
|
||||
Do(ctx).Into(&out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
retBytes, err := result.Raw()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uncastObj, err := runtime.Decode(unstructured.UnstructuredJSONScheme, retBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return uncastObj.(*unstructured.Unstructured), nil
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *dynamicResourceClient) Apply(ctx context.Context, name string, obj *unstructured.Unstructured, opts metav1.ApplyOptions, subresources ...string) (*unstructured.Unstructured, error) {
|
||||
@@ -435,12 +368,13 @@ func (c *dynamicResourceClient) Apply(ctx context.Context, name string, obj *uns
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uncastObj, err := runtime.Decode(unstructured.UnstructuredJSONScheme, retBytes)
|
||||
if err != nil {
|
||||
var out unstructured.Unstructured
|
||||
if err := runtime.DecodeInto(unstructured.UnstructuredJSONScheme, retBytes, &out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return uncastObj.(*unstructured.Unstructured), nil
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (c *dynamicResourceClient) ApplyStatus(ctx context.Context, name string, obj *unstructured.Unstructured, opts metav1.ApplyOptions) (*unstructured.Unstructured, error) {
|
||||
return c.Apply(ctx, name, obj, opts, "status")
|
||||
}
|
||||
|
||||
@@ -31,8 +31,6 @@ import (
|
||||
// _ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||
//
|
||||
// Or uncomment to load specific auth plugins
|
||||
// _ "k8s.io/client-go/plugin/pkg/client/auth/azure"
|
||||
// _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
|
||||
// _ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
|
||||
)
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@ import (
|
||||
// _ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||
//
|
||||
// Or uncomment to load specific auth plugins
|
||||
// _ "k8s.io/client-go/plugin/pkg/client/auth/azure"
|
||||
// _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
|
||||
// _ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
|
||||
)
|
||||
|
||||
|
||||
@@ -18,9 +18,11 @@ package features
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
// NOTE: types Feature, FeatureSpec, prerelease (and its values)
|
||||
@@ -141,3 +143,43 @@ var (
|
||||
// should use AddFeaturesToExistingFeatureGates followed by ReplaceFeatureGates.
|
||||
featureGates = &atomic.Value{}
|
||||
)
|
||||
|
||||
// TestOnlyFeatureGates is a distinct registry of pre-alpha client features that must not be
|
||||
// included in runtime wiring to command-line flags or environment variables. It exists as a risk
|
||||
// mitigation to allow only programmatic enablement of CBOR serialization for integration testing
|
||||
// purposes.
|
||||
//
|
||||
// TODO: Once all required integration test coverage is complete, this will be deleted and the
|
||||
// test-only feature gates will be replaced by normal feature gates.
|
||||
var TestOnlyFeatureGates = &testOnlyFeatureGates{
|
||||
features: map[Feature]bool{
|
||||
TestOnlyClientAllowsCBOR: false,
|
||||
TestOnlyClientPrefersCBOR: false,
|
||||
},
|
||||
}
|
||||
|
||||
type testOnlyFeatureGates struct {
|
||||
lock sync.RWMutex
|
||||
features map[Feature]bool
|
||||
}
|
||||
|
||||
func (t *testOnlyFeatureGates) Enabled(feature Feature) bool {
|
||||
t.lock.RLock()
|
||||
defer t.lock.RUnlock()
|
||||
|
||||
enabled, ok := t.features[feature]
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("test-only feature %q not recognized", feature))
|
||||
}
|
||||
return enabled
|
||||
}
|
||||
|
||||
func (t *testOnlyFeatureGates) Set(feature Feature, enabled bool) error {
|
||||
t.lock.Lock()
|
||||
defer t.lock.Unlock()
|
||||
if _, ok := t.features[feature]; !ok {
|
||||
return fmt.Errorf("test-only feature %q not recognized", feature)
|
||||
}
|
||||
t.features[feature] = enabled
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -41,6 +41,27 @@ const (
|
||||
// owner: @nilekhc
|
||||
// alpha: v1.30
|
||||
InformerResourceVersion Feature = "InformerResourceVersion"
|
||||
|
||||
// owner: @benluddy
|
||||
// kep: https://kep.k8s.io/4222
|
||||
//
|
||||
// If disabled, clients configured to accept "application/cbor" will instead accept
|
||||
// "application/json" with the same relative preference, and clients configured to write
|
||||
// "application/cbor" or "application/apply-patch+cbor" will instead write
|
||||
// "application/json" or "application/apply-patch+yaml", respectively.
|
||||
//
|
||||
// This feature is currently PRE-ALPHA and MUST NOT be enabled outside of integration tests.
|
||||
TestOnlyClientAllowsCBOR Feature = "TestOnlyClientAllowsCBOR"
|
||||
|
||||
// owner: @benluddy
|
||||
// kep: https://kep.k8s.io/4222
|
||||
//
|
||||
// If enabled AND TestOnlyClientAllowsCBOR is also enabled, the default request content type
|
||||
// (if not explicitly configured) and the dynamic client's request content type both become
|
||||
// "application/cbor".
|
||||
//
|
||||
// This feature is currently PRE-ALPHA and MUST NOT be enabled outside of integration tests.
|
||||
TestOnlyClientPrefersCBOR Feature = "TestOnlyClientPrefersCBOR"
|
||||
)
|
||||
|
||||
// defaultKubernetesFeatureGates consists of all known Kubernetes-specific feature keys.
|
||||
|
||||
@@ -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()).
|
||||
|
||||
26
go.mod
26
go.mod
@@ -15,23 +15,24 @@ require (
|
||||
github.com/google/gofuzz v1.2.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/gorilla/websocket v1.5.0
|
||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7
|
||||
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.9.0
|
||||
go.uber.org/goleak v1.3.0
|
||||
golang.org/x/net v0.28.0
|
||||
golang.org/x/oauth2 v0.21.0
|
||||
golang.org/x/term v0.23.0
|
||||
golang.org/x/time v0.3.0
|
||||
golang.org/x/net v0.30.0
|
||||
golang.org/x/oauth2 v0.23.0
|
||||
golang.org/x/term v0.25.0
|
||||
golang.org/x/time v0.7.0
|
||||
google.golang.org/protobuf v1.34.2
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0
|
||||
k8s.io/api v0.32.0-alpha.1
|
||||
k8s.io/apimachinery v0.32.0-alpha.1
|
||||
k8s.io/api v0.32.0-alpha.3
|
||||
k8s.io/apimachinery v0.32.0-alpha.3
|
||||
k8s.io/klog/v2 v2.130.1
|
||||
k8s.io/kube-openapi v0.0.0-20240827152857-f7e401e7b4c2
|
||||
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd
|
||||
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1
|
||||
sigs.k8s.io/yaml v1.4.0
|
||||
)
|
||||
@@ -50,18 +51,17 @@ require (
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/moby/spdystream v0.4.0 // indirect
|
||||
github.com/moby/spdystream v0.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
|
||||
github.com/onsi/ginkgo/v2 v2.19.0 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
golang.org/x/sys v0.23.0 // indirect
|
||||
golang.org/x/text v0.17.0 // indirect
|
||||
golang.org/x/tools v0.24.0 // indirect
|
||||
golang.org/x/sys v0.26.0 // indirect
|
||||
golang.org/x/text v0.19.0 // indirect
|
||||
golang.org/x/tools v0.26.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
|
||||
48
go.sum
48
go.sum
@@ -43,8 +43,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
|
||||
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM=
|
||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
||||
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJrOjhax5N+uePQ0Fh1Z7PheYoUI/0nzkPA=
|
||||
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
@@ -60,8 +60,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/moby/spdystream v0.4.0 h1:Vy79D6mHeJJjiPdFEL2yku1kl0chZpJfZcPpb16BRl8=
|
||||
github.com/moby/spdystream v0.4.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI=
|
||||
github.com/moby/spdystream v0.5.0 h1:7r0J1Si3QO/kjRitvSLVVFUjxMEb/YLj6S9FF62JBCU=
|
||||
github.com/moby/spdystream v0.5.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
@@ -110,32 +110,32 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
|
||||
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
|
||||
golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
|
||||
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
|
||||
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
|
||||
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
|
||||
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
|
||||
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
|
||||
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
|
||||
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
|
||||
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
|
||||
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
|
||||
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
|
||||
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ=
|
||||
golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
|
||||
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
|
||||
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
|
||||
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@@ -155,18 +155,18 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/api v0.32.0-alpha.1 h1:IouDRwpvuSiAJYsnCd5ygwZEJ6fXjTCrv1ucDjANQxE=
|
||||
k8s.io/api v0.32.0-alpha.1/go.mod h1:dsKOyESAQh5qN2gci8jE1kwo5wqnf1lgCZgj39TFVx4=
|
||||
k8s.io/apimachinery v0.32.0-alpha.1 h1:tDR19SzOmCOKVWtNhFbUtz1Axrt/1JJu7MRFiaEEhF4=
|
||||
k8s.io/apimachinery v0.32.0-alpha.1/go.mod h1:5rKPDwwN9qm//xASFCZ83nyYEanHxxhc7pZ8AC4lukY=
|
||||
k8s.io/api v0.32.0-alpha.3 h1:SCix13lbG8n/cmbYeYp1vkmlS4ccgGwaq83Y7G603GY=
|
||||
k8s.io/api v0.32.0-alpha.3/go.mod h1:e5tjATGvBey/pzjehc7Od+VJCiDJp0iajdkFhxvJD4I=
|
||||
k8s.io/apimachinery v0.32.0-alpha.3 h1:AmhRgOkgXFBLu2prIySmIS4KLGFiZKzeMMxnPPtEhnA=
|
||||
k8s.io/apimachinery v0.32.0-alpha.3/go.mod h1:y/FzDt/GaPgPceo5rJcCtD4qW5l8SwtbzESSMGEY6P8=
|
||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
||||
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||
k8s.io/kube-openapi v0.0.0-20240827152857-f7e401e7b4c2 h1:GKE9U8BH16uynoxQii0auTjmmmuZ3O0LFMN6S0lPPhI=
|
||||
k8s.io/kube-openapi v0.0.0-20240827152857-f7e401e7b4c2/go.mod h1:coRQXBK9NxO98XUv3ZD6AK3xzHCxV6+b7lrquKwaKzA=
|
||||
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A=
|
||||
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
|
||||
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
|
||||
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
|
||||
@@ -374,8 +374,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
||||
// Group=resource.k8s.io, Version=v1alpha3
|
||||
case v1alpha3.SchemeGroupVersion.WithResource("deviceclasses"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha3().DeviceClasses().Informer()}, nil
|
||||
case v1alpha3.SchemeGroupVersion.WithResource("podschedulingcontexts"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha3().PodSchedulingContexts().Informer()}, nil
|
||||
case v1alpha3.SchemeGroupVersion.WithResource("resourceclaims"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha3().ResourceClaims().Informer()}, nil
|
||||
case v1alpha3.SchemeGroupVersion.WithResource("resourceclaimtemplates"):
|
||||
|
||||
@@ -26,8 +26,6 @@ import (
|
||||
type Interface interface {
|
||||
// DeviceClasses returns a DeviceClassInformer.
|
||||
DeviceClasses() DeviceClassInformer
|
||||
// PodSchedulingContexts returns a PodSchedulingContextInformer.
|
||||
PodSchedulingContexts() PodSchedulingContextInformer
|
||||
// ResourceClaims returns a ResourceClaimInformer.
|
||||
ResourceClaims() ResourceClaimInformer
|
||||
// ResourceClaimTemplates returns a ResourceClaimTemplateInformer.
|
||||
@@ -52,11 +50,6 @@ func (v *version) DeviceClasses() DeviceClassInformer {
|
||||
return &deviceClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// PodSchedulingContexts returns a PodSchedulingContextInformer.
|
||||
func (v *version) PodSchedulingContexts() PodSchedulingContextInformer {
|
||||
return &podSchedulingContextInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// ResourceClaims returns a ResourceClaimInformer.
|
||||
func (v *version) ResourceClaims() ResourceClaimInformer {
|
||||
return &resourceClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
Copyright 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.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha3
|
||||
|
||||
import (
|
||||
context "context"
|
||||
time "time"
|
||||
|
||||
apiresourcev1alpha3 "k8s.io/api/resource/v1alpha3"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
|
||||
kubernetes "k8s.io/client-go/kubernetes"
|
||||
resourcev1alpha3 "k8s.io/client-go/listers/resource/v1alpha3"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// PodSchedulingContextInformer provides access to a shared informer and lister for
|
||||
// PodSchedulingContexts.
|
||||
type PodSchedulingContextInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() resourcev1alpha3.PodSchedulingContextLister
|
||||
}
|
||||
|
||||
type podSchedulingContextInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewPodSchedulingContextInformer constructs a new informer for PodSchedulingContext type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewPodSchedulingContextInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredPodSchedulingContextInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredPodSchedulingContextInformer constructs a new informer for PodSchedulingContext type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredPodSchedulingContextInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ResourceV1alpha3().PodSchedulingContexts(namespace).List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ResourceV1alpha3().PodSchedulingContexts(namespace).Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&apiresourcev1alpha3.PodSchedulingContext{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *podSchedulingContextInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredPodSchedulingContextInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *podSchedulingContextInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&apiresourcev1alpha3.PodSchedulingContext{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *podSchedulingContextInformer) Lister() resourcev1alpha3.PodSchedulingContextLister {
|
||||
return resourcev1alpha3.NewPodSchedulingContextLister(f.Informer().GetIndexer())
|
||||
}
|
||||
@@ -103,7 +103,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := admissionregistrationv1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := admissionregistrationv1alpha1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := admissionregistrationv1beta1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := apiserverinternalv1alpha1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := appsv1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -98,7 +98,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := appsv1beta1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := appsv1beta2.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -93,7 +93,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := authenticationv1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := authenticationv1alpha1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := authenticationv1beta1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := authorizationv1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := authorizationv1beta1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := autoscalingv1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := autoscalingv2.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := autoscalingv2beta1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -72,6 +72,8 @@ func newHorizontalPodAutoscalers(c *AutoscalingV2beta1Client, namespace string)
|
||||
},
|
||||
func() *autoscalingv2beta1.HorizontalPodAutoscalerList {
|
||||
return &autoscalingv2beta1.HorizontalPodAutoscalerList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*autoscalingv2beta1.HorizontalPodAutoscaler](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := autoscalingv2beta2.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -72,6 +72,8 @@ func newHorizontalPodAutoscalers(c *AutoscalingV2beta2Client, namespace string)
|
||||
},
|
||||
func() *autoscalingv2beta2.HorizontalPodAutoscalerList {
|
||||
return &autoscalingv2beta2.HorizontalPodAutoscalerList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*autoscalingv2beta2.HorizontalPodAutoscaler](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := batchv1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := batchv1beta1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := certificatesv1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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").
|
||||
|
||||
@@ -88,7 +88,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := certificatesv1alpha1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := certificatesv1beta1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -72,6 +72,8 @@ func newCertificateSigningRequests(c *CertificatesV1beta1Client) *certificateSig
|
||||
},
|
||||
func() *certificatesv1beta1.CertificateSigningRequestList {
|
||||
return &certificatesv1beta1.CertificateSigningRequestList{}
|
||||
}),
|
||||
},
|
||||
gentype.PrefersProtobuf[*certificatesv1beta1.CertificateSigningRequest](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := coordinationv1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := coordinationv1alpha1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func setConfigDefaults(config *rest.Config) error {
|
||||
gv := coordinationv1beta1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
@@ -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](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user