mirror of
https://github.com/kubernetes/sample-controller.git
synced 2026-04-12 00:00:26 +08:00
Merge pull request #63565 from roycaihw/bump-kube-openapi-dep
Automatic merge from submit-queue (batch tested with PRs 59034, 63565, 63533). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Bump kube-openapi dependency picks: https://github.com/kubernetes/kube-openapi/pull/67 ref: https://github.com/kubernetes/kubernetes/issues/63494 **Release note**: ```release-note NONE ``` Kubernetes-commit: 3663dc757e05fb79f23a14ad4f2ba832d6e5962c
This commit is contained in:
+5
-15
@@ -19,25 +19,15 @@ limitations under the License.
|
||||
package install
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/apimachinery/announced"
|
||||
"k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/code-generator/_examples/apiserver/apis/example"
|
||||
"k8s.io/code-generator/_examples/apiserver/apis/example/v1"
|
||||
)
|
||||
|
||||
// Install registers the API group and adds types to a scheme
|
||||
func Install(registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
|
||||
if err := announced.NewGroupMetaFactory(
|
||||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: example.SchemeGroupVersion.Group,
|
||||
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version},
|
||||
AddInternalObjectsToScheme: example.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
v1.SchemeGroupVersion.Version: v1.AddToScheme,
|
||||
},
|
||||
).Register(registry, scheme); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
func Install(scheme *runtime.Scheme) {
|
||||
utilruntime.Must(example.AddToScheme(scheme))
|
||||
utilruntime.Must(v1.AddToScheme(scheme))
|
||||
utilruntime.Must(scheme.SetVersionPriority(v1.SchemeGroupVersion))
|
||||
}
|
||||
|
||||
Generated
Vendored
+5
-15
@@ -19,25 +19,15 @@ limitations under the License.
|
||||
package install
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/apimachinery/announced"
|
||||
"k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/code-generator/_examples/apiserver/apis/example2"
|
||||
"k8s.io/code-generator/_examples/apiserver/apis/example2/v1"
|
||||
)
|
||||
|
||||
// Install registers the API group and adds types to a scheme
|
||||
func Install(registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
|
||||
if err := announced.NewGroupMetaFactory(
|
||||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: example2.SchemeGroupVersion.Group,
|
||||
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version},
|
||||
AddInternalObjectsToScheme: example2.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
v1.SchemeGroupVersion.Version: v1.AddToScheme,
|
||||
},
|
||||
).Register(registry, scheme); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
func Install(scheme *runtime.Scheme) {
|
||||
utilruntime.Must(example2.AddToScheme(scheme))
|
||||
utilruntime.Must(v1.AddToScheme(scheme))
|
||||
utilruntime.Must(scheme.SetVersionPriority(v1.SchemeGroupVersion))
|
||||
}
|
||||
|
||||
Generated
Vendored
+4
-7
@@ -19,7 +19,6 @@ limitations under the License.
|
||||
package scheme
|
||||
|
||||
import (
|
||||
registered "k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
@@ -32,15 +31,13 @@ var Scheme = runtime.NewScheme()
|
||||
var Codecs = serializer.NewCodecFactory(Scheme)
|
||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||
|
||||
var Registry = registered.NewAPIRegistrationManager()
|
||||
|
||||
func init() {
|
||||
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
|
||||
Install(Registry, Scheme)
|
||||
Install(Scheme)
|
||||
}
|
||||
|
||||
// Install registers the API group and adds types to a scheme
|
||||
func Install(registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
|
||||
example.Install(registry, scheme)
|
||||
secondexample.Install(registry, scheme)
|
||||
func Install(scheme *runtime.Scheme) {
|
||||
example.Install(scheme)
|
||||
secondexample.Install(scheme)
|
||||
}
|
||||
|
||||
Generated
Vendored
+2
-7
@@ -66,17 +66,12 @@ func New(c rest.Interface) *ExampleClient {
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
g, err := scheme.Registry.Group("example.apiserver.code-generator.k8s.io")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
config.APIPath = "/apis"
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersions[0].Group {
|
||||
gv := g.GroupVersions[0]
|
||||
if config.GroupVersion == nil || config.GroupVersion.Group != scheme.Scheme.PrioritizedVersionsForGroup("example.apiserver.code-generator.k8s.io")[0].Group {
|
||||
gv := scheme.Scheme.PrioritizedVersionsForGroup("example.apiserver.code-generator.k8s.io")[0]
|
||||
config.GroupVersion = &gv
|
||||
}
|
||||
config.NegotiatedSerializer = scheme.Codecs
|
||||
|
||||
Generated
Vendored
+2
-7
@@ -66,17 +66,12 @@ func New(c rest.Interface) *SecondExampleClient {
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
g, err := scheme.Registry.Group("example.test.apiserver.code-generator.k8s.io")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
config.APIPath = "/apis"
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersions[0].Group {
|
||||
gv := g.GroupVersions[0]
|
||||
if config.GroupVersion == nil || config.GroupVersion.Group != scheme.Scheme.PrioritizedVersionsForGroup("example.test.apiserver.code-generator.k8s.io")[0].Group {
|
||||
gv := scheme.Scheme.PrioritizedVersionsForGroup("example.test.apiserver.code-generator.k8s.io")[0]
|
||||
config.GroupVersion = &gv
|
||||
}
|
||||
config.NegotiatedSerializer = scheme.Codecs
|
||||
|
||||
+27
@@ -45,3 +45,30 @@ type TestTypeList struct {
|
||||
type TestTypeStatus struct {
|
||||
Blah string
|
||||
}
|
||||
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
type ClusterTestTypeList struct {
|
||||
metav1.TypeMeta
|
||||
metav1.ListMeta
|
||||
Items []ClusterTestType
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/kubernetes/pkg/apis/autoscaling.Scale
|
||||
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/kubernetes/pkg/apis/autoscaling.Scale,result=k8s.io/kubernetes/pkg/apis/autoscaling.Scale
|
||||
|
||||
type ClusterTestType struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
// +optional
|
||||
Status ClusterTestTypeStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type ClusterTestTypeStatus struct {
|
||||
Blah string
|
||||
}
|
||||
|
||||
Generated
Vendored
+76
@@ -24,6 +24,82 @@ 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 *ClusterTestType) DeepCopyInto(out *ClusterTestType) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Status = in.Status
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterTestType.
|
||||
func (in *ClusterTestType) DeepCopy() *ClusterTestType {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterTestType)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ClusterTestType) 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 *ClusterTestTypeList) DeepCopyInto(out *ClusterTestTypeList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]ClusterTestType, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterTestTypeList.
|
||||
func (in *ClusterTestTypeList) DeepCopy() *ClusterTestTypeList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterTestTypeList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ClusterTestTypeList) 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 *ClusterTestTypeStatus) DeepCopyInto(out *ClusterTestTypeStatus) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterTestTypeStatus.
|
||||
func (in *ClusterTestTypeStatus) DeepCopy() *ClusterTestTypeStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterTestTypeStatus)
|
||||
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
|
||||
|
||||
Generated
Vendored
+193
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
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 (
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
v1 "k8s.io/code-generator/_examples/crd/apis/example/v1"
|
||||
scheme "k8s.io/code-generator/_examples/crd/clientset/versioned/scheme"
|
||||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
)
|
||||
|
||||
// ClusterTestTypesGetter has a method to return a ClusterTestTypeInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ClusterTestTypesGetter interface {
|
||||
ClusterTestTypes() ClusterTestTypeInterface
|
||||
}
|
||||
|
||||
// ClusterTestTypeInterface has methods to work with ClusterTestType resources.
|
||||
type ClusterTestTypeInterface interface {
|
||||
Create(*v1.ClusterTestType) (*v1.ClusterTestType, error)
|
||||
Update(*v1.ClusterTestType) (*v1.ClusterTestType, error)
|
||||
UpdateStatus(*v1.ClusterTestType) (*v1.ClusterTestType, error)
|
||||
Delete(name string, options *meta_v1.DeleteOptions) error
|
||||
DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error
|
||||
Get(name string, options meta_v1.GetOptions) (*v1.ClusterTestType, error)
|
||||
List(opts meta_v1.ListOptions) (*v1.ClusterTestTypeList, error)
|
||||
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterTestType, err error)
|
||||
GetScale(clusterTestTypeName string, options meta_v1.GetOptions) (*autoscaling.Scale, error)
|
||||
UpdateScale(clusterTestTypeName string, scale *autoscaling.Scale) (*autoscaling.Scale, error)
|
||||
|
||||
ClusterTestTypeExpansion
|
||||
}
|
||||
|
||||
// clusterTestTypes implements ClusterTestTypeInterface
|
||||
type clusterTestTypes struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newClusterTestTypes returns a ClusterTestTypes
|
||||
func newClusterTestTypes(c *ExampleV1Client) *clusterTestTypes {
|
||||
return &clusterTestTypes{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any.
|
||||
func (c *clusterTestTypes) Get(name string, options meta_v1.GetOptions) (result *v1.ClusterTestType, err error) {
|
||||
result = &v1.ClusterTestType{}
|
||||
err = c.client.Get().
|
||||
Resource("clustertesttypes").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors.
|
||||
func (c *clusterTestTypes) List(opts meta_v1.ListOptions) (result *v1.ClusterTestTypeList, err error) {
|
||||
result = &v1.ClusterTestTypeList{}
|
||||
err = c.client.Get().
|
||||
Resource("clustertesttypes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusterTestTypes.
|
||||
func (c *clusterTestTypes) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("clustertesttypes").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any.
|
||||
func (c *clusterTestTypes) Create(clusterTestType *v1.ClusterTestType) (result *v1.ClusterTestType, err error) {
|
||||
result = &v1.ClusterTestType{}
|
||||
err = c.client.Post().
|
||||
Resource("clustertesttypes").
|
||||
Body(clusterTestType).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any.
|
||||
func (c *clusterTestTypes) Update(clusterTestType *v1.ClusterTestType) (result *v1.ClusterTestType, err error) {
|
||||
result = &v1.ClusterTestType{}
|
||||
err = c.client.Put().
|
||||
Resource("clustertesttypes").
|
||||
Name(clusterTestType.Name).
|
||||
Body(clusterTestType).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *clusterTestTypes) UpdateStatus(clusterTestType *v1.ClusterTestType) (result *v1.ClusterTestType, err error) {
|
||||
result = &v1.ClusterTestType{}
|
||||
err = c.client.Put().
|
||||
Resource("clustertesttypes").
|
||||
Name(clusterTestType.Name).
|
||||
SubResource("status").
|
||||
Body(clusterTestType).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterTestType and deletes it. Returns an error if one occurs.
|
||||
func (c *clusterTestTypes) Delete(name string, options *meta_v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("clustertesttypes").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *clusterTestTypes) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("clustertesttypes").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterTestType.
|
||||
func (c *clusterTestTypes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterTestType, err error) {
|
||||
result = &v1.ClusterTestType{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("clustertesttypes").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// GetScale takes name of the clusterTestType, and returns the corresponding autoscaling.Scale object, and an error if there is any.
|
||||
func (c *clusterTestTypes) GetScale(clusterTestTypeName string, options meta_v1.GetOptions) (result *autoscaling.Scale, err error) {
|
||||
result = &autoscaling.Scale{}
|
||||
err = c.client.Get().
|
||||
Resource("clustertesttypes").
|
||||
Name(clusterTestTypeName).
|
||||
SubResource("scale").
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||
func (c *clusterTestTypes) UpdateScale(clusterTestTypeName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
|
||||
result = &autoscaling.Scale{}
|
||||
err = c.client.Put().
|
||||
Resource("clustertesttypes").
|
||||
Name(clusterTestTypeName).
|
||||
SubResource("scale").
|
||||
Body(scale).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
Generated
Vendored
+5
@@ -27,6 +27,7 @@ import (
|
||||
|
||||
type ExampleV1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
ClusterTestTypesGetter
|
||||
TestTypesGetter
|
||||
}
|
||||
|
||||
@@ -35,6 +36,10 @@ type ExampleV1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *ExampleV1Client) ClusterTestTypes() ClusterTestTypeInterface {
|
||||
return newClusterTestTypes(c)
|
||||
}
|
||||
|
||||
func (c *ExampleV1Client) TestTypes(namespace string) TestTypeInterface {
|
||||
return newTestTypes(c, namespace)
|
||||
}
|
||||
|
||||
Generated
Vendored
+152
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
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 (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
example_v1 "k8s.io/code-generator/_examples/crd/apis/example/v1"
|
||||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
)
|
||||
|
||||
// FakeClusterTestTypes implements ClusterTestTypeInterface
|
||||
type FakeClusterTestTypes struct {
|
||||
Fake *FakeExampleV1
|
||||
}
|
||||
|
||||
var clustertesttypesResource = schema.GroupVersionResource{Group: "example.crd.code-generator.k8s.io", Version: "v1", Resource: "clustertesttypes"}
|
||||
|
||||
var clustertesttypesKind = schema.GroupVersionKind{Group: "example.crd.code-generator.k8s.io", Version: "v1", Kind: "ClusterTestType"}
|
||||
|
||||
// Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any.
|
||||
func (c *FakeClusterTestTypes) Get(name string, options v1.GetOptions) (result *example_v1.ClusterTestType, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(clustertesttypesResource, name), &example_v1.ClusterTestType{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*example_v1.ClusterTestType), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors.
|
||||
func (c *FakeClusterTestTypes) List(opts v1.ListOptions) (result *example_v1.ClusterTestTypeList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(clustertesttypesResource, clustertesttypesKind, opts), &example_v1.ClusterTestTypeList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &example_v1.ClusterTestTypeList{}
|
||||
for _, item := range obj.(*example_v1.ClusterTestTypeList).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 clusterTestTypes.
|
||||
func (c *FakeClusterTestTypes) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(clustertesttypesResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any.
|
||||
func (c *FakeClusterTestTypes) Create(clusterTestType *example_v1.ClusterTestType) (result *example_v1.ClusterTestType, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(clustertesttypesResource, clusterTestType), &example_v1.ClusterTestType{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*example_v1.ClusterTestType), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any.
|
||||
func (c *FakeClusterTestTypes) Update(clusterTestType *example_v1.ClusterTestType) (result *example_v1.ClusterTestType, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(clustertesttypesResource, clusterTestType), &example_v1.ClusterTestType{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*example_v1.ClusterTestType), 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 *FakeClusterTestTypes) UpdateStatus(clusterTestType *example_v1.ClusterTestType) (*example_v1.ClusterTestType, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateSubresourceAction(clustertesttypesResource, "status", clusterTestType), &example_v1.ClusterTestType{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*example_v1.ClusterTestType), err
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterTestType and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeClusterTestTypes) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteAction(clustertesttypesResource, name), &example_v1.ClusterTestType{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeClusterTestTypes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(clustertesttypesResource, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &example_v1.ClusterTestTypeList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterTestType.
|
||||
func (c *FakeClusterTestTypes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *example_v1.ClusterTestType, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(clustertesttypesResource, name, data, subresources...), &example_v1.ClusterTestType{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*example_v1.ClusterTestType), err
|
||||
}
|
||||
|
||||
// GetScale takes name of the clusterTestType, and returns the corresponding scale object, and an error if there is any.
|
||||
func (c *FakeClusterTestTypes) GetScale(clusterTestTypeName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetSubresourceAction(clustertesttypesResource, clusterTestTypeName), &autoscaling.Scale{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*autoscaling.Scale), err
|
||||
}
|
||||
|
||||
// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||
func (c *FakeClusterTestTypes) UpdateScale(clusterTestTypeName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateSubresourceAction(clustertesttypesResource, "scale", scale), &autoscaling.Scale{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*autoscaling.Scale), err
|
||||
}
|
||||
Generated
Vendored
+4
@@ -28,6 +28,10 @@ type FakeExampleV1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeExampleV1) ClusterTestTypes() v1.ClusterTestTypeInterface {
|
||||
return &FakeClusterTestTypes{c}
|
||||
}
|
||||
|
||||
func (c *FakeExampleV1) TestTypes(namespace string) v1.TestTypeInterface {
|
||||
return &FakeTestTypes{c, namespace}
|
||||
}
|
||||
|
||||
Generated
Vendored
+2
@@ -18,4 +18,6 @@ limitations under the License.
|
||||
|
||||
package v1
|
||||
|
||||
type ClusterTestTypeExpansion interface{}
|
||||
|
||||
type TestTypeExpansion interface{}
|
||||
|
||||
Generated
Vendored
+88
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
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 (
|
||||
time "time"
|
||||
|
||||
meta_v1 "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"
|
||||
example_v1 "k8s.io/code-generator/_examples/crd/apis/example/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/example/v1"
|
||||
)
|
||||
|
||||
// ClusterTestTypeInformer provides access to a shared informer and lister for
|
||||
// ClusterTestTypes.
|
||||
type ClusterTestTypeInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1.ClusterTestTypeLister
|
||||
}
|
||||
|
||||
type clusterTestTypeInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// NewClusterTestTypeInformer constructs a new informer for ClusterTestType 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 NewClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredClusterTestTypeInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType 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 NewFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ExampleV1().ClusterTestTypes().List(options)
|
||||
},
|
||||
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ExampleV1().ClusterTestTypes().Watch(options)
|
||||
},
|
||||
},
|
||||
&example_v1.ClusterTestType{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *clusterTestTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredClusterTestTypeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *clusterTestTypeInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&example_v1.ClusterTestType{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *clusterTestTypeInformer) Lister() v1.ClusterTestTypeLister {
|
||||
return v1.NewClusterTestTypeLister(f.Informer().GetIndexer())
|
||||
}
|
||||
Generated
Vendored
+7
@@ -24,6 +24,8 @@ import (
|
||||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// ClusterTestTypes returns a ClusterTestTypeInformer.
|
||||
ClusterTestTypes() ClusterTestTypeInformer
|
||||
// TestTypes returns a TestTypeInformer.
|
||||
TestTypes() TestTypeInformer
|
||||
}
|
||||
@@ -39,6 +41,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
||||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// ClusterTestTypes returns a ClusterTestTypeInformer.
|
||||
func (v *version) ClusterTestTypes() ClusterTestTypeInformer {
|
||||
return &clusterTestTypeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// TestTypes returns a TestTypeInformer.
|
||||
func (v *version) TestTypes() TestTypeInformer {
|
||||
return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
|
||||
+2
@@ -54,6 +54,8 @@ func (f *genericInformer) Lister() cache.GenericLister {
|
||||
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
|
||||
case v1.SchemeGroupVersion.WithResource("testtypes"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Example().V1().TestTypes().Informer()}, nil
|
||||
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
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/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
v1 "k8s.io/code-generator/_examples/crd/apis/example/v1"
|
||||
)
|
||||
|
||||
// ClusterTestTypeLister helps list ClusterTestTypes.
|
||||
type ClusterTestTypeLister interface {
|
||||
// List lists all ClusterTestTypes in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1.ClusterTestType, err error)
|
||||
// Get retrieves the ClusterTestType from the index for a given name.
|
||||
Get(name string) (*v1.ClusterTestType, error)
|
||||
ClusterTestTypeListerExpansion
|
||||
}
|
||||
|
||||
// clusterTestTypeLister implements the ClusterTestTypeLister interface.
|
||||
type clusterTestTypeLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewClusterTestTypeLister returns a new ClusterTestTypeLister.
|
||||
func NewClusterTestTypeLister(indexer cache.Indexer) ClusterTestTypeLister {
|
||||
return &clusterTestTypeLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all ClusterTestTypes in the indexer.
|
||||
func (s *clusterTestTypeLister) List(selector labels.Selector) (ret []*v1.ClusterTestType, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.ClusterTestType))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the ClusterTestType from the index for a given name.
|
||||
func (s *clusterTestTypeLister) Get(name string) (*v1.ClusterTestType, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1.Resource("clustertesttype"), name)
|
||||
}
|
||||
return obj.(*v1.ClusterTestType), nil
|
||||
}
|
||||
Generated
Vendored
+4
@@ -18,6 +18,10 @@ limitations under the License.
|
||||
|
||||
package v1
|
||||
|
||||
// ClusterTestTypeListerExpansion allows custom methods to be added to
|
||||
// ClusterTestTypeLister.
|
||||
type ClusterTestTypeListerExpansion interface{}
|
||||
|
||||
// TestTypeListerExpansion allows custom methods to be added to
|
||||
// TestTypeLister.
|
||||
type TestTypeListerExpansion interface{}
|
||||
|
||||
Reference in New Issue
Block a user