mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 21:12:07 +00:00
Add an example of conflicting members in apply configurations
Signed-off-by: Stephen Kitt <skitt@redhat.com>
This commit is contained in:
parent
eebc897e4f
commit
63439abb40
@ -0,0 +1,22 @@
|
||||
/*
|
||||
Copyright 2024 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=conflicting.test.crd.code-generator.k8s.io
|
||||
// +groupGoName=ConflictingExample
|
||||
|
||||
package v1 // import "k8s.io/code-generator/examples/crd/apis/conflicting/v1"
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright 2015 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: "conflicting.test.crd.code-generator.k8s.io", Version: "v1"}
|
||||
|
||||
var (
|
||||
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
|
||||
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||
SchemeBuilder runtime.SchemeBuilder
|
||||
localSchemeBuilder = &SchemeBuilder
|
||||
AddToScheme = localSchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
func init() {
|
||||
// We only register manually written functions here. The registration of the
|
||||
// generated functions takes place in the generated files. The separation
|
||||
// makes the code compile even when the generated files are missing.
|
||||
localSchemeBuilder.Register(addKnownTypes)
|
||||
}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
// Adds the list of known types to api.Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&TestType{},
|
||||
&TestTypeList{},
|
||||
)
|
||||
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&metav1.Status{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright 2015 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// TestType is a top-level type. A client is created for it.
|
||||
type TestType struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
// +optional
|
||||
Status TestTypeStatus `json:"status,omitempty"`
|
||||
|
||||
TestEmbeddedType `json:"embedded"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// TestTypeList is a top-level list type. The client methods for lists are automatically created.
|
||||
// You are not supposed to create a separate client for this one.
|
||||
type TestTypeList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
Items []TestType `json:"items"`
|
||||
}
|
||||
|
||||
type TestTypeStatus struct {
|
||||
Blah string `json:"blah"`
|
||||
}
|
||||
|
||||
// TestEmbeddedType is a type intended to create conflicts with other embedded structs:
|
||||
// Kind conflicts with TypeMeta (inlined), and Namespace conflicts with ObjectMeta (embedded).
|
||||
type TestEmbeddedType struct {
|
||||
Kind string `json:"kind"`
|
||||
Namespace string `json:"namespace"`
|
||||
}
|
119
staging/src/k8s.io/code-generator/examples/crd/apis/conflicting/v1/zz_generated.deepcopy.go
generated
Normal file
119
staging/src/k8s.io/code-generator/examples/crd/apis/conflicting/v1/zz_generated.deepcopy.go
generated
Normal file
@ -0,0 +1,119 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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 deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TestEmbeddedType) DeepCopyInto(out *TestEmbeddedType) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestEmbeddedType.
|
||||
func (in *TestEmbeddedType) DeepCopy() *TestEmbeddedType {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TestEmbeddedType)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TestType) DeepCopyInto(out *TestType) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Status = in.Status
|
||||
out.TestEmbeddedType = in.TestEmbeddedType
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestType.
|
||||
func (in *TestType) DeepCopy() *TestType {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TestType)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *TestType) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TestTypeList) DeepCopyInto(out *TestTypeList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]TestType, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestTypeList.
|
||||
func (in *TestTypeList) DeepCopy() *TestTypeList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TestTypeList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *TestTypeList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TestTypeStatus) DeepCopyInto(out *TestTypeStatus) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestTypeStatus.
|
||||
func (in *TestTypeStatus) DeepCopy() *TestTypeStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TestTypeStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
33
staging/src/k8s.io/code-generator/examples/crd/apis/conflicting/v1/zz_generated.defaults.go
generated
Normal file
33
staging/src/k8s.io/code-generator/examples/crd/apis/conflicting/v1/zz_generated.defaults.go
generated
Normal file
@ -0,0 +1,33 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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 defaulter-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// RegisterDefaults adds defaulters functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
// All generated defaulters are covering - they call all nested defaulters.
|
||||
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||
return nil
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
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 v1
|
||||
|
||||
// TestEmbeddedTypeApplyConfiguration represents a declarative configuration of the TestEmbeddedType type for use
|
||||
// with apply.
|
||||
type TestEmbeddedTypeApplyConfiguration struct {
|
||||
Kind *string `json:"kind,omitempty"`
|
||||
Namespace *string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
// TestEmbeddedTypeApplyConfiguration constructs a declarative configuration of the TestEmbeddedType type for use with
|
||||
// apply.
|
||||
func TestEmbeddedType() *TestEmbeddedTypeApplyConfiguration {
|
||||
return &TestEmbeddedTypeApplyConfiguration{}
|
||||
}
|
||||
|
||||
// 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 *TestEmbeddedTypeApplyConfiguration) WithKind(value string) *TestEmbeddedTypeApplyConfiguration {
|
||||
b.Kind = &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 *TestEmbeddedTypeApplyConfiguration) WithNamespace(value string) *TestEmbeddedTypeApplyConfiguration {
|
||||
b.Namespace = &value
|
||||
return b
|
||||
}
|
@ -0,0 +1,241 @@
|
||||
/*
|
||||
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 v1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
||||
// with apply.
|
||||
type TestTypeApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Status *TestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||
*TestEmbeddedTypeApplyConfiguration `json:"embedded,omitempty"`
|
||||
}
|
||||
|
||||
// TestType constructs a declarative configuration of the TestType type for use with
|
||||
// apply.
|
||||
func TestType(name, namespace string) *TestTypeApplyConfiguration {
|
||||
b := &TestTypeApplyConfiguration{}
|
||||
b.WithName(name)
|
||||
b.WithNamespace(namespace)
|
||||
b.WithKind("TestType")
|
||||
b.WithAPIVersion("conflicting.test.crd.code-generator.k8s.io/v1")
|
||||
return b
|
||||
}
|
||||
|
||||
// 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 *TestTypeApplyConfiguration) WithKind(value string) *TestTypeApplyConfiguration {
|
||||
b.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 *TestTypeApplyConfiguration) WithAPIVersion(value string) *TestTypeApplyConfiguration {
|
||||
b.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 *TestTypeApplyConfiguration) WithName(value string) *TestTypeApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.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 *TestTypeApplyConfiguration) WithGenerateName(value string) *TestTypeApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.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 *TestTypeApplyConfiguration) WithNamespace(value string) *TestTypeApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.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 *TestTypeApplyConfiguration) WithUID(value types.UID) *TestTypeApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.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 *TestTypeApplyConfiguration) WithResourceVersion(value string) *TestTypeApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.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 *TestTypeApplyConfiguration) WithGeneration(value int64) *TestTypeApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.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 *TestTypeApplyConfiguration) WithCreationTimestamp(value metav1.Time) *TestTypeApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.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 *TestTypeApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *TestTypeApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.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 *TestTypeApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *TestTypeApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.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 *TestTypeApplyConfiguration) WithLabels(entries map[string]string) *TestTypeApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.Labels == nil && len(entries) > 0 {
|
||||
b.Labels = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.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 *TestTypeApplyConfiguration) WithAnnotations(entries map[string]string) *TestTypeApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.Annotations == nil && len(entries) > 0 {
|
||||
b.Annotations = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.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 *TestTypeApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *TestTypeApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithOwnerReferences")
|
||||
}
|
||||
b.OwnerReferences = append(b.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 *TestTypeApplyConfiguration) WithFinalizers(values ...string) *TestTypeApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
b.Finalizers = append(b.Finalizers, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *TestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
|
||||
if b.ObjectMetaApplyConfiguration == nil {
|
||||
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
|
||||
}
|
||||
}
|
||||
|
||||
// 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 *TestTypeApplyConfiguration) WithStatus(value *TestTypeStatusApplyConfiguration) *TestTypeApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
// 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 *TestTypeApplyConfiguration) WithKind(value string) *TestTypeApplyConfiguration {
|
||||
b.ensureTestEmbeddedTypeApplyConfigurationExists()
|
||||
b.Kind = &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 *TestTypeApplyConfiguration) WithNamespace(value string) *TestTypeApplyConfiguration {
|
||||
b.ensureTestEmbeddedTypeApplyConfigurationExists()
|
||||
b.Namespace = &value
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *TestTypeApplyConfiguration) ensureTestEmbeddedTypeApplyConfigurationExists() {
|
||||
if b.TestEmbeddedTypeApplyConfiguration == nil {
|
||||
b.TestEmbeddedTypeApplyConfiguration = &TestEmbeddedTypeApplyConfiguration{}
|
||||
}
|
||||
}
|
||||
|
||||
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||
func (b *TestTypeApplyConfiguration) GetName() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.Name
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
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 v1
|
||||
|
||||
// TestTypeStatusApplyConfiguration represents a declarative configuration of the TestTypeStatus type for use
|
||||
// with apply.
|
||||
type TestTypeStatusApplyConfiguration struct {
|
||||
Blah *string `json:"blah,omitempty"`
|
||||
}
|
||||
|
||||
// TestTypeStatusApplyConfiguration constructs a declarative configuration of the TestTypeStatus type for use with
|
||||
// apply.
|
||||
func TestTypeStatus() *TestTypeStatusApplyConfiguration {
|
||||
return &TestTypeStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithBlah sets the Blah 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 Blah field is set to the value of the last call.
|
||||
func (b *TestTypeStatusApplyConfiguration) WithBlah(value string) *TestTypeStatusApplyConfiguration {
|
||||
b.Blah = &value
|
||||
return b
|
||||
}
|
@ -22,9 +22,11 @@ import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
testing "k8s.io/client-go/testing"
|
||||
v1 "k8s.io/code-generator/examples/crd/apis/example/v1"
|
||||
v1 "k8s.io/code-generator/examples/crd/apis/conflicting/v1"
|
||||
examplev1 "k8s.io/code-generator/examples/crd/apis/example/v1"
|
||||
example2v1 "k8s.io/code-generator/examples/crd/apis/example2/v1"
|
||||
examplev1 "k8s.io/code-generator/examples/crd/applyconfiguration/example/v1"
|
||||
conflictingv1 "k8s.io/code-generator/examples/crd/applyconfiguration/conflicting/v1"
|
||||
applyconfigurationexamplev1 "k8s.io/code-generator/examples/crd/applyconfiguration/example/v1"
|
||||
applyconfigurationexample2v1 "k8s.io/code-generator/examples/crd/applyconfiguration/example2/v1"
|
||||
internal "k8s.io/code-generator/examples/crd/applyconfiguration/internal"
|
||||
)
|
||||
@ -33,15 +35,23 @@ import (
|
||||
// apply configuration type exists for the given GroupVersionKind.
|
||||
func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
switch kind {
|
||||
// Group=example.crd.code-generator.k8s.io, Version=v1
|
||||
case v1.SchemeGroupVersion.WithKind("ClusterTestType"):
|
||||
return &examplev1.ClusterTestTypeApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("ClusterTestTypeStatus"):
|
||||
return &examplev1.ClusterTestTypeStatusApplyConfiguration{}
|
||||
// Group=conflicting.test.crd.code-generator.k8s.io, Version=v1
|
||||
case v1.SchemeGroupVersion.WithKind("TestEmbeddedType"):
|
||||
return &conflictingv1.TestEmbeddedTypeApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("TestType"):
|
||||
return &examplev1.TestTypeApplyConfiguration{}
|
||||
return &conflictingv1.TestTypeApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("TestTypeStatus"):
|
||||
return &examplev1.TestTypeStatusApplyConfiguration{}
|
||||
return &conflictingv1.TestTypeStatusApplyConfiguration{}
|
||||
|
||||
// Group=example.crd.code-generator.k8s.io, Version=v1
|
||||
case examplev1.SchemeGroupVersion.WithKind("ClusterTestType"):
|
||||
return &applyconfigurationexamplev1.ClusterTestTypeApplyConfiguration{}
|
||||
case examplev1.SchemeGroupVersion.WithKind("ClusterTestTypeStatus"):
|
||||
return &applyconfigurationexamplev1.ClusterTestTypeStatusApplyConfiguration{}
|
||||
case examplev1.SchemeGroupVersion.WithKind("TestType"):
|
||||
return &applyconfigurationexamplev1.TestTypeApplyConfiguration{}
|
||||
case examplev1.SchemeGroupVersion.WithKind("TestTypeStatus"):
|
||||
return &applyconfigurationexamplev1.TestTypeStatusApplyConfiguration{}
|
||||
|
||||
// Group=example.test.crd.code-generator.k8s.io, Version=v1
|
||||
case example2v1.SchemeGroupVersion.WithKind("TestType"):
|
||||
|
@ -25,12 +25,14 @@ import (
|
||||
discovery "k8s.io/client-go/discovery"
|
||||
rest "k8s.io/client-go/rest"
|
||||
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
||||
conflictingexamplev1 "k8s.io/code-generator/examples/crd/clientset/versioned/typed/conflicting/v1"
|
||||
examplev1 "k8s.io/code-generator/examples/crd/clientset/versioned/typed/example/v1"
|
||||
secondexamplev1 "k8s.io/code-generator/examples/crd/clientset/versioned/typed/example2/v1"
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
Discovery() discovery.DiscoveryInterface
|
||||
ConflictingExampleV1() conflictingexamplev1.ConflictingExampleV1Interface
|
||||
ExampleV1() examplev1.ExampleV1Interface
|
||||
SecondExampleV1() secondexamplev1.SecondExampleV1Interface
|
||||
}
|
||||
@ -38,8 +40,14 @@ type Interface interface {
|
||||
// Clientset contains the clients for groups.
|
||||
type Clientset struct {
|
||||
*discovery.DiscoveryClient
|
||||
exampleV1 *examplev1.ExampleV1Client
|
||||
secondExampleV1 *secondexamplev1.SecondExampleV1Client
|
||||
conflictingExampleV1 *conflictingexamplev1.ConflictingExampleV1Client
|
||||
exampleV1 *examplev1.ExampleV1Client
|
||||
secondExampleV1 *secondexamplev1.SecondExampleV1Client
|
||||
}
|
||||
|
||||
// ConflictingExampleV1 retrieves the ConflictingExampleV1Client
|
||||
func (c *Clientset) ConflictingExampleV1() conflictingexamplev1.ConflictingExampleV1Interface {
|
||||
return c.conflictingExampleV1
|
||||
}
|
||||
|
||||
// ExampleV1 retrieves the ExampleV1Client
|
||||
@ -96,6 +104,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset,
|
||||
|
||||
var cs Clientset
|
||||
var err error
|
||||
cs.conflictingExampleV1, err = conflictingexamplev1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.exampleV1, err = examplev1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -125,6 +137,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||
// New creates a new Clientset for the given RESTClient.
|
||||
func New(c rest.Interface) *Clientset {
|
||||
var cs Clientset
|
||||
cs.conflictingExampleV1 = conflictingexamplev1.New(c)
|
||||
cs.exampleV1 = examplev1.New(c)
|
||||
cs.secondExampleV1 = secondexamplev1.New(c)
|
||||
|
||||
|
@ -26,6 +26,8 @@ import (
|
||||
"k8s.io/client-go/testing"
|
||||
applyconfiguration "k8s.io/code-generator/examples/crd/applyconfiguration"
|
||||
clientset "k8s.io/code-generator/examples/crd/clientset/versioned"
|
||||
conflictingexamplev1 "k8s.io/code-generator/examples/crd/clientset/versioned/typed/conflicting/v1"
|
||||
fakeconflictingexamplev1 "k8s.io/code-generator/examples/crd/clientset/versioned/typed/conflicting/v1/fake"
|
||||
examplev1 "k8s.io/code-generator/examples/crd/clientset/versioned/typed/example/v1"
|
||||
fakeexamplev1 "k8s.io/code-generator/examples/crd/clientset/versioned/typed/example/v1/fake"
|
||||
secondexamplev1 "k8s.io/code-generator/examples/crd/clientset/versioned/typed/example2/v1"
|
||||
@ -118,6 +120,11 @@ var (
|
||||
_ testing.FakeClient = &Clientset{}
|
||||
)
|
||||
|
||||
// ConflictingExampleV1 retrieves the ConflictingExampleV1Client
|
||||
func (c *Clientset) ConflictingExampleV1() conflictingexamplev1.ConflictingExampleV1Interface {
|
||||
return &fakeconflictingexamplev1.FakeConflictingExampleV1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// ExampleV1 retrieves the ExampleV1Client
|
||||
func (c *Clientset) ExampleV1() examplev1.ExampleV1Interface {
|
||||
return &fakeexamplev1.FakeExampleV1{Fake: &c.Fake}
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
conflictingexamplev1 "k8s.io/code-generator/examples/crd/apis/conflicting/v1"
|
||||
examplev1 "k8s.io/code-generator/examples/crd/apis/example/v1"
|
||||
secondexamplev1 "k8s.io/code-generator/examples/crd/apis/example2/v1"
|
||||
)
|
||||
@ -32,6 +33,7 @@ var scheme = runtime.NewScheme()
|
||||
var codecs = serializer.NewCodecFactory(scheme)
|
||||
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
conflictingexamplev1.AddToScheme,
|
||||
examplev1.AddToScheme,
|
||||
secondexamplev1.AddToScheme,
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
conflictingexamplev1 "k8s.io/code-generator/examples/crd/apis/conflicting/v1"
|
||||
examplev1 "k8s.io/code-generator/examples/crd/apis/example/v1"
|
||||
secondexamplev1 "k8s.io/code-generator/examples/crd/apis/example2/v1"
|
||||
)
|
||||
@ -32,6 +33,7 @@ var Scheme = runtime.NewScheme()
|
||||
var Codecs = serializer.NewCodecFactory(Scheme)
|
||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
conflictingexamplev1.AddToScheme,
|
||||
examplev1.AddToScheme,
|
||||
secondexamplev1.AddToScheme,
|
||||
}
|
||||
|
@ -0,0 +1,107 @@
|
||||
/*
|
||||
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 client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
rest "k8s.io/client-go/rest"
|
||||
v1 "k8s.io/code-generator/examples/crd/apis/conflicting/v1"
|
||||
"k8s.io/code-generator/examples/crd/clientset/versioned/scheme"
|
||||
)
|
||||
|
||||
type ConflictingExampleV1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
TestTypesGetter
|
||||
}
|
||||
|
||||
// ConflictingExampleV1Client is used to interact with features provided by the conflicting.test.crd.code-generator.k8s.io group.
|
||||
type ConflictingExampleV1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *ConflictingExampleV1Client) TestTypes(namespace string) TestTypeInterface {
|
||||
return newTestTypes(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new ConflictingExampleV1Client for the given config.
|
||||
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
|
||||
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||
func NewForConfig(c *rest.Config) (*ConflictingExampleV1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpClient, err := rest.HTTPClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewForConfigAndClient(&config, httpClient)
|
||||
}
|
||||
|
||||
// NewForConfigAndClient creates a new ConflictingExampleV1Client for the given config and http client.
|
||||
// Note the http client provided takes precedence over the configured transport values.
|
||||
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ConflictingExampleV1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientForConfigAndClient(&config, h)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ConflictingExampleV1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new ConflictingExampleV1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *ConflictingExampleV1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new ConflictingExampleV1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *ConflictingExampleV1Client {
|
||||
return &ConflictingExampleV1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv := v1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *ConflictingExampleV1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.restClient
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
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 client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
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 client-gen. DO NOT EDIT.
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
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 client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
v1 "k8s.io/code-generator/examples/crd/clientset/versioned/typed/conflicting/v1"
|
||||
)
|
||||
|
||||
type FakeConflictingExampleV1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeConflictingExampleV1) TestTypes(namespace string) v1.TestTypeInterface {
|
||||
return &FakeTestTypes{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeConflictingExampleV1) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
@ -0,0 +1,197 @@
|
||||
/*
|
||||
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 client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
json "encoding/json"
|
||||
"fmt"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
v1 "k8s.io/code-generator/examples/crd/apis/conflicting/v1"
|
||||
conflictingv1 "k8s.io/code-generator/examples/crd/applyconfiguration/conflicting/v1"
|
||||
)
|
||||
|
||||
// FakeTestTypes implements TestTypeInterface
|
||||
type FakeTestTypes struct {
|
||||
Fake *FakeConflictingExampleV1
|
||||
ns string
|
||||
}
|
||||
|
||||
var testtypesResource = v1.SchemeGroupVersion.WithResource("testtypes")
|
||||
|
||||
var testtypesKind = v1.SchemeGroupVersion.WithKind("TestType")
|
||||
|
||||
// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any.
|
||||
func (c *FakeTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetActionWithOptions(testtypesResource, c.ns, name, options), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of TestTypes that match those selectors.
|
||||
func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) {
|
||||
emptyResult := &v1.TestTypeList{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListActionWithOptions(testtypesResource, testtypesKind, c.ns, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1.TestTypeList{ListMeta: obj.(*v1.TestTypeList).ListMeta}
|
||||
for _, item := range obj.(*v1.TestTypeList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested testTypes.
|
||||
func (c *FakeTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchActionWithOptions(testtypesResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any.
|
||||
func (c *FakeTestTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any.
|
||||
func (c *FakeTestTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeTestTypes) UpdateStatus(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceActionWithOptions(testtypesResource, "status", c.ns, testType, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
|
||||
// Delete takes name of the testType and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeTestTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteActionWithOptions(testtypesResource, c.ns, name, opts), &v1.TestType{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionActionWithOptions(testtypesResource, c.ns, opts, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1.TestTypeList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched testType.
|
||||
func (c *FakeTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) {
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
|
||||
// Apply takes the given apply declarative configuration, applies it and returns the applied testType.
|
||||
func (c *FakeTestTypes) Apply(ctx context.Context, testType *conflictingv1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error) {
|
||||
if testType == nil {
|
||||
return nil, fmt.Errorf("testType provided to Apply must not be nil")
|
||||
}
|
||||
data, err := json.Marshal(testType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
name := testType.Name
|
||||
if name == nil {
|
||||
return nil, fmt.Errorf("testType.Name must be provided to Apply")
|
||||
}
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
||||
|
||||
// ApplyStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
func (c *FakeTestTypes) ApplyStatus(ctx context.Context, testType *conflictingv1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error) {
|
||||
if testType == nil {
|
||||
return nil, fmt.Errorf("testType provided to Apply must not be nil")
|
||||
}
|
||||
data, err := json.Marshal(testType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
name := testType.Name
|
||||
if name == nil {
|
||||
return nil, fmt.Errorf("testType.Name must be provided to Apply")
|
||||
}
|
||||
emptyResult := &v1.TestType{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.TestType), err
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
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 client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
type TestTypeExpansion interface{}
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
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 client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
v1 "k8s.io/code-generator/examples/crd/apis/conflicting/v1"
|
||||
conflictingv1 "k8s.io/code-generator/examples/crd/applyconfiguration/conflicting/v1"
|
||||
scheme "k8s.io/code-generator/examples/crd/clientset/versioned/scheme"
|
||||
)
|
||||
|
||||
// TestTypesGetter has a method to return a TestTypeInterface.
|
||||
// A group's client should implement this interface.
|
||||
type TestTypesGetter interface {
|
||||
TestTypes(namespace string) TestTypeInterface
|
||||
}
|
||||
|
||||
// TestTypeInterface has methods to work with TestType resources.
|
||||
type TestTypeInterface interface {
|
||||
Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (*v1.TestType, error)
|
||||
Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (*v1.TestType, error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
UpdateStatus(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (*v1.TestType, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.TestType, error)
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*v1.TestTypeList, error)
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error)
|
||||
Apply(ctx context.Context, testType *conflictingv1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
ApplyStatus(ctx context.Context, testType *conflictingv1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error)
|
||||
TestTypeExpansion
|
||||
}
|
||||
|
||||
// testTypes implements TestTypeInterface
|
||||
type testTypes struct {
|
||||
*gentype.ClientWithListAndApply[*v1.TestType, *v1.TestTypeList, *conflictingv1.TestTypeApplyConfiguration]
|
||||
}
|
||||
|
||||
// newTestTypes returns a TestTypes
|
||||
func newTestTypes(c *ConflictingExampleV1Client, namespace string) *testTypes {
|
||||
return &testTypes{
|
||||
gentype.NewClientWithListAndApply[*v1.TestType, *v1.TestTypeList, *conflictingv1.TestTypeApplyConfiguration](
|
||||
"testtypes",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *v1.TestType { return &v1.TestType{} },
|
||||
func() *v1.TestTypeList { return &v1.TestTypeList{} }),
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
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 conflicting
|
||||
|
||||
import (
|
||||
v1 "k8s.io/code-generator/examples/crd/informers/externalversions/conflicting/v1"
|
||||
internalinterfaces "k8s.io/code-generator/examples/crd/informers/externalversions/internalinterfaces"
|
||||
)
|
||||
|
||||
// Interface provides access to each of this group's versions.
|
||||
type Interface interface {
|
||||
// V1 provides access to shared informers for resources in V1.
|
||||
V1() v1.Interface
|
||||
}
|
||||
|
||||
type group struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
namespace string
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
||||
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// V1 returns a new v1.Interface.
|
||||
func (g *group) V1() v1.Interface {
|
||||
return v1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
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 v1
|
||||
|
||||
import (
|
||||
internalinterfaces "k8s.io/code-generator/examples/crd/informers/externalversions/internalinterfaces"
|
||||
)
|
||||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// TestTypes returns a TestTypeInformer.
|
||||
TestTypes() TestTypeInformer
|
||||
}
|
||||
|
||||
type version struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
namespace string
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
||||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// TestTypes returns a TestTypeInformer.
|
||||
func (v *version) TestTypes() TestTypeInformer {
|
||||
return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
/*
|
||||
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 v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
conflictingv1 "k8s.io/code-generator/examples/crd/apis/conflicting/v1"
|
||||
versioned "k8s.io/code-generator/examples/crd/clientset/versioned"
|
||||
internalinterfaces "k8s.io/code-generator/examples/crd/informers/externalversions/internalinterfaces"
|
||||
v1 "k8s.io/code-generator/examples/crd/listers/conflicting/v1"
|
||||
)
|
||||
|
||||
// TestTypeInformer provides access to a shared informer and lister for
|
||||
// TestTypes.
|
||||
type TestTypeInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1.TestTypeLister
|
||||
}
|
||||
|
||||
type testTypeInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewTestTypeInformer constructs a new informer for TestType 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 NewTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredTestTypeInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredTestTypeInformer constructs a new informer for TestType 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 NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ConflictingExampleV1().TestTypes(namespace).List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ConflictingExampleV1().TestTypes(namespace).Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&conflictingv1.TestType{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *testTypeInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&conflictingv1.TestType{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *testTypeInformer) Lister() v1.TestTypeLister {
|
||||
return v1.NewTestTypeLister(f.Informer().GetIndexer())
|
||||
}
|
@ -28,6 +28,7 @@ import (
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
versioned "k8s.io/code-generator/examples/crd/clientset/versioned"
|
||||
conflicting "k8s.io/code-generator/examples/crd/informers/externalversions/conflicting"
|
||||
example "k8s.io/code-generator/examples/crd/informers/externalversions/example"
|
||||
example2 "k8s.io/code-generator/examples/crd/informers/externalversions/example2"
|
||||
internalinterfaces "k8s.io/code-generator/examples/crd/informers/externalversions/internalinterfaces"
|
||||
@ -255,10 +256,15 @@ type SharedInformerFactory interface {
|
||||
// client.
|
||||
InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer
|
||||
|
||||
ConflictingExample() conflicting.Interface
|
||||
Example() example.Interface
|
||||
SecondExample() example2.Interface
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) ConflictingExample() conflicting.Interface {
|
||||
return conflicting.New(f, f.namespace, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Example() example.Interface {
|
||||
return example.New(f, f.namespace, f.tweakListOptions)
|
||||
}
|
||||
|
@ -23,7 +23,8 @@ import (
|
||||
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
v1 "k8s.io/code-generator/examples/crd/apis/example/v1"
|
||||
v1 "k8s.io/code-generator/examples/crd/apis/conflicting/v1"
|
||||
examplev1 "k8s.io/code-generator/examples/crd/apis/example/v1"
|
||||
example2v1 "k8s.io/code-generator/examples/crd/apis/example2/v1"
|
||||
)
|
||||
|
||||
@ -53,10 +54,14 @@ func (f *genericInformer) Lister() cache.GenericLister {
|
||||
// TODO extend this to unknown resources with a client pool
|
||||
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
||||
switch resource {
|
||||
// Group=example.crd.code-generator.k8s.io, Version=v1
|
||||
case v1.SchemeGroupVersion.WithResource("clustertesttypes"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Example().V1().ClusterTestTypes().Informer()}, nil
|
||||
// Group=conflicting.test.crd.code-generator.k8s.io, Version=v1
|
||||
case v1.SchemeGroupVersion.WithResource("testtypes"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.ConflictingExample().V1().TestTypes().Informer()}, nil
|
||||
|
||||
// Group=example.crd.code-generator.k8s.io, Version=v1
|
||||
case examplev1.SchemeGroupVersion.WithResource("clustertesttypes"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Example().V1().ClusterTestTypes().Informer()}, nil
|
||||
case examplev1.SchemeGroupVersion.WithResource("testtypes"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Example().V1().TestTypes().Informer()}, nil
|
||||
|
||||
// Group=example.test.crd.code-generator.k8s.io, Version=v1
|
||||
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
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 lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// TestTypeListerExpansion allows custom methods to be added to
|
||||
// TestTypeLister.
|
||||
type TestTypeListerExpansion interface{}
|
||||
|
||||
// TestTypeNamespaceListerExpansion allows custom methods to be added to
|
||||
// TestTypeNamespaceLister.
|
||||
type TestTypeNamespaceListerExpansion interface{}
|
@ -0,0 +1,70 @@
|
||||
/*
|
||||
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 lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/listers"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
v1 "k8s.io/code-generator/examples/crd/apis/conflicting/v1"
|
||||
)
|
||||
|
||||
// TestTypeLister helps list TestTypes.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type TestTypeLister interface {
|
||||
// List lists all TestTypes in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1.TestType, err error)
|
||||
// TestTypes returns an object that can list and get TestTypes.
|
||||
TestTypes(namespace string) TestTypeNamespaceLister
|
||||
TestTypeListerExpansion
|
||||
}
|
||||
|
||||
// testTypeLister implements the TestTypeLister interface.
|
||||
type testTypeLister struct {
|
||||
listers.ResourceIndexer[*v1.TestType]
|
||||
}
|
||||
|
||||
// NewTestTypeLister returns a new TestTypeLister.
|
||||
func NewTestTypeLister(indexer cache.Indexer) TestTypeLister {
|
||||
return &testTypeLister{listers.New[*v1.TestType](indexer, v1.Resource("testtype"))}
|
||||
}
|
||||
|
||||
// TestTypes returns an object that can list and get TestTypes.
|
||||
func (s *testTypeLister) TestTypes(namespace string) TestTypeNamespaceLister {
|
||||
return testTypeNamespaceLister{listers.NewNamespaced[*v1.TestType](s.ResourceIndexer, namespace)}
|
||||
}
|
||||
|
||||
// TestTypeNamespaceLister helps list and get TestTypes.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type TestTypeNamespaceLister interface {
|
||||
// List lists all TestTypes in the indexer for a given namespace.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1.TestType, err error)
|
||||
// Get retrieves the TestType from the indexer for a given namespace and name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v1.TestType, error)
|
||||
TestTypeNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// testTypeNamespaceLister implements the TestTypeNamespaceLister
|
||||
// interface.
|
||||
type testTypeNamespaceLister struct {
|
||||
listers.ResourceIndexer[*v1.TestType]
|
||||
}
|
Loading…
Reference in New Issue
Block a user