mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Update generated code
This commit is contained in:
parent
49968cc660
commit
56fae079e5
@ -1,7 +1,7 @@
|
||||
// Code generated by go-bindata.
|
||||
// sources:
|
||||
// manifests/coredns.yaml
|
||||
// manifests/nginx-ingress.yaml
|
||||
// manifests/traefik.yaml
|
||||
// DO NOT EDIT!
|
||||
|
||||
package deploy
|
||||
@ -89,22 +89,22 @@ func corednsYaml() (*asset, error) {
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _nginxIngressYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\xcc\x31\xae\xc2\x30\x0c\x87\xf1\x3d\xa7\xf0\x05\xda\xea\xe9\x6d\x5e\x59\x38\x01\xbb\x9b\xfe\x55\xac\x24\x6e\x14\x1b\x04\xb7\x47\x95\x58\x58\x3f\xe9\xf7\x49\xd7\x1b\x86\xeb\x61\x4c\xe5\xdf\xe7\x2c\x11\x15\xb3\x1e\xcb\xf3\x2f\x15\xb5\x8d\xe9\x8a\xda\x2e\x77\x19\x91\x1a\x42\x36\x09\xe1\x44\x64\xd2\xc0\x64\xbb\xda\x6b\x52\xdb\x07\xdc\xbf\xd5\xbb\x64\x30\x95\xc7\x8a\xc9\xdf\x1e\x68\xc9\x3b\xf2\x89\xf2\xb9\x61\xf2\x90\xb5\x62\xf9\xc5\x9f\x00\x00\x00\xff\xff\x2d\x6c\xb9\xb9\x8a\x00\x00\x00")
|
||||
var _traefikYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2c\x8c\x41\x0a\xc2\x30\x10\x45\xf7\x39\xc5\x5c\xc0\x16\x71\x37\x5b\x37\x9e\xc0\xfd\x6f\xfa\xc5\x21\x4d\x1a\x32\xa3\xe0\xed\xa5\xd0\xe5\x83\xf7\x1e\xba\x3d\x39\xdc\xf6\xa6\x52\x6e\x3e\x65\x44\x6c\x9c\x6c\x9f\xbf\xd7\x54\xac\xad\x2a\x0f\x6e\xf5\xfe\xc6\x88\x54\x19\x58\x11\xd0\x24\xd2\x50\xa9\x12\x03\x7c\x59\x39\xd9\x3b\x32\x55\xca\x67\xe1\xc5\x7f\x1e\xac\xc9\x3b\xf3\xa1\xe7\x63\xa0\xe2\x81\x65\xe3\x7c\x66\x92\xfe\x01\x00\x00\xff\xff\xbd\x83\x66\xe9\x7f\x00\x00\x00")
|
||||
|
||||
func nginxIngressYamlBytes() ([]byte, error) {
|
||||
func traefikYamlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_nginxIngressYaml,
|
||||
"nginx-ingress.yaml",
|
||||
_traefikYaml,
|
||||
"traefik.yaml",
|
||||
)
|
||||
}
|
||||
|
||||
func nginxIngressYaml() (*asset, error) {
|
||||
bytes, err := nginxIngressYamlBytes()
|
||||
func traefikYaml() (*asset, error) {
|
||||
bytes, err := traefikYamlBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "nginx-ingress.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
|
||||
info := bindataFileInfo{name: "traefik.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
@ -161,8 +161,8 @@ func AssetNames() []string {
|
||||
|
||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"coredns.yaml": corednsYaml,
|
||||
"nginx-ingress.yaml": nginxIngressYaml,
|
||||
"coredns.yaml": corednsYaml,
|
||||
"traefik.yaml": traefikYaml,
|
||||
}
|
||||
|
||||
// AssetDir returns the file names below a certain
|
||||
@ -206,8 +206,8 @@ type bintree struct {
|
||||
}
|
||||
|
||||
var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"coredns.yaml": &bintree{corednsYaml, map[string]*bintree{}},
|
||||
"nginx-ingress.yaml": &bintree{nginxIngressYaml, map[string]*bintree{}},
|
||||
"coredns.yaml": &bintree{corednsYaml, map[string]*bintree{}},
|
||||
"traefik.yaml": &bintree{traefikYaml, map[string]*bintree{}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
|
@ -38,6 +38,39 @@ func (in *ConfigMapList) DeepCopyObject() runtime.Object {
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EndpointsList) DeepCopyInto(out *EndpointsList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]corev1.Endpoints, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointsList.
|
||||
func (in *EndpointsList) DeepCopy() *EndpointsList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EndpointsList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *EndpointsList) 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 *NodeList) DeepCopyInto(out *NodeList) {
|
||||
*out = *in
|
||||
|
441
types/apis/core/v1/zz_generated_endpoints_controller.go
Normal file
441
types/apis/core/v1/zz_generated_endpoints_controller.go
Normal file
@ -0,0 +1,441 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/rancher/norman/controller"
|
||||
"github.com/rancher/norman/objectclient"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
var (
|
||||
EndpointsGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: Version,
|
||||
Group: GroupName,
|
||||
Kind: "Endpoints",
|
||||
}
|
||||
EndpointsResource = metav1.APIResource{
|
||||
Name: "endpoints",
|
||||
SingularName: "endpoints",
|
||||
Namespaced: true,
|
||||
|
||||
Kind: EndpointsGroupVersionKind.Kind,
|
||||
}
|
||||
)
|
||||
|
||||
func NewEndpoints(namespace, name string, obj v1.Endpoints) *v1.Endpoints {
|
||||
obj.APIVersion, obj.Kind = EndpointsGroupVersionKind.ToAPIVersionAndKind()
|
||||
obj.Name = name
|
||||
obj.Namespace = namespace
|
||||
return &obj
|
||||
}
|
||||
|
||||
type EndpointsList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []v1.Endpoints
|
||||
}
|
||||
|
||||
type EndpointsHandlerFunc func(key string, obj *v1.Endpoints) (runtime.Object, error)
|
||||
|
||||
type EndpointsChangeHandlerFunc func(obj *v1.Endpoints) (runtime.Object, error)
|
||||
|
||||
type EndpointsLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*v1.Endpoints, err error)
|
||||
Get(namespace, name string) (*v1.Endpoints, error)
|
||||
}
|
||||
|
||||
type EndpointsController interface {
|
||||
Generic() controller.GenericController
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() EndpointsLister
|
||||
AddHandler(ctx context.Context, name string, handler EndpointsHandlerFunc)
|
||||
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler EndpointsHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
|
||||
type EndpointsInterface interface {
|
||||
ObjectClient() *objectclient.ObjectClient
|
||||
Create(*v1.Endpoints) (*v1.Endpoints, error)
|
||||
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Endpoints, error)
|
||||
Get(name string, opts metav1.GetOptions) (*v1.Endpoints, error)
|
||||
Update(*v1.Endpoints) (*v1.Endpoints, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*EndpointsList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() EndpointsController
|
||||
AddHandler(ctx context.Context, name string, sync EndpointsHandlerFunc)
|
||||
AddLifecycle(ctx context.Context, name string, lifecycle EndpointsLifecycle)
|
||||
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync EndpointsHandlerFunc)
|
||||
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle EndpointsLifecycle)
|
||||
}
|
||||
|
||||
type endpointsLister struct {
|
||||
controller *endpointsController
|
||||
}
|
||||
|
||||
func (l *endpointsLister) List(namespace string, selector labels.Selector) (ret []*v1.Endpoints, err error) {
|
||||
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
|
||||
ret = append(ret, obj.(*v1.Endpoints))
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (l *endpointsLister) Get(namespace, name string) (*v1.Endpoints, error) {
|
||||
var key string
|
||||
if namespace != "" {
|
||||
key = namespace + "/" + name
|
||||
} else {
|
||||
key = name
|
||||
}
|
||||
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(schema.GroupResource{
|
||||
Group: EndpointsGroupVersionKind.Group,
|
||||
Resource: "endpoints",
|
||||
}, key)
|
||||
}
|
||||
return obj.(*v1.Endpoints), nil
|
||||
}
|
||||
|
||||
type endpointsController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *endpointsController) Generic() controller.GenericController {
|
||||
return c.GenericController
|
||||
}
|
||||
|
||||
func (c *endpointsController) Lister() EndpointsLister {
|
||||
return &endpointsLister{
|
||||
controller: c,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *endpointsController) AddHandler(ctx context.Context, name string, handler EndpointsHandlerFunc) {
|
||||
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
|
||||
if obj == nil {
|
||||
return handler(key, nil)
|
||||
} else if v, ok := obj.(*v1.Endpoints); ok {
|
||||
return handler(key, v)
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (c *endpointsController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler EndpointsHandlerFunc) {
|
||||
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
|
||||
if obj == nil {
|
||||
return handler(key, nil)
|
||||
} else if v, ok := obj.(*v1.Endpoints); ok && controller.ObjectInCluster(cluster, obj) {
|
||||
return handler(key, v)
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
type endpointsFactory struct {
|
||||
}
|
||||
|
||||
func (c endpointsFactory) Object() runtime.Object {
|
||||
return &v1.Endpoints{}
|
||||
}
|
||||
|
||||
func (c endpointsFactory) List() runtime.Object {
|
||||
return &EndpointsList{}
|
||||
}
|
||||
|
||||
func (s *endpointsClient) Controller() EndpointsController {
|
||||
s.client.Lock()
|
||||
defer s.client.Unlock()
|
||||
|
||||
c, ok := s.client.endpointsControllers[s.ns]
|
||||
if ok {
|
||||
return c
|
||||
}
|
||||
|
||||
genericController := controller.NewGenericController(EndpointsGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
|
||||
c = &endpointsController{
|
||||
GenericController: genericController,
|
||||
}
|
||||
|
||||
s.client.endpointsControllers[s.ns] = c
|
||||
s.client.starters = append(s.client.starters, c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
type endpointsClient struct {
|
||||
client *Client
|
||||
ns string
|
||||
objectClient *objectclient.ObjectClient
|
||||
controller EndpointsController
|
||||
}
|
||||
|
||||
func (s *endpointsClient) ObjectClient() *objectclient.ObjectClient {
|
||||
return s.objectClient
|
||||
}
|
||||
|
||||
func (s *endpointsClient) Create(o *v1.Endpoints) (*v1.Endpoints, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*v1.Endpoints), err
|
||||
}
|
||||
|
||||
func (s *endpointsClient) Get(name string, opts metav1.GetOptions) (*v1.Endpoints, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*v1.Endpoints), err
|
||||
}
|
||||
|
||||
func (s *endpointsClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Endpoints, error) {
|
||||
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
|
||||
return obj.(*v1.Endpoints), err
|
||||
}
|
||||
|
||||
func (s *endpointsClient) Update(o *v1.Endpoints) (*v1.Endpoints, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*v1.Endpoints), err
|
||||
}
|
||||
|
||||
func (s *endpointsClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *endpointsClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (s *endpointsClient) List(opts metav1.ListOptions) (*EndpointsList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*EndpointsList), err
|
||||
}
|
||||
|
||||
func (s *endpointsClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched deployment.
|
||||
func (s *endpointsClient) Patch(o *v1.Endpoints, patchType types.PatchType, data []byte, subresources ...string) (*v1.Endpoints, error) {
|
||||
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
|
||||
return obj.(*v1.Endpoints), err
|
||||
}
|
||||
|
||||
func (s *endpointsClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
||||
|
||||
func (s *endpointsClient) AddHandler(ctx context.Context, name string, sync EndpointsHandlerFunc) {
|
||||
s.Controller().AddHandler(ctx, name, sync)
|
||||
}
|
||||
|
||||
func (s *endpointsClient) AddLifecycle(ctx context.Context, name string, lifecycle EndpointsLifecycle) {
|
||||
sync := NewEndpointsLifecycleAdapter(name, false, s, lifecycle)
|
||||
s.Controller().AddHandler(ctx, name, sync)
|
||||
}
|
||||
|
||||
func (s *endpointsClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync EndpointsHandlerFunc) {
|
||||
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
|
||||
}
|
||||
|
||||
func (s *endpointsClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle EndpointsLifecycle) {
|
||||
sync := NewEndpointsLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
|
||||
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
|
||||
}
|
||||
|
||||
type EndpointsIndexer func(obj *v1.Endpoints) ([]string, error)
|
||||
|
||||
type EndpointsClientCache interface {
|
||||
Get(namespace, name string) (*v1.Endpoints, error)
|
||||
List(namespace string, selector labels.Selector) ([]*v1.Endpoints, error)
|
||||
|
||||
Index(name string, indexer EndpointsIndexer)
|
||||
GetIndexed(name, key string) ([]*v1.Endpoints, error)
|
||||
}
|
||||
|
||||
type EndpointsClient interface {
|
||||
Create(*v1.Endpoints) (*v1.Endpoints, error)
|
||||
Get(namespace, name string, opts metav1.GetOptions) (*v1.Endpoints, error)
|
||||
Update(*v1.Endpoints) (*v1.Endpoints, error)
|
||||
Delete(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(namespace string, opts metav1.ListOptions) (*EndpointsList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
|
||||
Cache() EndpointsClientCache
|
||||
|
||||
OnCreate(ctx context.Context, name string, sync EndpointsChangeHandlerFunc)
|
||||
OnChange(ctx context.Context, name string, sync EndpointsChangeHandlerFunc)
|
||||
OnRemove(ctx context.Context, name string, sync EndpointsChangeHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
|
||||
Generic() controller.GenericController
|
||||
ObjectClient() *objectclient.ObjectClient
|
||||
Interface() EndpointsInterface
|
||||
}
|
||||
|
||||
type endpointsClientCache struct {
|
||||
client *endpointsClient2
|
||||
}
|
||||
|
||||
type endpointsClient2 struct {
|
||||
iface EndpointsInterface
|
||||
controller EndpointsController
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) Interface() EndpointsInterface {
|
||||
return n.iface
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) Generic() controller.GenericController {
|
||||
return n.iface.Controller().Generic()
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) ObjectClient() *objectclient.ObjectClient {
|
||||
return n.Interface().ObjectClient()
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) Enqueue(namespace, name string) {
|
||||
n.iface.Controller().Enqueue(namespace, name)
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) Create(obj *v1.Endpoints) (*v1.Endpoints, error) {
|
||||
return n.iface.Create(obj)
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.Endpoints, error) {
|
||||
return n.iface.GetNamespaced(namespace, name, opts)
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) Update(obj *v1.Endpoints) (*v1.Endpoints, error) {
|
||||
return n.iface.Update(obj)
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
|
||||
return n.iface.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) List(namespace string, opts metav1.ListOptions) (*EndpointsList, error) {
|
||||
return n.iface.List(opts)
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return n.iface.Watch(opts)
|
||||
}
|
||||
|
||||
func (n *endpointsClientCache) Get(namespace, name string) (*v1.Endpoints, error) {
|
||||
return n.client.controller.Lister().Get(namespace, name)
|
||||
}
|
||||
|
||||
func (n *endpointsClientCache) List(namespace string, selector labels.Selector) ([]*v1.Endpoints, error) {
|
||||
return n.client.controller.Lister().List(namespace, selector)
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) Cache() EndpointsClientCache {
|
||||
n.loadController()
|
||||
return &endpointsClientCache{
|
||||
client: n,
|
||||
}
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) OnCreate(ctx context.Context, name string, sync EndpointsChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name+"-create", &endpointsLifecycleDelegate{create: sync})
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) OnChange(ctx context.Context, name string, sync EndpointsChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name+"-change", &endpointsLifecycleDelegate{update: sync})
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) OnRemove(ctx context.Context, name string, sync EndpointsChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &endpointsLifecycleDelegate{remove: sync})
|
||||
}
|
||||
|
||||
func (n *endpointsClientCache) Index(name string, indexer EndpointsIndexer) {
|
||||
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
|
||||
name: func(obj interface{}) ([]string, error) {
|
||||
if v, ok := obj.(*v1.Endpoints); ok {
|
||||
return indexer(v)
|
||||
}
|
||||
return nil, nil
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *endpointsClientCache) GetIndexed(name, key string) ([]*v1.Endpoints, error) {
|
||||
var result []*v1.Endpoints
|
||||
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, obj := range objs {
|
||||
if v, ok := obj.(*v1.Endpoints); ok {
|
||||
result = append(result, v)
|
||||
}
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (n *endpointsClient2) loadController() {
|
||||
if n.controller == nil {
|
||||
n.controller = n.iface.Controller()
|
||||
}
|
||||
}
|
||||
|
||||
type endpointsLifecycleDelegate struct {
|
||||
create EndpointsChangeHandlerFunc
|
||||
update EndpointsChangeHandlerFunc
|
||||
remove EndpointsChangeHandlerFunc
|
||||
}
|
||||
|
||||
func (n *endpointsLifecycleDelegate) HasCreate() bool {
|
||||
return n.create != nil
|
||||
}
|
||||
|
||||
func (n *endpointsLifecycleDelegate) Create(obj *v1.Endpoints) (runtime.Object, error) {
|
||||
if n.create == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.create(obj)
|
||||
}
|
||||
|
||||
func (n *endpointsLifecycleDelegate) HasFinalize() bool {
|
||||
return n.remove != nil
|
||||
}
|
||||
|
||||
func (n *endpointsLifecycleDelegate) Remove(obj *v1.Endpoints) (runtime.Object, error) {
|
||||
if n.remove == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.remove(obj)
|
||||
}
|
||||
|
||||
func (n *endpointsLifecycleDelegate) Updated(obj *v1.Endpoints) (runtime.Object, error) {
|
||||
if n.update == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.update(obj)
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/lifecycle"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
type EndpointsLifecycle interface {
|
||||
Create(obj *v1.Endpoints) (runtime.Object, error)
|
||||
Remove(obj *v1.Endpoints) (runtime.Object, error)
|
||||
Updated(obj *v1.Endpoints) (runtime.Object, error)
|
||||
}
|
||||
|
||||
type endpointsLifecycleAdapter struct {
|
||||
lifecycle EndpointsLifecycle
|
||||
}
|
||||
|
||||
func (w *endpointsLifecycleAdapter) HasCreate() bool {
|
||||
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
|
||||
return !ok || o.HasCreate()
|
||||
}
|
||||
|
||||
func (w *endpointsLifecycleAdapter) HasFinalize() bool {
|
||||
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
|
||||
return !ok || o.HasFinalize()
|
||||
}
|
||||
|
||||
func (w *endpointsLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Create(obj.(*v1.Endpoints))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *endpointsLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Remove(obj.(*v1.Endpoints))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *endpointsLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Updated(obj.(*v1.Endpoints))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func NewEndpointsLifecycleAdapter(name string, clusterScoped bool, client EndpointsInterface, l EndpointsLifecycle) EndpointsHandlerFunc {
|
||||
adapter := &endpointsLifecycleAdapter{lifecycle: l}
|
||||
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
|
||||
return func(key string, obj *v1.Endpoints) (runtime.Object, error) {
|
||||
newObj, err := syncFn(key, obj)
|
||||
if o, ok := newObj.(runtime.Object); ok {
|
||||
return o, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ type Interface interface {
|
||||
|
||||
NodesGetter
|
||||
ServiceAccountsGetter
|
||||
EndpointsGetter
|
||||
ServicesGetter
|
||||
PodsGetter
|
||||
ConfigMapsGetter
|
||||
@ -32,6 +33,7 @@ type Clients struct {
|
||||
|
||||
Node NodeClient
|
||||
ServiceAccount ServiceAccountClient
|
||||
Endpoints EndpointsClient
|
||||
Service ServiceClient
|
||||
Pod PodClient
|
||||
ConfigMap ConfigMapClient
|
||||
@ -44,6 +46,7 @@ type Client struct {
|
||||
|
||||
nodeControllers map[string]NodeController
|
||||
serviceAccountControllers map[string]ServiceAccountController
|
||||
endpointsControllers map[string]EndpointsController
|
||||
serviceControllers map[string]ServiceController
|
||||
podControllers map[string]PodController
|
||||
configMapControllers map[string]ConfigMapController
|
||||
@ -88,6 +91,9 @@ func NewClientsFromInterface(iface Interface) *Clients {
|
||||
ServiceAccount: &serviceAccountClient2{
|
||||
iface: iface.ServiceAccounts(""),
|
||||
},
|
||||
Endpoints: &endpointsClient2{
|
||||
iface: iface.Endpoints(""),
|
||||
},
|
||||
Service: &serviceClient2{
|
||||
iface: iface.Services(""),
|
||||
},
|
||||
@ -115,6 +121,7 @@ func NewForConfig(config rest.Config) (Interface, error) {
|
||||
|
||||
nodeControllers: map[string]NodeController{},
|
||||
serviceAccountControllers: map[string]ServiceAccountController{},
|
||||
endpointsControllers: map[string]EndpointsController{},
|
||||
serviceControllers: map[string]ServiceController{},
|
||||
podControllers: map[string]PodController{},
|
||||
configMapControllers: map[string]ConfigMapController{},
|
||||
@ -159,6 +166,19 @@ func (c *Client) ServiceAccounts(namespace string) ServiceAccountInterface {
|
||||
}
|
||||
}
|
||||
|
||||
type EndpointsGetter interface {
|
||||
Endpoints(namespace string) EndpointsInterface
|
||||
}
|
||||
|
||||
func (c *Client) Endpoints(namespace string) EndpointsInterface {
|
||||
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &EndpointsResource, EndpointsGroupVersionKind, endpointsFactory{})
|
||||
return &endpointsClient{
|
||||
ns: namespace,
|
||||
client: c,
|
||||
objectClient: objectClient,
|
||||
}
|
||||
}
|
||||
|
||||
type ServicesGetter interface {
|
||||
Services(namespace string) ServiceInterface
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
|
||||
&NodeList{},
|
||||
&ServiceAccountList{},
|
||||
&EndpointsList{},
|
||||
&ServiceList{},
|
||||
&PodList{},
|
||||
&ConfigMapList{},
|
||||
|
Loading…
Reference in New Issue
Block a user