1
0
Fork 0

chore: update docker and k8s

This commit is contained in:
Ludovic Fernandez 2019-08-05 18:24:03 +02:00 committed by Traefiker Bot
parent 2b5c7f9e91
commit c2d440a914
1283 changed files with 67741 additions and 27918 deletions

View file

@ -16,4 +16,5 @@ limitations under the License.
// +k8s:deepcopy-gen=package
// +groupName=example.apiserver.code-generator.k8s.io
package example // import "k8s.io/code-generator/_examples/apiserver/apis/example"

View file

@ -18,4 +18,5 @@ limitations under the License.
// +k8s:defaulter-gen=TypeMeta
// +k8s:conversion-gen=k8s.io/code-generator/_examples/apiserver/apis/example
// +groupName=example.apiserver.code-generator.k8s.io
package v1

View file

@ -34,15 +34,38 @@ func init() {
// RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes.
func RegisterConversions(scheme *runtime.Scheme) error {
return scheme.AddGeneratedConversionFuncs(
Convert_v1_TestType_To_example_TestType,
Convert_example_TestType_To_v1_TestType,
Convert_v1_TestTypeList_To_example_TestTypeList,
Convert_example_TestTypeList_To_v1_TestTypeList,
Convert_v1_TestTypeStatus_To_example_TestTypeStatus,
Convert_example_TestTypeStatus_To_v1_TestTypeStatus,
)
func RegisterConversions(s *runtime.Scheme) error {
if err := s.AddGeneratedConversionFunc((*TestType)(nil), (*example.TestType)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_TestType_To_example_TestType(a.(*TestType), b.(*example.TestType), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*example.TestType)(nil), (*TestType)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_example_TestType_To_v1_TestType(a.(*example.TestType), b.(*TestType), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*TestTypeList)(nil), (*example.TestTypeList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_TestTypeList_To_example_TestTypeList(a.(*TestTypeList), b.(*example.TestTypeList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*example.TestTypeList)(nil), (*TestTypeList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_example_TestTypeList_To_v1_TestTypeList(a.(*example.TestTypeList), b.(*TestTypeList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*TestTypeStatus)(nil), (*example.TestTypeStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_TestTypeStatus_To_example_TestTypeStatus(a.(*TestTypeStatus), b.(*example.TestTypeStatus), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*example.TestTypeStatus)(nil), (*TestTypeStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_example_TestTypeStatus_To_v1_TestTypeStatus(a.(*example.TestTypeStatus), b.(*TestTypeStatus), scope)
}); err != nil {
return err
}
return nil
}
func autoConvert_v1_TestType_To_example_TestType(in *TestType, out *example.TestType, s conversion.Scope) error {

View file

@ -55,7 +55,7 @@ func (in *TestType) DeepCopyObject() runtime.Object {
func (in *TestTypeList) DeepCopyInto(out *TestTypeList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]TestType, len(*in))

View file

@ -55,7 +55,7 @@ func (in *TestType) DeepCopyObject() runtime.Object {
func (in *TestTypeList) DeepCopyInto(out *TestTypeList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]TestType, len(*in))

View file

@ -17,4 +17,5 @@ limitations under the License.
// +k8s:deepcopy-gen=package
// +groupName=example.test.apiserver.code-generator.k8s.io
// +groupGoName=SecondExample
package example2 // import "k8s.io/code-generator/_examples/apiserver/apis/example2"

View file

@ -19,4 +19,5 @@ limitations under the License.
// +groupName=example.test.apiserver.code-generator.k8s.io
// +k8s:conversion-gen=k8s.io/code-generator/_examples/apiserver/apis/example2
// +groupGoName=SecondExample
package v1

View file

@ -34,15 +34,38 @@ func init() {
// RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes.
func RegisterConversions(scheme *runtime.Scheme) error {
return scheme.AddGeneratedConversionFuncs(
Convert_v1_TestType_To_example2_TestType,
Convert_example2_TestType_To_v1_TestType,
Convert_v1_TestTypeList_To_example2_TestTypeList,
Convert_example2_TestTypeList_To_v1_TestTypeList,
Convert_v1_TestTypeStatus_To_example2_TestTypeStatus,
Convert_example2_TestTypeStatus_To_v1_TestTypeStatus,
)
func RegisterConversions(s *runtime.Scheme) error {
if err := s.AddGeneratedConversionFunc((*TestType)(nil), (*example2.TestType)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_TestType_To_example2_TestType(a.(*TestType), b.(*example2.TestType), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*example2.TestType)(nil), (*TestType)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_example2_TestType_To_v1_TestType(a.(*example2.TestType), b.(*TestType), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*TestTypeList)(nil), (*example2.TestTypeList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_TestTypeList_To_example2_TestTypeList(a.(*TestTypeList), b.(*example2.TestTypeList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*example2.TestTypeList)(nil), (*TestTypeList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_example2_TestTypeList_To_v1_TestTypeList(a.(*example2.TestTypeList), b.(*TestTypeList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*TestTypeStatus)(nil), (*example2.TestTypeStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_TestTypeStatus_To_example2_TestTypeStatus(a.(*TestTypeStatus), b.(*example2.TestTypeStatus), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*example2.TestTypeStatus)(nil), (*TestTypeStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_example2_TestTypeStatus_To_v1_TestTypeStatus(a.(*example2.TestTypeStatus), b.(*TestTypeStatus), scope)
}); err != nil {
return err
}
return nil
}
func autoConvert_v1_TestType_To_example2_TestType(in *TestType, out *example2.TestType, s conversion.Scope) error {

View file

@ -55,7 +55,7 @@ func (in *TestType) DeepCopyObject() runtime.Object {
func (in *TestTypeList) DeepCopyInto(out *TestTypeList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]TestType, len(*in))

View file

@ -55,7 +55,7 @@ func (in *TestType) DeepCopyObject() runtime.Object {
func (in *TestTypeList) DeepCopyInto(out *TestTypeList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]TestType, len(*in))

View file

@ -43,7 +43,7 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
}
}
cs := &Clientset{}
cs := &Clientset{tracker: o}
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
cs.AddReactor("*", "*", testing.ObjectReaction(o))
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
@ -65,12 +65,17 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
type Clientset struct {
testing.Fake
discovery *fakediscovery.FakeDiscovery
tracker testing.ObjectTracker
}
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
return c.discovery
}
func (c *Clientset) Tracker() testing.ObjectTracker {
return c.tracker
}
var _ clientset.Interface = &Clientset{}
// Example retrieves the ExampleClient

View file

@ -23,6 +23,7 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
exampleinternalversion "k8s.io/code-generator/_examples/apiserver/apis/example"
secondexampleinternalversion "k8s.io/code-generator/_examples/apiserver/apis/example2"
)
@ -30,10 +31,9 @@ import (
var scheme = runtime.NewScheme()
var codecs = serializer.NewCodecFactory(scheme)
var parameterCodec = runtime.NewParameterCodec(scheme)
func init() {
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
AddToScheme(scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
exampleinternalversion.AddToScheme,
secondexampleinternalversion.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
@ -46,11 +46,13 @@ func init() {
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
func AddToScheme(scheme *runtime.Scheme) {
exampleinternalversion.AddToScheme(scheme)
secondexampleinternalversion.AddToScheme(scheme)
var AddToScheme = localSchemeBuilder.AddToScheme
func init() {
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
utilruntime.Must(AddToScheme(scheme))
}

View file

@ -131,7 +131,7 @@ func (c *FakeTestTypes) DeleteCollection(options *v1.DeleteOptions, listOptions
// Patch applies the patch and returns the patched testType.
func (c *FakeTestTypes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *example.TestType, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, data, subresources...), &example.TestType{})
Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, pt, data, subresources...), &example.TestType{})
if obj == nil {
return nil, err

View file

@ -19,6 +19,8 @@ limitations under the License.
package internalversion
import (
"time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
@ -76,11 +78,16 @@ func (c *testTypes) Get(name string, options v1.GetOptions) (result *example.Tes
// List takes label and field selectors, and returns the list of TestTypes that match those selectors.
func (c *testTypes) List(opts v1.ListOptions) (result *example.TestTypeList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &example.TestTypeList{}
err = c.client.Get().
Namespace(c.ns).
Resource("testtypes").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
@ -88,11 +95,16 @@ func (c *testTypes) List(opts v1.ListOptions) (result *example.TestTypeList, err
// Watch returns a watch.Interface that watches the requested testTypes.
func (c *testTypes) Watch(opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("testtypes").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
@ -150,10 +162,15 @@ func (c *testTypes) Delete(name string, options *v1.DeleteOptions) error {
// DeleteCollection deletes a collection of objects.
func (c *testTypes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("testtypes").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()

View file

@ -131,7 +131,7 @@ func (c *FakeTestTypes) DeleteCollection(options *v1.DeleteOptions, listOptions
// Patch applies the patch and returns the patched testType.
func (c *FakeTestTypes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *example2.TestType, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, data, subresources...), &example2.TestType{})
Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, pt, data, subresources...), &example2.TestType{})
if obj == nil {
return nil, err

View file

@ -19,6 +19,8 @@ limitations under the License.
package internalversion
import (
"time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
@ -76,11 +78,16 @@ func (c *testTypes) Get(name string, options v1.GetOptions) (result *example2.Te
// List takes label and field selectors, and returns the list of TestTypes that match those selectors.
func (c *testTypes) List(opts v1.ListOptions) (result *example2.TestTypeList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &example2.TestTypeList{}
err = c.client.Get().
Namespace(c.ns).
Resource("testtypes").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
@ -88,11 +95,16 @@ func (c *testTypes) List(opts v1.ListOptions) (result *example2.TestTypeList, er
// Watch returns a watch.Interface that watches the requested testTypes.
func (c *testTypes) Watch(opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("testtypes").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
@ -150,10 +162,15 @@ func (c *testTypes) Delete(name string, options *v1.DeleteOptions) error {
// DeleteCollection deletes a collection of objects.
func (c *testTypes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("testtypes").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()

View file

@ -29,11 +29,7 @@ import (
type Interface interface {
Discovery() discovery.DiscoveryInterface
ExampleV1() examplev1.ExampleV1Interface
// Deprecated: please explicitly pick a version if possible.
Example() examplev1.ExampleV1Interface
SecondExampleV1() secondexamplev1.SecondExampleV1Interface
// Deprecated: please explicitly pick a version if possible.
SecondExample() secondexamplev1.SecondExampleV1Interface
}
// Clientset contains the clients for groups. Each group has exactly one
@ -49,23 +45,11 @@ func (c *Clientset) ExampleV1() examplev1.ExampleV1Interface {
return c.exampleV1
}
// Deprecated: Example retrieves the default version of ExampleClient.
// Please explicitly pick a version.
func (c *Clientset) Example() examplev1.ExampleV1Interface {
return c.exampleV1
}
// SecondExampleV1 retrieves the SecondExampleV1Client
func (c *Clientset) SecondExampleV1() secondexamplev1.SecondExampleV1Interface {
return c.secondExampleV1
}
// Deprecated: SecondExample retrieves the default version of SecondExampleClient.
// Please explicitly pick a version.
func (c *Clientset) SecondExample() secondexamplev1.SecondExampleV1Interface {
return c.secondExampleV1
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
if c == nil {

View file

@ -43,7 +43,7 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
}
}
cs := &Clientset{}
cs := &Clientset{tracker: o}
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
cs.AddReactor("*", "*", testing.ObjectReaction(o))
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
@ -65,12 +65,17 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
type Clientset struct {
testing.Fake
discovery *fakediscovery.FakeDiscovery
tracker testing.ObjectTracker
}
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
return c.discovery
}
func (c *Clientset) Tracker() testing.ObjectTracker {
return c.tracker
}
var _ clientset.Interface = &Clientset{}
// ExampleV1 retrieves the ExampleV1Client
@ -78,17 +83,7 @@ func (c *Clientset) ExampleV1() examplev1.ExampleV1Interface {
return &fakeexamplev1.FakeExampleV1{Fake: &c.Fake}
}
// Example retrieves the ExampleV1Client
func (c *Clientset) Example() examplev1.ExampleV1Interface {
return &fakeexamplev1.FakeExampleV1{Fake: &c.Fake}
}
// SecondExampleV1 retrieves the SecondExampleV1Client
func (c *Clientset) SecondExampleV1() secondexamplev1.SecondExampleV1Interface {
return &fakesecondexamplev1.FakeSecondExampleV1{Fake: &c.Fake}
}
// SecondExample retrieves the SecondExampleV1Client
func (c *Clientset) SecondExample() secondexamplev1.SecondExampleV1Interface {
return &fakesecondexamplev1.FakeSecondExampleV1{Fake: &c.Fake}
}

View file

@ -23,6 +23,7 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
examplev1 "k8s.io/code-generator/_examples/apiserver/apis/example/v1"
secondexamplev1 "k8s.io/code-generator/_examples/apiserver/apis/example2/v1"
)
@ -30,10 +31,9 @@ import (
var scheme = runtime.NewScheme()
var codecs = serializer.NewCodecFactory(scheme)
var parameterCodec = runtime.NewParameterCodec(scheme)
func init() {
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
AddToScheme(scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
examplev1.AddToScheme,
secondexamplev1.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
@ -46,11 +46,13 @@ func init() {
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
func AddToScheme(scheme *runtime.Scheme) {
examplev1.AddToScheme(scheme)
secondexamplev1.AddToScheme(scheme)
var AddToScheme = localSchemeBuilder.AddToScheme
func init() {
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
utilruntime.Must(AddToScheme(scheme))
}

View file

@ -23,6 +23,7 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
examplev1 "k8s.io/code-generator/_examples/apiserver/apis/example/v1"
secondexamplev1 "k8s.io/code-generator/_examples/apiserver/apis/example2/v1"
)
@ -30,10 +31,9 @@ import (
var Scheme = runtime.NewScheme()
var Codecs = serializer.NewCodecFactory(Scheme)
var ParameterCodec = runtime.NewParameterCodec(Scheme)
func init() {
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
AddToScheme(Scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
examplev1.AddToScheme,
secondexamplev1.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
@ -46,11 +46,13 @@ func init() {
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
func AddToScheme(scheme *runtime.Scheme) {
examplev1.AddToScheme(scheme)
secondexamplev1.AddToScheme(scheme)
var AddToScheme = localSchemeBuilder.AddToScheme
func init() {
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
utilruntime.Must(AddToScheme(Scheme))
}

View file

@ -19,7 +19,6 @@ limitations under the License.
package v1
import (
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
rest "k8s.io/client-go/rest"
v1 "k8s.io/code-generator/_examples/apiserver/apis/example/v1"
"k8s.io/code-generator/_examples/apiserver/clientset/versioned/scheme"
@ -71,7 +70,7 @@ func setConfigDefaults(config *rest.Config) error {
gv := v1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()

View file

@ -25,7 +25,7 @@ import (
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/apiserver/apis/example/v1"
examplev1 "k8s.io/code-generator/_examples/apiserver/apis/example/v1"
)
// FakeTestTypes implements TestTypeInterface
@ -39,20 +39,20 @@ var testtypesResource = schema.GroupVersionResource{Group: "example.apiserver.co
var testtypesKind = schema.GroupVersionKind{Group: "example.apiserver.code-generator.k8s.io", Version: "v1", Kind: "TestType"}
// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any.
func (c *FakeTestTypes) Get(name string, options v1.GetOptions) (result *example_v1.TestType, err error) {
func (c *FakeTestTypes) Get(name string, options v1.GetOptions) (result *examplev1.TestType, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(testtypesResource, c.ns, name), &example_v1.TestType{})
Invokes(testing.NewGetAction(testtypesResource, c.ns, name), &examplev1.TestType{})
if obj == nil {
return nil, err
}
return obj.(*example_v1.TestType), err
return obj.(*examplev1.TestType), err
}
// List takes label and field selectors, and returns the list of TestTypes that match those selectors.
func (c *FakeTestTypes) List(opts v1.ListOptions) (result *example_v1.TestTypeList, err error) {
func (c *FakeTestTypes) List(opts v1.ListOptions) (result *examplev1.TestTypeList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(testtypesResource, testtypesKind, c.ns, opts), &example_v1.TestTypeList{})
Invokes(testing.NewListAction(testtypesResource, testtypesKind, c.ns, opts), &examplev1.TestTypeList{})
if obj == nil {
return nil, err
@ -62,8 +62,8 @@ func (c *FakeTestTypes) List(opts v1.ListOptions) (result *example_v1.TestTypeLi
if label == nil {
label = labels.Everything()
}
list := &example_v1.TestTypeList{ListMeta: obj.(*example_v1.TestTypeList).ListMeta}
for _, item := range obj.(*example_v1.TestTypeList).Items {
list := &examplev1.TestTypeList{ListMeta: obj.(*examplev1.TestTypeList).ListMeta}
for _, item := range obj.(*examplev1.TestTypeList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@ -79,43 +79,43 @@ func (c *FakeTestTypes) Watch(opts v1.ListOptions) (watch.Interface, error) {
}
// 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(testType *example_v1.TestType) (result *example_v1.TestType, err error) {
func (c *FakeTestTypes) Create(testType *examplev1.TestType) (result *examplev1.TestType, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(testtypesResource, c.ns, testType), &example_v1.TestType{})
Invokes(testing.NewCreateAction(testtypesResource, c.ns, testType), &examplev1.TestType{})
if obj == nil {
return nil, err
}
return obj.(*example_v1.TestType), err
return obj.(*examplev1.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(testType *example_v1.TestType) (result *example_v1.TestType, err error) {
func (c *FakeTestTypes) Update(testType *examplev1.TestType) (result *examplev1.TestType, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(testtypesResource, c.ns, testType), &example_v1.TestType{})
Invokes(testing.NewUpdateAction(testtypesResource, c.ns, testType), &examplev1.TestType{})
if obj == nil {
return nil, err
}
return obj.(*example_v1.TestType), err
return obj.(*examplev1.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(testType *example_v1.TestType) (*example_v1.TestType, error) {
func (c *FakeTestTypes) UpdateStatus(testType *examplev1.TestType) (*examplev1.TestType, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(testtypesResource, "status", c.ns, testType), &example_v1.TestType{})
Invokes(testing.NewUpdateSubresourceAction(testtypesResource, "status", c.ns, testType), &examplev1.TestType{})
if obj == nil {
return nil, err
}
return obj.(*example_v1.TestType), err
return obj.(*examplev1.TestType), err
}
// Delete takes name of the testType and deletes it. Returns an error if one occurs.
func (c *FakeTestTypes) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(testtypesResource, c.ns, name), &example_v1.TestType{})
Invokes(testing.NewDeleteAction(testtypesResource, c.ns, name), &examplev1.TestType{})
return err
}
@ -124,17 +124,17 @@ func (c *FakeTestTypes) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeTestTypes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(testtypesResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &example_v1.TestTypeList{})
_, err := c.Fake.Invokes(action, &examplev1.TestTypeList{})
return err
}
// Patch applies the patch and returns the patched testType.
func (c *FakeTestTypes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *example_v1.TestType, err error) {
func (c *FakeTestTypes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *examplev1.TestType, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, data, subresources...), &example_v1.TestType{})
Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, pt, data, subresources...), &examplev1.TestType{})
if obj == nil {
return nil, err
}
return obj.(*example_v1.TestType), err
return obj.(*examplev1.TestType), err
}

View file

@ -19,7 +19,9 @@ limitations under the License.
package v1
import (
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"time"
metav1 "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"
@ -38,11 +40,11 @@ type TestTypeInterface interface {
Create(*v1.TestType) (*v1.TestType, error)
Update(*v1.TestType) (*v1.TestType, error)
UpdateStatus(*v1.TestType) (*v1.TestType, 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.TestType, error)
List(opts meta_v1.ListOptions) (*v1.TestTypeList, error)
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
Get(name string, options metav1.GetOptions) (*v1.TestType, error)
List(opts metav1.ListOptions) (*v1.TestTypeList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.TestType, err error)
TestTypeExpansion
}
@ -62,7 +64,7 @@ func newTestTypes(c *ExampleV1Client, namespace string) *testTypes {
}
// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any.
func (c *testTypes) Get(name string, options meta_v1.GetOptions) (result *v1.TestType, err error) {
func (c *testTypes) Get(name string, options metav1.GetOptions) (result *v1.TestType, err error) {
result = &v1.TestType{}
err = c.client.Get().
Namespace(c.ns).
@ -75,24 +77,34 @@ func (c *testTypes) Get(name string, options meta_v1.GetOptions) (result *v1.Tes
}
// List takes label and field selectors, and returns the list of TestTypes that match those selectors.
func (c *testTypes) List(opts meta_v1.ListOptions) (result *v1.TestTypeList, err error) {
func (c *testTypes) List(opts metav1.ListOptions) (result *v1.TestTypeList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1.TestTypeList{}
err = c.client.Get().
Namespace(c.ns).
Resource("testtypes").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested testTypes.
func (c *testTypes) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
func (c *testTypes) Watch(opts metav1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("testtypes").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
@ -138,7 +150,7 @@ func (c *testTypes) UpdateStatus(testType *v1.TestType) (result *v1.TestType, er
}
// Delete takes name of the testType and deletes it. Returns an error if one occurs.
func (c *testTypes) Delete(name string, options *meta_v1.DeleteOptions) error {
func (c *testTypes) Delete(name string, options *metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("testtypes").
@ -149,11 +161,16 @@ func (c *testTypes) Delete(name string, options *meta_v1.DeleteOptions) error {
}
// DeleteCollection deletes a collection of objects.
func (c *testTypes) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
func (c *testTypes) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("testtypes").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()

View file

@ -19,7 +19,6 @@ limitations under the License.
package v1
import (
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
rest "k8s.io/client-go/rest"
v1 "k8s.io/code-generator/_examples/apiserver/apis/example2/v1"
"k8s.io/code-generator/_examples/apiserver/clientset/versioned/scheme"
@ -71,7 +70,7 @@ func setConfigDefaults(config *rest.Config) error {
gv := v1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()

View file

@ -25,7 +25,7 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
example2_v1 "k8s.io/code-generator/_examples/apiserver/apis/example2/v1"
example2v1 "k8s.io/code-generator/_examples/apiserver/apis/example2/v1"
)
// FakeTestTypes implements TestTypeInterface
@ -39,20 +39,20 @@ var testtypesResource = schema.GroupVersionResource{Group: "example.test.apiserv
var testtypesKind = schema.GroupVersionKind{Group: "example.test.apiserver.code-generator.k8s.io", Version: "v1", Kind: "TestType"}
// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any.
func (c *FakeTestTypes) Get(name string, options v1.GetOptions) (result *example2_v1.TestType, err error) {
func (c *FakeTestTypes) Get(name string, options v1.GetOptions) (result *example2v1.TestType, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(testtypesResource, c.ns, name), &example2_v1.TestType{})
Invokes(testing.NewGetAction(testtypesResource, c.ns, name), &example2v1.TestType{})
if obj == nil {
return nil, err
}
return obj.(*example2_v1.TestType), err
return obj.(*example2v1.TestType), err
}
// List takes label and field selectors, and returns the list of TestTypes that match those selectors.
func (c *FakeTestTypes) List(opts v1.ListOptions) (result *example2_v1.TestTypeList, err error) {
func (c *FakeTestTypes) List(opts v1.ListOptions) (result *example2v1.TestTypeList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(testtypesResource, testtypesKind, c.ns, opts), &example2_v1.TestTypeList{})
Invokes(testing.NewListAction(testtypesResource, testtypesKind, c.ns, opts), &example2v1.TestTypeList{})
if obj == nil {
return nil, err
@ -62,8 +62,8 @@ func (c *FakeTestTypes) List(opts v1.ListOptions) (result *example2_v1.TestTypeL
if label == nil {
label = labels.Everything()
}
list := &example2_v1.TestTypeList{ListMeta: obj.(*example2_v1.TestTypeList).ListMeta}
for _, item := range obj.(*example2_v1.TestTypeList).Items {
list := &example2v1.TestTypeList{ListMeta: obj.(*example2v1.TestTypeList).ListMeta}
for _, item := range obj.(*example2v1.TestTypeList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@ -79,43 +79,43 @@ func (c *FakeTestTypes) Watch(opts v1.ListOptions) (watch.Interface, error) {
}
// 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(testType *example2_v1.TestType) (result *example2_v1.TestType, err error) {
func (c *FakeTestTypes) Create(testType *example2v1.TestType) (result *example2v1.TestType, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(testtypesResource, c.ns, testType), &example2_v1.TestType{})
Invokes(testing.NewCreateAction(testtypesResource, c.ns, testType), &example2v1.TestType{})
if obj == nil {
return nil, err
}
return obj.(*example2_v1.TestType), err
return obj.(*example2v1.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(testType *example2_v1.TestType) (result *example2_v1.TestType, err error) {
func (c *FakeTestTypes) Update(testType *example2v1.TestType) (result *example2v1.TestType, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(testtypesResource, c.ns, testType), &example2_v1.TestType{})
Invokes(testing.NewUpdateAction(testtypesResource, c.ns, testType), &example2v1.TestType{})
if obj == nil {
return nil, err
}
return obj.(*example2_v1.TestType), err
return obj.(*example2v1.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(testType *example2_v1.TestType) (*example2_v1.TestType, error) {
func (c *FakeTestTypes) UpdateStatus(testType *example2v1.TestType) (*example2v1.TestType, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(testtypesResource, "status", c.ns, testType), &example2_v1.TestType{})
Invokes(testing.NewUpdateSubresourceAction(testtypesResource, "status", c.ns, testType), &example2v1.TestType{})
if obj == nil {
return nil, err
}
return obj.(*example2_v1.TestType), err
return obj.(*example2v1.TestType), err
}
// Delete takes name of the testType and deletes it. Returns an error if one occurs.
func (c *FakeTestTypes) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(testtypesResource, c.ns, name), &example2_v1.TestType{})
Invokes(testing.NewDeleteAction(testtypesResource, c.ns, name), &example2v1.TestType{})
return err
}
@ -124,17 +124,17 @@ func (c *FakeTestTypes) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeTestTypes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(testtypesResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &example2_v1.TestTypeList{})
_, err := c.Fake.Invokes(action, &example2v1.TestTypeList{})
return err
}
// Patch applies the patch and returns the patched testType.
func (c *FakeTestTypes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *example2_v1.TestType, err error) {
func (c *FakeTestTypes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *example2v1.TestType, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, data, subresources...), &example2_v1.TestType{})
Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, pt, data, subresources...), &example2v1.TestType{})
if obj == nil {
return nil, err
}
return obj.(*example2_v1.TestType), err
return obj.(*example2v1.TestType), err
}

View file

@ -19,7 +19,9 @@ limitations under the License.
package v1
import (
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"time"
metav1 "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"
@ -38,11 +40,11 @@ type TestTypeInterface interface {
Create(*v1.TestType) (*v1.TestType, error)
Update(*v1.TestType) (*v1.TestType, error)
UpdateStatus(*v1.TestType) (*v1.TestType, 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.TestType, error)
List(opts meta_v1.ListOptions) (*v1.TestTypeList, error)
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
Get(name string, options metav1.GetOptions) (*v1.TestType, error)
List(opts metav1.ListOptions) (*v1.TestTypeList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.TestType, err error)
TestTypeExpansion
}
@ -62,7 +64,7 @@ func newTestTypes(c *SecondExampleV1Client, namespace string) *testTypes {
}
// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any.
func (c *testTypes) Get(name string, options meta_v1.GetOptions) (result *v1.TestType, err error) {
func (c *testTypes) Get(name string, options metav1.GetOptions) (result *v1.TestType, err error) {
result = &v1.TestType{}
err = c.client.Get().
Namespace(c.ns).
@ -75,24 +77,34 @@ func (c *testTypes) Get(name string, options meta_v1.GetOptions) (result *v1.Tes
}
// List takes label and field selectors, and returns the list of TestTypes that match those selectors.
func (c *testTypes) List(opts meta_v1.ListOptions) (result *v1.TestTypeList, err error) {
func (c *testTypes) List(opts metav1.ListOptions) (result *v1.TestTypeList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1.TestTypeList{}
err = c.client.Get().
Namespace(c.ns).
Resource("testtypes").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested testTypes.
func (c *testTypes) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
func (c *testTypes) Watch(opts metav1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("testtypes").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
@ -138,7 +150,7 @@ func (c *testTypes) UpdateStatus(testType *v1.TestType) (result *v1.TestType, er
}
// Delete takes name of the testType and deletes it. Returns an error if one occurs.
func (c *testTypes) Delete(name string, options *meta_v1.DeleteOptions) error {
func (c *testTypes) Delete(name string, options *metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("testtypes").
@ -149,11 +161,16 @@ func (c *testTypes) Delete(name string, options *meta_v1.DeleteOptions) error {
}
// DeleteCollection deletes a collection of objects.
func (c *testTypes) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
func (c *testTypes) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("testtypes").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()

View file

@ -21,11 +21,11 @@ package v1
import (
time "time"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
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"
example_v1 "k8s.io/code-generator/_examples/apiserver/apis/example/v1"
examplev1 "k8s.io/code-generator/_examples/apiserver/apis/example/v1"
versioned "k8s.io/code-generator/_examples/apiserver/clientset/versioned"
internalinterfaces "k8s.io/code-generator/_examples/apiserver/informers/externalversions/internalinterfaces"
v1 "k8s.io/code-generator/_examples/apiserver/listers/example/v1"
@ -57,20 +57,20 @@ func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPer
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 meta_v1.ListOptions) (runtime.Object, error) {
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ExampleV1().TestTypes(namespace).List(options)
},
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ExampleV1().TestTypes(namespace).Watch(options)
},
},
&example_v1.TestType{},
&examplev1.TestType{},
resyncPeriod,
indexers,
)
@ -81,7 +81,7 @@ func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPer
}
func (f *testTypeInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&example_v1.TestType{}, f.defaultInformer)
return f.factory.InformerFor(&examplev1.TestType{}, f.defaultInformer)
}
func (f *testTypeInformer) Lister() v1.TestTypeLister {

View file

@ -21,11 +21,11 @@ package v1
import (
time "time"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
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"
example2_v1 "k8s.io/code-generator/_examples/apiserver/apis/example2/v1"
example2v1 "k8s.io/code-generator/_examples/apiserver/apis/example2/v1"
versioned "k8s.io/code-generator/_examples/apiserver/clientset/versioned"
internalinterfaces "k8s.io/code-generator/_examples/apiserver/informers/externalversions/internalinterfaces"
v1 "k8s.io/code-generator/_examples/apiserver/listers/example2/v1"
@ -57,20 +57,20 @@ func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPer
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 meta_v1.ListOptions) (runtime.Object, error) {
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.SecondExampleV1().TestTypes(namespace).List(options)
},
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.SecondExampleV1().TestTypes(namespace).Watch(options)
},
},
&example2_v1.TestType{},
&example2v1.TestType{},
resyncPeriod,
indexers,
)
@ -81,7 +81,7 @@ func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPer
}
func (f *testTypeInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&example2_v1.TestType{}, f.defaultInformer)
return f.factory.InformerFor(&example2v1.TestType{}, f.defaultInformer)
}
func (f *testTypeInformer) Lister() v1.TestTypeLister {

View file

@ -24,7 +24,7 @@ import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
v1 "k8s.io/code-generator/_examples/apiserver/apis/example/v1"
example2_v1 "k8s.io/code-generator/_examples/apiserver/apis/example2/v1"
example2v1 "k8s.io/code-generator/_examples/apiserver/apis/example2/v1"
)
// GenericInformer is type of SharedIndexInformer which will locate and delegate to other
@ -58,7 +58,7 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Example().V1().TestTypes().Informer()}, nil
// Group=example.test.apiserver.code-generator.k8s.io, Version=v1
case example2_v1.SchemeGroupVersion.WithResource("testtypes"):
case example2v1.SchemeGroupVersion.WithResource("testtypes"):
return &genericInformer{resource: resource.GroupResource(), informer: f.SecondExample().V1().TestTypes().Informer()}, nil
}

View file

@ -27,6 +27,7 @@ import (
versioned "k8s.io/code-generator/_examples/apiserver/clientset/versioned"
)
// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer.
type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer
// SharedInformerFactory a small interface to allow for adding an informer without an import cycle
@ -35,4 +36,5 @@ type SharedInformerFactory interface {
InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer
}
// TweakListOptionsFunc is a function that transforms a v1.ListOptions.
type TweakListOptionsFunc func(*v1.ListOptions)

View file

@ -26,7 +26,7 @@ import (
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
example "k8s.io/code-generator/_examples/apiserver/apis/example"
clientset_internalversion "k8s.io/code-generator/_examples/apiserver/clientset/internalversion"
clientsetinternalversion "k8s.io/code-generator/_examples/apiserver/clientset/internalversion"
internalinterfaces "k8s.io/code-generator/_examples/apiserver/informers/internalversion/internalinterfaces"
internalversion "k8s.io/code-generator/_examples/apiserver/listers/example/internalversion"
)
@ -47,14 +47,14 @@ type testTypeInformer struct {
// 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 clientset_internalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
func NewTestTypeInformer(client clientsetinternalversion.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 clientset_internalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
func NewFilteredTestTypeInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
@ -76,7 +76,7 @@ func NewFilteredTestTypeInformer(client clientset_internalversion.Interface, nam
)
}
func (f *testTypeInformer) defaultInformer(client clientset_internalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
func (f *testTypeInformer) defaultInformer(client clientsetinternalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}

View file

@ -26,7 +26,7 @@ import (
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
example2 "k8s.io/code-generator/_examples/apiserver/apis/example2"
clientset_internalversion "k8s.io/code-generator/_examples/apiserver/clientset/internalversion"
clientsetinternalversion "k8s.io/code-generator/_examples/apiserver/clientset/internalversion"
internalinterfaces "k8s.io/code-generator/_examples/apiserver/informers/internalversion/internalinterfaces"
internalversion "k8s.io/code-generator/_examples/apiserver/listers/example2/internalversion"
)
@ -47,14 +47,14 @@ type testTypeInformer struct {
// 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 clientset_internalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
func NewTestTypeInformer(client clientsetinternalversion.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 clientset_internalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
func NewFilteredTestTypeInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
@ -76,7 +76,7 @@ func NewFilteredTestTypeInformer(client clientset_internalversion.Interface, nam
)
}
func (f *testTypeInformer) defaultInformer(client clientset_internalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
func (f *testTypeInformer) defaultInformer(client clientsetinternalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}

View file

@ -27,6 +27,7 @@ import (
internalversion "k8s.io/code-generator/_examples/apiserver/clientset/internalversion"
)
// NewInformerFunc takes internalversion.Interface and time.Duration to return a SharedIndexInformer.
type NewInformerFunc func(internalversion.Interface, time.Duration) cache.SharedIndexInformer
// SharedInformerFactory a small interface to allow for adding an informer without an import cycle
@ -35,4 +36,5 @@ type SharedInformerFactory interface {
InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer
}
// TweakListOptionsFunc is a function that transforms a v1.ListOptions.
type TweakListOptionsFunc func(*v1.ListOptions)