Update vendor

This commit is contained in:
Darren Shepherd 2019-05-09 15:03:45 -07:00
parent 03885fc385
commit 16f7aaab66
409 changed files with 24151 additions and 20484 deletions

View File

@ -1,16 +1,13 @@
package v1
import (
"github.com/rancher/norman/pkg/dynamiclistener"
"github.com/rancher/norman/types"
"github.com/rancher/dynamiclistener"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/intstr"
)
type ListenerConfig struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
@ -18,8 +15,6 @@ type ListenerConfig struct {
}
type Addon struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
@ -37,8 +32,6 @@ type AddonStatus struct {
}
type HelmChart struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

View File

@ -162,6 +162,9 @@ import:
version: 89fcab3d43de07060e4fd4c1547430ed57e87f24
- package: github.com/lithammer/dedent
version: v1.1.0
- package: github.com/matryer/moq
version: ee5226d43009
repo: https://github.com/rancher/moq.git
- package: github.com/mattn/go-shellwords
version: v1.0.3-20-gf8471b0a71ded0
- package: github.com/mattn/go-sqlite3
@ -216,9 +219,16 @@ import:
version: v0.2.0
- package: github.com/prometheus/procfs
version: 65c1f6f8f0fc1e2185eb9863a3bc751496404259
- package: github.com/rancher/norman
version: 50017efee23caa79542ef685b65a7b783e0a73ca
repo: https://github.com/ibuildthecloud/norman.git
- package: github.com/rancher/dynamiclistener
version: 077eb13a904f2c62496f31b158135d9743526f82
- package: github.com/rancher/helm-controller
version: 4f3b43bfd868bcb74fe847f8df88c482e9b70ff8
- package: github.com/rancher/remotedialer
version: 20ec38853712bb6d348f0db9ac47d34c954c6b00
- package: github.com/rancher/wrangler
version: 4202dbfa88013c19238bb004d82e013f0593493d
- package: github.com/rancher/wrangler-api
version: efe26ac6a9d720e1bfa5a8cc5f8dce5ad598ce26
- package: github.com/robfig/cron
version: v1-53-gdf38d32658d878
- package: github.com/rootless-containers/rootlesskit

View File

@ -1,441 +0,0 @@
package v1
import (
"context"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
v1 "k8s.io/api/apps/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 (
DaemonSetGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "DaemonSet",
}
DaemonSetResource = metav1.APIResource{
Name: "daemonsets",
SingularName: "daemonset",
Namespaced: true,
Kind: DaemonSetGroupVersionKind.Kind,
}
)
func NewDaemonSet(namespace, name string, obj v1.DaemonSet) *v1.DaemonSet {
obj.APIVersion, obj.Kind = DaemonSetGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type DaemonSetList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []v1.DaemonSet
}
type DaemonSetHandlerFunc func(key string, obj *v1.DaemonSet) (runtime.Object, error)
type DaemonSetChangeHandlerFunc func(obj *v1.DaemonSet) (runtime.Object, error)
type DaemonSetLister interface {
List(namespace string, selector labels.Selector) (ret []*v1.DaemonSet, err error)
Get(namespace, name string) (*v1.DaemonSet, error)
}
type DaemonSetController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() DaemonSetLister
AddHandler(ctx context.Context, name string, handler DaemonSetHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler DaemonSetHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type DaemonSetInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*v1.DaemonSet) (*v1.DaemonSet, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.DaemonSet, error)
Get(name string, opts metav1.GetOptions) (*v1.DaemonSet, error)
Update(*v1.DaemonSet) (*v1.DaemonSet, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*DaemonSetList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() DaemonSetController
AddHandler(ctx context.Context, name string, sync DaemonSetHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle DaemonSetLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync DaemonSetHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle DaemonSetLifecycle)
}
type daemonSetLister struct {
controller *daemonSetController
}
func (l *daemonSetLister) List(namespace string, selector labels.Selector) (ret []*v1.DaemonSet, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*v1.DaemonSet))
})
return
}
func (l *daemonSetLister) Get(namespace, name string) (*v1.DaemonSet, 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: DaemonSetGroupVersionKind.Group,
Resource: "daemonSet",
}, key)
}
return obj.(*v1.DaemonSet), nil
}
type daemonSetController struct {
controller.GenericController
}
func (c *daemonSetController) Generic() controller.GenericController {
return c.GenericController
}
func (c *daemonSetController) Lister() DaemonSetLister {
return &daemonSetLister{
controller: c,
}
}
func (c *daemonSetController) AddHandler(ctx context.Context, name string, handler DaemonSetHandlerFunc) {
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.DaemonSet); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *daemonSetController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler DaemonSetHandlerFunc) {
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.DaemonSet); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type daemonSetFactory struct {
}
func (c daemonSetFactory) Object() runtime.Object {
return &v1.DaemonSet{}
}
func (c daemonSetFactory) List() runtime.Object {
return &DaemonSetList{}
}
func (s *daemonSetClient) Controller() DaemonSetController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.daemonSetControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(DaemonSetGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &daemonSetController{
GenericController: genericController,
}
s.client.daemonSetControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type daemonSetClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller DaemonSetController
}
func (s *daemonSetClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *daemonSetClient) Create(o *v1.DaemonSet) (*v1.DaemonSet, error) {
obj, err := s.objectClient.Create(o)
return obj.(*v1.DaemonSet), err
}
func (s *daemonSetClient) Get(name string, opts metav1.GetOptions) (*v1.DaemonSet, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*v1.DaemonSet), err
}
func (s *daemonSetClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.DaemonSet, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*v1.DaemonSet), err
}
func (s *daemonSetClient) Update(o *v1.DaemonSet) (*v1.DaemonSet, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*v1.DaemonSet), err
}
func (s *daemonSetClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *daemonSetClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *daemonSetClient) List(opts metav1.ListOptions) (*DaemonSetList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*DaemonSetList), err
}
func (s *daemonSetClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *daemonSetClient) Patch(o *v1.DaemonSet, patchType types.PatchType, data []byte, subresources ...string) (*v1.DaemonSet, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*v1.DaemonSet), err
}
func (s *daemonSetClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *daemonSetClient) AddHandler(ctx context.Context, name string, sync DaemonSetHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *daemonSetClient) AddLifecycle(ctx context.Context, name string, lifecycle DaemonSetLifecycle) {
sync := NewDaemonSetLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *daemonSetClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync DaemonSetHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *daemonSetClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle DaemonSetLifecycle) {
sync := NewDaemonSetLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type DaemonSetIndexer func(obj *v1.DaemonSet) ([]string, error)
type DaemonSetClientCache interface {
Get(namespace, name string) (*v1.DaemonSet, error)
List(namespace string, selector labels.Selector) ([]*v1.DaemonSet, error)
Index(name string, indexer DaemonSetIndexer)
GetIndexed(name, key string) ([]*v1.DaemonSet, error)
}
type DaemonSetClient interface {
Create(*v1.DaemonSet) (*v1.DaemonSet, error)
Get(namespace, name string, opts metav1.GetOptions) (*v1.DaemonSet, error)
Update(*v1.DaemonSet) (*v1.DaemonSet, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*DaemonSetList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() DaemonSetClientCache
OnCreate(ctx context.Context, name string, sync DaemonSetChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync DaemonSetChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync DaemonSetChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() DaemonSetInterface
}
type daemonSetClientCache struct {
client *daemonSetClient2
}
type daemonSetClient2 struct {
iface DaemonSetInterface
controller DaemonSetController
}
func (n *daemonSetClient2) Interface() DaemonSetInterface {
return n.iface
}
func (n *daemonSetClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *daemonSetClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *daemonSetClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *daemonSetClient2) Create(obj *v1.DaemonSet) (*v1.DaemonSet, error) {
return n.iface.Create(obj)
}
func (n *daemonSetClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.DaemonSet, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *daemonSetClient2) Update(obj *v1.DaemonSet) (*v1.DaemonSet, error) {
return n.iface.Update(obj)
}
func (n *daemonSetClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *daemonSetClient2) List(namespace string, opts metav1.ListOptions) (*DaemonSetList, error) {
return n.iface.List(opts)
}
func (n *daemonSetClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *daemonSetClientCache) Get(namespace, name string) (*v1.DaemonSet, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *daemonSetClientCache) List(namespace string, selector labels.Selector) ([]*v1.DaemonSet, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *daemonSetClient2) Cache() DaemonSetClientCache {
n.loadController()
return &daemonSetClientCache{
client: n,
}
}
func (n *daemonSetClient2) OnCreate(ctx context.Context, name string, sync DaemonSetChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &daemonSetLifecycleDelegate{create: sync})
}
func (n *daemonSetClient2) OnChange(ctx context.Context, name string, sync DaemonSetChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &daemonSetLifecycleDelegate{update: sync})
}
func (n *daemonSetClient2) OnRemove(ctx context.Context, name string, sync DaemonSetChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &daemonSetLifecycleDelegate{remove: sync})
}
func (n *daemonSetClientCache) Index(name string, indexer DaemonSetIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*v1.DaemonSet); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *daemonSetClientCache) GetIndexed(name, key string) ([]*v1.DaemonSet, error) {
var result []*v1.DaemonSet
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.DaemonSet); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *daemonSetClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type daemonSetLifecycleDelegate struct {
create DaemonSetChangeHandlerFunc
update DaemonSetChangeHandlerFunc
remove DaemonSetChangeHandlerFunc
}
func (n *daemonSetLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *daemonSetLifecycleDelegate) Create(obj *v1.DaemonSet) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *daemonSetLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *daemonSetLifecycleDelegate) Remove(obj *v1.DaemonSet) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *daemonSetLifecycleDelegate) Updated(obj *v1.DaemonSet) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@ -1,63 +0,0 @@
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type DaemonSetLifecycle interface {
Create(obj *v1.DaemonSet) (runtime.Object, error)
Remove(obj *v1.DaemonSet) (runtime.Object, error)
Updated(obj *v1.DaemonSet) (runtime.Object, error)
}
type daemonSetLifecycleAdapter struct {
lifecycle DaemonSetLifecycle
}
func (w *daemonSetLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *daemonSetLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *daemonSetLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.DaemonSet))
if o == nil {
return nil, err
}
return o, err
}
func (w *daemonSetLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.DaemonSet))
if o == nil {
return nil, err
}
return o, err
}
func (w *daemonSetLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.DaemonSet))
if o == nil {
return nil, err
}
return o, err
}
func NewDaemonSetLifecycleAdapter(name string, clusterScoped bool, client DaemonSetInterface, l DaemonSetLifecycle) DaemonSetHandlerFunc {
adapter := &daemonSetLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.DaemonSet) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@ -1,72 +0,0 @@
package v1
import (
appsv1 "k8s.io/api/apps/v1"
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 *DaemonSetList) DeepCopyInto(out *DaemonSetList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]appsv1.DaemonSet, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DaemonSetList.
func (in *DaemonSetList) DeepCopy() *DaemonSetList {
if in == nil {
return nil
}
out := new(DaemonSetList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *DaemonSetList) 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 *DeploymentList) DeepCopyInto(out *DeploymentList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]appsv1.Deployment, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentList.
func (in *DeploymentList) DeepCopy() *DeploymentList {
if in == nil {
return nil
}
out := new(DeploymentList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *DeploymentList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}

View File

@ -1,441 +0,0 @@
package v1
import (
"context"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
v1 "k8s.io/api/apps/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 (
DeploymentGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "Deployment",
}
DeploymentResource = metav1.APIResource{
Name: "deployments",
SingularName: "deployment",
Namespaced: true,
Kind: DeploymentGroupVersionKind.Kind,
}
)
func NewDeployment(namespace, name string, obj v1.Deployment) *v1.Deployment {
obj.APIVersion, obj.Kind = DeploymentGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type DeploymentList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []v1.Deployment
}
type DeploymentHandlerFunc func(key string, obj *v1.Deployment) (runtime.Object, error)
type DeploymentChangeHandlerFunc func(obj *v1.Deployment) (runtime.Object, error)
type DeploymentLister interface {
List(namespace string, selector labels.Selector) (ret []*v1.Deployment, err error)
Get(namespace, name string) (*v1.Deployment, error)
}
type DeploymentController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() DeploymentLister
AddHandler(ctx context.Context, name string, handler DeploymentHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler DeploymentHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type DeploymentInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*v1.Deployment) (*v1.Deployment, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Deployment, error)
Get(name string, opts metav1.GetOptions) (*v1.Deployment, error)
Update(*v1.Deployment) (*v1.Deployment, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*DeploymentList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() DeploymentController
AddHandler(ctx context.Context, name string, sync DeploymentHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle DeploymentLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync DeploymentHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle DeploymentLifecycle)
}
type deploymentLister struct {
controller *deploymentController
}
func (l *deploymentLister) List(namespace string, selector labels.Selector) (ret []*v1.Deployment, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*v1.Deployment))
})
return
}
func (l *deploymentLister) Get(namespace, name string) (*v1.Deployment, 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: DeploymentGroupVersionKind.Group,
Resource: "deployment",
}, key)
}
return obj.(*v1.Deployment), nil
}
type deploymentController struct {
controller.GenericController
}
func (c *deploymentController) Generic() controller.GenericController {
return c.GenericController
}
func (c *deploymentController) Lister() DeploymentLister {
return &deploymentLister{
controller: c,
}
}
func (c *deploymentController) AddHandler(ctx context.Context, name string, handler DeploymentHandlerFunc) {
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.Deployment); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *deploymentController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler DeploymentHandlerFunc) {
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.Deployment); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type deploymentFactory struct {
}
func (c deploymentFactory) Object() runtime.Object {
return &v1.Deployment{}
}
func (c deploymentFactory) List() runtime.Object {
return &DeploymentList{}
}
func (s *deploymentClient) Controller() DeploymentController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.deploymentControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(DeploymentGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &deploymentController{
GenericController: genericController,
}
s.client.deploymentControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type deploymentClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller DeploymentController
}
func (s *deploymentClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *deploymentClient) Create(o *v1.Deployment) (*v1.Deployment, error) {
obj, err := s.objectClient.Create(o)
return obj.(*v1.Deployment), err
}
func (s *deploymentClient) Get(name string, opts metav1.GetOptions) (*v1.Deployment, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*v1.Deployment), err
}
func (s *deploymentClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Deployment, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*v1.Deployment), err
}
func (s *deploymentClient) Update(o *v1.Deployment) (*v1.Deployment, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*v1.Deployment), err
}
func (s *deploymentClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *deploymentClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *deploymentClient) List(opts metav1.ListOptions) (*DeploymentList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*DeploymentList), err
}
func (s *deploymentClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *deploymentClient) Patch(o *v1.Deployment, patchType types.PatchType, data []byte, subresources ...string) (*v1.Deployment, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*v1.Deployment), err
}
func (s *deploymentClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *deploymentClient) AddHandler(ctx context.Context, name string, sync DeploymentHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *deploymentClient) AddLifecycle(ctx context.Context, name string, lifecycle DeploymentLifecycle) {
sync := NewDeploymentLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *deploymentClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync DeploymentHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *deploymentClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle DeploymentLifecycle) {
sync := NewDeploymentLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type DeploymentIndexer func(obj *v1.Deployment) ([]string, error)
type DeploymentClientCache interface {
Get(namespace, name string) (*v1.Deployment, error)
List(namespace string, selector labels.Selector) ([]*v1.Deployment, error)
Index(name string, indexer DeploymentIndexer)
GetIndexed(name, key string) ([]*v1.Deployment, error)
}
type DeploymentClient interface {
Create(*v1.Deployment) (*v1.Deployment, error)
Get(namespace, name string, opts metav1.GetOptions) (*v1.Deployment, error)
Update(*v1.Deployment) (*v1.Deployment, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*DeploymentList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() DeploymentClientCache
OnCreate(ctx context.Context, name string, sync DeploymentChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync DeploymentChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync DeploymentChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() DeploymentInterface
}
type deploymentClientCache struct {
client *deploymentClient2
}
type deploymentClient2 struct {
iface DeploymentInterface
controller DeploymentController
}
func (n *deploymentClient2) Interface() DeploymentInterface {
return n.iface
}
func (n *deploymentClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *deploymentClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *deploymentClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *deploymentClient2) Create(obj *v1.Deployment) (*v1.Deployment, error) {
return n.iface.Create(obj)
}
func (n *deploymentClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.Deployment, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *deploymentClient2) Update(obj *v1.Deployment) (*v1.Deployment, error) {
return n.iface.Update(obj)
}
func (n *deploymentClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *deploymentClient2) List(namespace string, opts metav1.ListOptions) (*DeploymentList, error) {
return n.iface.List(opts)
}
func (n *deploymentClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *deploymentClientCache) Get(namespace, name string) (*v1.Deployment, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *deploymentClientCache) List(namespace string, selector labels.Selector) ([]*v1.Deployment, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *deploymentClient2) Cache() DeploymentClientCache {
n.loadController()
return &deploymentClientCache{
client: n,
}
}
func (n *deploymentClient2) OnCreate(ctx context.Context, name string, sync DeploymentChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &deploymentLifecycleDelegate{create: sync})
}
func (n *deploymentClient2) OnChange(ctx context.Context, name string, sync DeploymentChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &deploymentLifecycleDelegate{update: sync})
}
func (n *deploymentClient2) OnRemove(ctx context.Context, name string, sync DeploymentChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &deploymentLifecycleDelegate{remove: sync})
}
func (n *deploymentClientCache) Index(name string, indexer DeploymentIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*v1.Deployment); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *deploymentClientCache) GetIndexed(name, key string) ([]*v1.Deployment, error) {
var result []*v1.Deployment
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.Deployment); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *deploymentClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type deploymentLifecycleDelegate struct {
create DeploymentChangeHandlerFunc
update DeploymentChangeHandlerFunc
remove DeploymentChangeHandlerFunc
}
func (n *deploymentLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *deploymentLifecycleDelegate) Create(obj *v1.Deployment) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *deploymentLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *deploymentLifecycleDelegate) Remove(obj *v1.Deployment) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *deploymentLifecycleDelegate) Updated(obj *v1.Deployment) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@ -1,63 +0,0 @@
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type DeploymentLifecycle interface {
Create(obj *v1.Deployment) (runtime.Object, error)
Remove(obj *v1.Deployment) (runtime.Object, error)
Updated(obj *v1.Deployment) (runtime.Object, error)
}
type deploymentLifecycleAdapter struct {
lifecycle DeploymentLifecycle
}
func (w *deploymentLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *deploymentLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *deploymentLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.Deployment))
if o == nil {
return nil, err
}
return o, err
}
func (w *deploymentLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.Deployment))
if o == nil {
return nil, err
}
return o, err
}
func (w *deploymentLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.Deployment))
if o == nil {
return nil, err
}
return o, err
}
func NewDeploymentLifecycleAdapter(name string, clusterScoped bool, client DeploymentInterface, l DeploymentLifecycle) DeploymentHandlerFunc {
adapter := &deploymentLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Deployment) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@ -1,139 +0,0 @@
package v1
import (
"context"
"sync"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"github.com/rancher/norman/objectclient/dynamic"
"github.com/rancher/norman/restwatch"
"k8s.io/client-go/rest"
)
type (
contextKeyType struct{}
contextClientsKeyType struct{}
)
type Interface interface {
RESTClient() rest.Interface
controller.Starter
DaemonSetsGetter
DeploymentsGetter
}
type Clients struct {
Interface Interface
DaemonSet DaemonSetClient
Deployment DeploymentClient
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
daemonSetControllers map[string]DaemonSetController
deploymentControllers map[string]DeploymentController
}
func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) {
c, err := NewForConfig(config)
if err != nil {
return ctx, nil, err
}
cs := NewClientsFromInterface(c)
ctx = context.WithValue(ctx, contextKeyType{}, c)
ctx = context.WithValue(ctx, contextClientsKeyType{}, cs)
return ctx, c, nil
}
func ClientsFrom(ctx context.Context) *Clients {
return ctx.Value(contextClientsKeyType{}).(*Clients)
}
func From(ctx context.Context) Interface {
return ctx.Value(contextKeyType{}).(Interface)
}
func NewClients(config rest.Config) (*Clients, error) {
iface, err := NewForConfig(config)
if err != nil {
return nil, err
}
return NewClientsFromInterface(iface), nil
}
func NewClientsFromInterface(iface Interface) *Clients {
return &Clients{
Interface: iface,
DaemonSet: &daemonSetClient2{
iface: iface.DaemonSets(""),
},
Deployment: &deploymentClient2{
iface: iface.Deployments(""),
},
}
}
func NewForConfig(config rest.Config) (Interface, error) {
if config.NegotiatedSerializer == nil {
config.NegotiatedSerializer = dynamic.NegotiatedSerializer
}
restClient, err := restwatch.UnversionedRESTClientFor(&config)
if err != nil {
return nil, err
}
return &Client{
restClient: restClient,
daemonSetControllers: map[string]DaemonSetController{},
deploymentControllers: map[string]DeploymentController{},
}, nil
}
func (c *Client) RESTClient() rest.Interface {
return c.restClient
}
func (c *Client) Sync(ctx context.Context) error {
return controller.Sync(ctx, c.starters...)
}
func (c *Client) Start(ctx context.Context, threadiness int) error {
return controller.Start(ctx, threadiness, c.starters...)
}
type DaemonSetsGetter interface {
DaemonSets(namespace string) DaemonSetInterface
}
func (c *Client) DaemonSets(namespace string) DaemonSetInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &DaemonSetResource, DaemonSetGroupVersionKind, daemonSetFactory{})
return &daemonSetClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type DeploymentsGetter interface {
Deployments(namespace string) DeploymentInterface
}
func (c *Client) Deployments(namespace string) DeploymentInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &DeploymentResource, DeploymentGroupVersionKind, deploymentFactory{})
return &deploymentClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}

View File

@ -1,40 +0,0 @@
package v1
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const (
GroupName = "apps"
Version = "v1"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
// TODO this gets cleaned up when the types are fixed
scheme.AddKnownTypes(SchemeGroupVersion,
&DaemonSetList{},
&DeploymentList{},
)
return nil
}

View File

@ -1,39 +0,0 @@
package v1
import (
batchv1 "k8s.io/api/batch/v1"
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 *JobList) DeepCopyInto(out *JobList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]batchv1.Job, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobList.
func (in *JobList) DeepCopy() *JobList {
if in == nil {
return nil
}
out := new(JobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *JobList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}

View File

@ -1,441 +0,0 @@
package v1
import (
"context"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
v1 "k8s.io/api/batch/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 (
JobGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "Job",
}
JobResource = metav1.APIResource{
Name: "jobs",
SingularName: "job",
Namespaced: true,
Kind: JobGroupVersionKind.Kind,
}
)
func NewJob(namespace, name string, obj v1.Job) *v1.Job {
obj.APIVersion, obj.Kind = JobGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type JobList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []v1.Job
}
type JobHandlerFunc func(key string, obj *v1.Job) (runtime.Object, error)
type JobChangeHandlerFunc func(obj *v1.Job) (runtime.Object, error)
type JobLister interface {
List(namespace string, selector labels.Selector) (ret []*v1.Job, err error)
Get(namespace, name string) (*v1.Job, error)
}
type JobController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() JobLister
AddHandler(ctx context.Context, name string, handler JobHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler JobHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type JobInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*v1.Job) (*v1.Job, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Job, error)
Get(name string, opts metav1.GetOptions) (*v1.Job, error)
Update(*v1.Job) (*v1.Job, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*JobList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() JobController
AddHandler(ctx context.Context, name string, sync JobHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle JobLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync JobHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle JobLifecycle)
}
type jobLister struct {
controller *jobController
}
func (l *jobLister) List(namespace string, selector labels.Selector) (ret []*v1.Job, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*v1.Job))
})
return
}
func (l *jobLister) Get(namespace, name string) (*v1.Job, 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: JobGroupVersionKind.Group,
Resource: "job",
}, key)
}
return obj.(*v1.Job), nil
}
type jobController struct {
controller.GenericController
}
func (c *jobController) Generic() controller.GenericController {
return c.GenericController
}
func (c *jobController) Lister() JobLister {
return &jobLister{
controller: c,
}
}
func (c *jobController) AddHandler(ctx context.Context, name string, handler JobHandlerFunc) {
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.Job); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *jobController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler JobHandlerFunc) {
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.Job); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type jobFactory struct {
}
func (c jobFactory) Object() runtime.Object {
return &v1.Job{}
}
func (c jobFactory) List() runtime.Object {
return &JobList{}
}
func (s *jobClient) Controller() JobController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.jobControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(JobGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &jobController{
GenericController: genericController,
}
s.client.jobControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type jobClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller JobController
}
func (s *jobClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *jobClient) Create(o *v1.Job) (*v1.Job, error) {
obj, err := s.objectClient.Create(o)
return obj.(*v1.Job), err
}
func (s *jobClient) Get(name string, opts metav1.GetOptions) (*v1.Job, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*v1.Job), err
}
func (s *jobClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Job, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*v1.Job), err
}
func (s *jobClient) Update(o *v1.Job) (*v1.Job, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*v1.Job), err
}
func (s *jobClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *jobClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *jobClient) List(opts metav1.ListOptions) (*JobList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*JobList), err
}
func (s *jobClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *jobClient) Patch(o *v1.Job, patchType types.PatchType, data []byte, subresources ...string) (*v1.Job, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*v1.Job), err
}
func (s *jobClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *jobClient) AddHandler(ctx context.Context, name string, sync JobHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *jobClient) AddLifecycle(ctx context.Context, name string, lifecycle JobLifecycle) {
sync := NewJobLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *jobClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync JobHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *jobClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle JobLifecycle) {
sync := NewJobLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type JobIndexer func(obj *v1.Job) ([]string, error)
type JobClientCache interface {
Get(namespace, name string) (*v1.Job, error)
List(namespace string, selector labels.Selector) ([]*v1.Job, error)
Index(name string, indexer JobIndexer)
GetIndexed(name, key string) ([]*v1.Job, error)
}
type JobClient interface {
Create(*v1.Job) (*v1.Job, error)
Get(namespace, name string, opts metav1.GetOptions) (*v1.Job, error)
Update(*v1.Job) (*v1.Job, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*JobList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() JobClientCache
OnCreate(ctx context.Context, name string, sync JobChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync JobChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync JobChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() JobInterface
}
type jobClientCache struct {
client *jobClient2
}
type jobClient2 struct {
iface JobInterface
controller JobController
}
func (n *jobClient2) Interface() JobInterface {
return n.iface
}
func (n *jobClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *jobClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *jobClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *jobClient2) Create(obj *v1.Job) (*v1.Job, error) {
return n.iface.Create(obj)
}
func (n *jobClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.Job, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *jobClient2) Update(obj *v1.Job) (*v1.Job, error) {
return n.iface.Update(obj)
}
func (n *jobClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *jobClient2) List(namespace string, opts metav1.ListOptions) (*JobList, error) {
return n.iface.List(opts)
}
func (n *jobClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *jobClientCache) Get(namespace, name string) (*v1.Job, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *jobClientCache) List(namespace string, selector labels.Selector) ([]*v1.Job, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *jobClient2) Cache() JobClientCache {
n.loadController()
return &jobClientCache{
client: n,
}
}
func (n *jobClient2) OnCreate(ctx context.Context, name string, sync JobChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &jobLifecycleDelegate{create: sync})
}
func (n *jobClient2) OnChange(ctx context.Context, name string, sync JobChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &jobLifecycleDelegate{update: sync})
}
func (n *jobClient2) OnRemove(ctx context.Context, name string, sync JobChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &jobLifecycleDelegate{remove: sync})
}
func (n *jobClientCache) Index(name string, indexer JobIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*v1.Job); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *jobClientCache) GetIndexed(name, key string) ([]*v1.Job, error) {
var result []*v1.Job
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.Job); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *jobClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type jobLifecycleDelegate struct {
create JobChangeHandlerFunc
update JobChangeHandlerFunc
remove JobChangeHandlerFunc
}
func (n *jobLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *jobLifecycleDelegate) Create(obj *v1.Job) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *jobLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *jobLifecycleDelegate) Remove(obj *v1.Job) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *jobLifecycleDelegate) Updated(obj *v1.Job) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@ -1,63 +0,0 @@
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/batch/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type JobLifecycle interface {
Create(obj *v1.Job) (runtime.Object, error)
Remove(obj *v1.Job) (runtime.Object, error)
Updated(obj *v1.Job) (runtime.Object, error)
}
type jobLifecycleAdapter struct {
lifecycle JobLifecycle
}
func (w *jobLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *jobLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *jobLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.Job))
if o == nil {
return nil, err
}
return o, err
}
func (w *jobLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.Job))
if o == nil {
return nil, err
}
return o, err
}
func (w *jobLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.Job))
if o == nil {
return nil, err
}
return o, err
}
func NewJobLifecycleAdapter(name string, clusterScoped bool, client JobInterface, l JobLifecycle) JobHandlerFunc {
adapter := &jobLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Job) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@ -1,119 +0,0 @@
package v1
import (
"context"
"sync"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"github.com/rancher/norman/objectclient/dynamic"
"github.com/rancher/norman/restwatch"
"k8s.io/client-go/rest"
)
type (
contextKeyType struct{}
contextClientsKeyType struct{}
)
type Interface interface {
RESTClient() rest.Interface
controller.Starter
JobsGetter
}
type Clients struct {
Interface Interface
Job JobClient
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
jobControllers map[string]JobController
}
func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) {
c, err := NewForConfig(config)
if err != nil {
return ctx, nil, err
}
cs := NewClientsFromInterface(c)
ctx = context.WithValue(ctx, contextKeyType{}, c)
ctx = context.WithValue(ctx, contextClientsKeyType{}, cs)
return ctx, c, nil
}
func ClientsFrom(ctx context.Context) *Clients {
return ctx.Value(contextClientsKeyType{}).(*Clients)
}
func From(ctx context.Context) Interface {
return ctx.Value(contextKeyType{}).(Interface)
}
func NewClients(config rest.Config) (*Clients, error) {
iface, err := NewForConfig(config)
if err != nil {
return nil, err
}
return NewClientsFromInterface(iface), nil
}
func NewClientsFromInterface(iface Interface) *Clients {
return &Clients{
Interface: iface,
Job: &jobClient2{
iface: iface.Jobs(""),
},
}
}
func NewForConfig(config rest.Config) (Interface, error) {
if config.NegotiatedSerializer == nil {
config.NegotiatedSerializer = dynamic.NegotiatedSerializer
}
restClient, err := restwatch.UnversionedRESTClientFor(&config)
if err != nil {
return nil, err
}
return &Client{
restClient: restClient,
jobControllers: map[string]JobController{},
}, nil
}
func (c *Client) RESTClient() rest.Interface {
return c.restClient
}
func (c *Client) Sync(ctx context.Context) error {
return controller.Sync(ctx, c.starters...)
}
func (c *Client) Start(ctx context.Context, threadiness int) error {
return controller.Start(ctx, threadiness, c.starters...)
}
type JobsGetter interface {
Jobs(namespace string) JobInterface
}
func (c *Client) Jobs(namespace string) JobInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &JobResource, JobGroupVersionKind, jobFactory{})
return &jobClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}

View File

@ -1,39 +0,0 @@
package v1
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const (
GroupName = "batch"
Version = "v1"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
// TODO this gets cleaned up when the types are fixed
scheme.AddKnownTypes(SchemeGroupVersion,
&JobList{},
)
return nil
}

View File

@ -1,441 +0,0 @@
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 (
ConfigMapGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "ConfigMap",
}
ConfigMapResource = metav1.APIResource{
Name: "configmaps",
SingularName: "configmap",
Namespaced: true,
Kind: ConfigMapGroupVersionKind.Kind,
}
)
func NewConfigMap(namespace, name string, obj v1.ConfigMap) *v1.ConfigMap {
obj.APIVersion, obj.Kind = ConfigMapGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type ConfigMapList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []v1.ConfigMap
}
type ConfigMapHandlerFunc func(key string, obj *v1.ConfigMap) (runtime.Object, error)
type ConfigMapChangeHandlerFunc func(obj *v1.ConfigMap) (runtime.Object, error)
type ConfigMapLister interface {
List(namespace string, selector labels.Selector) (ret []*v1.ConfigMap, err error)
Get(namespace, name string) (*v1.ConfigMap, error)
}
type ConfigMapController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() ConfigMapLister
AddHandler(ctx context.Context, name string, handler ConfigMapHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler ConfigMapHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type ConfigMapInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*v1.ConfigMap) (*v1.ConfigMap, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.ConfigMap, error)
Get(name string, opts metav1.GetOptions) (*v1.ConfigMap, error)
Update(*v1.ConfigMap) (*v1.ConfigMap, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*ConfigMapList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() ConfigMapController
AddHandler(ctx context.Context, name string, sync ConfigMapHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle ConfigMapLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ConfigMapHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ConfigMapLifecycle)
}
type configMapLister struct {
controller *configMapController
}
func (l *configMapLister) List(namespace string, selector labels.Selector) (ret []*v1.ConfigMap, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*v1.ConfigMap))
})
return
}
func (l *configMapLister) Get(namespace, name string) (*v1.ConfigMap, 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: ConfigMapGroupVersionKind.Group,
Resource: "configMap",
}, key)
}
return obj.(*v1.ConfigMap), nil
}
type configMapController struct {
controller.GenericController
}
func (c *configMapController) Generic() controller.GenericController {
return c.GenericController
}
func (c *configMapController) Lister() ConfigMapLister {
return &configMapLister{
controller: c,
}
}
func (c *configMapController) AddHandler(ctx context.Context, name string, handler ConfigMapHandlerFunc) {
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.ConfigMap); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *configMapController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler ConfigMapHandlerFunc) {
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.ConfigMap); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type configMapFactory struct {
}
func (c configMapFactory) Object() runtime.Object {
return &v1.ConfigMap{}
}
func (c configMapFactory) List() runtime.Object {
return &ConfigMapList{}
}
func (s *configMapClient) Controller() ConfigMapController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.configMapControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ConfigMapGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &configMapController{
GenericController: genericController,
}
s.client.configMapControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type configMapClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller ConfigMapController
}
func (s *configMapClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *configMapClient) Create(o *v1.ConfigMap) (*v1.ConfigMap, error) {
obj, err := s.objectClient.Create(o)
return obj.(*v1.ConfigMap), err
}
func (s *configMapClient) Get(name string, opts metav1.GetOptions) (*v1.ConfigMap, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*v1.ConfigMap), err
}
func (s *configMapClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.ConfigMap, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*v1.ConfigMap), err
}
func (s *configMapClient) Update(o *v1.ConfigMap) (*v1.ConfigMap, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*v1.ConfigMap), err
}
func (s *configMapClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *configMapClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *configMapClient) List(opts metav1.ListOptions) (*ConfigMapList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*ConfigMapList), err
}
func (s *configMapClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *configMapClient) Patch(o *v1.ConfigMap, patchType types.PatchType, data []byte, subresources ...string) (*v1.ConfigMap, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*v1.ConfigMap), err
}
func (s *configMapClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *configMapClient) AddHandler(ctx context.Context, name string, sync ConfigMapHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *configMapClient) AddLifecycle(ctx context.Context, name string, lifecycle ConfigMapLifecycle) {
sync := NewConfigMapLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *configMapClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ConfigMapHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *configMapClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ConfigMapLifecycle) {
sync := NewConfigMapLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type ConfigMapIndexer func(obj *v1.ConfigMap) ([]string, error)
type ConfigMapClientCache interface {
Get(namespace, name string) (*v1.ConfigMap, error)
List(namespace string, selector labels.Selector) ([]*v1.ConfigMap, error)
Index(name string, indexer ConfigMapIndexer)
GetIndexed(name, key string) ([]*v1.ConfigMap, error)
}
type ConfigMapClient interface {
Create(*v1.ConfigMap) (*v1.ConfigMap, error)
Get(namespace, name string, opts metav1.GetOptions) (*v1.ConfigMap, error)
Update(*v1.ConfigMap) (*v1.ConfigMap, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*ConfigMapList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() ConfigMapClientCache
OnCreate(ctx context.Context, name string, sync ConfigMapChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync ConfigMapChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync ConfigMapChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() ConfigMapInterface
}
type configMapClientCache struct {
client *configMapClient2
}
type configMapClient2 struct {
iface ConfigMapInterface
controller ConfigMapController
}
func (n *configMapClient2) Interface() ConfigMapInterface {
return n.iface
}
func (n *configMapClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *configMapClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *configMapClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *configMapClient2) Create(obj *v1.ConfigMap) (*v1.ConfigMap, error) {
return n.iface.Create(obj)
}
func (n *configMapClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.ConfigMap, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *configMapClient2) Update(obj *v1.ConfigMap) (*v1.ConfigMap, error) {
return n.iface.Update(obj)
}
func (n *configMapClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *configMapClient2) List(namespace string, opts metav1.ListOptions) (*ConfigMapList, error) {
return n.iface.List(opts)
}
func (n *configMapClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *configMapClientCache) Get(namespace, name string) (*v1.ConfigMap, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *configMapClientCache) List(namespace string, selector labels.Selector) ([]*v1.ConfigMap, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *configMapClient2) Cache() ConfigMapClientCache {
n.loadController()
return &configMapClientCache{
client: n,
}
}
func (n *configMapClient2) OnCreate(ctx context.Context, name string, sync ConfigMapChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &configMapLifecycleDelegate{create: sync})
}
func (n *configMapClient2) OnChange(ctx context.Context, name string, sync ConfigMapChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &configMapLifecycleDelegate{update: sync})
}
func (n *configMapClient2) OnRemove(ctx context.Context, name string, sync ConfigMapChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &configMapLifecycleDelegate{remove: sync})
}
func (n *configMapClientCache) Index(name string, indexer ConfigMapIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*v1.ConfigMap); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *configMapClientCache) GetIndexed(name, key string) ([]*v1.ConfigMap, error) {
var result []*v1.ConfigMap
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.ConfigMap); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *configMapClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type configMapLifecycleDelegate struct {
create ConfigMapChangeHandlerFunc
update ConfigMapChangeHandlerFunc
remove ConfigMapChangeHandlerFunc
}
func (n *configMapLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *configMapLifecycleDelegate) Create(obj *v1.ConfigMap) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *configMapLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *configMapLifecycleDelegate) Remove(obj *v1.ConfigMap) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *configMapLifecycleDelegate) Updated(obj *v1.ConfigMap) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@ -1,63 +0,0 @@
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type ConfigMapLifecycle interface {
Create(obj *v1.ConfigMap) (runtime.Object, error)
Remove(obj *v1.ConfigMap) (runtime.Object, error)
Updated(obj *v1.ConfigMap) (runtime.Object, error)
}
type configMapLifecycleAdapter struct {
lifecycle ConfigMapLifecycle
}
func (w *configMapLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *configMapLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *configMapLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.ConfigMap))
if o == nil {
return nil, err
}
return o, err
}
func (w *configMapLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.ConfigMap))
if o == nil {
return nil, err
}
return o, err
}
func (w *configMapLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.ConfigMap))
if o == nil {
return nil, err
}
return o, err
}
func NewConfigMapLifecycleAdapter(name string, clusterScoped bool, client ConfigMapInterface, l ConfigMapLifecycle) ConfigMapHandlerFunc {
adapter := &configMapLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.ConfigMap) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@ -1,204 +0,0 @@
package v1
import (
corev1 "k8s.io/api/core/v1"
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 *ConfigMapList) DeepCopyInto(out *ConfigMapList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]corev1.ConfigMap, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapList.
func (in *ConfigMapList) DeepCopy() *ConfigMapList {
if in == nil {
return nil
}
out := new(ConfigMapList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ConfigMapList) 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 *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
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]corev1.Node, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeList.
func (in *NodeList) DeepCopy() *NodeList {
if in == nil {
return nil
}
out := new(NodeList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *NodeList) 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 *PodList) DeepCopyInto(out *PodList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]corev1.Pod, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodList.
func (in *PodList) DeepCopy() *PodList {
if in == nil {
return nil
}
out := new(PodList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PodList) 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 *ServiceAccountList) DeepCopyInto(out *ServiceAccountList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]corev1.ServiceAccount, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceAccountList.
func (in *ServiceAccountList) DeepCopy() *ServiceAccountList {
if in == nil {
return nil
}
out := new(ServiceAccountList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ServiceAccountList) 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 *ServiceList) DeepCopyInto(out *ServiceList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]corev1.Service, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceList.
func (in *ServiceList) DeepCopy() *ServiceList {
if in == nil {
return nil
}
out := new(ServiceList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ServiceList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}

View File

@ -1,441 +0,0 @@
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)
}

View File

@ -1,63 +0,0 @@
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
}
}

View File

@ -1,219 +0,0 @@
package v1
import (
"context"
"sync"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"github.com/rancher/norman/objectclient/dynamic"
"github.com/rancher/norman/restwatch"
"k8s.io/client-go/rest"
)
type (
contextKeyType struct{}
contextClientsKeyType struct{}
)
type Interface interface {
RESTClient() rest.Interface
controller.Starter
NodesGetter
ServiceAccountsGetter
EndpointsGetter
ServicesGetter
PodsGetter
ConfigMapsGetter
}
type Clients struct {
Interface Interface
Node NodeClient
ServiceAccount ServiceAccountClient
Endpoints EndpointsClient
Service ServiceClient
Pod PodClient
ConfigMap ConfigMapClient
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
nodeControllers map[string]NodeController
serviceAccountControllers map[string]ServiceAccountController
endpointsControllers map[string]EndpointsController
serviceControllers map[string]ServiceController
podControllers map[string]PodController
configMapControllers map[string]ConfigMapController
}
func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) {
c, err := NewForConfig(config)
if err != nil {
return ctx, nil, err
}
cs := NewClientsFromInterface(c)
ctx = context.WithValue(ctx, contextKeyType{}, c)
ctx = context.WithValue(ctx, contextClientsKeyType{}, cs)
return ctx, c, nil
}
func ClientsFrom(ctx context.Context) *Clients {
return ctx.Value(contextClientsKeyType{}).(*Clients)
}
func From(ctx context.Context) Interface {
return ctx.Value(contextKeyType{}).(Interface)
}
func NewClients(config rest.Config) (*Clients, error) {
iface, err := NewForConfig(config)
if err != nil {
return nil, err
}
return NewClientsFromInterface(iface), nil
}
func NewClientsFromInterface(iface Interface) *Clients {
return &Clients{
Interface: iface,
Node: &nodeClient2{
iface: iface.Nodes(""),
},
ServiceAccount: &serviceAccountClient2{
iface: iface.ServiceAccounts(""),
},
Endpoints: &endpointsClient2{
iface: iface.Endpoints(""),
},
Service: &serviceClient2{
iface: iface.Services(""),
},
Pod: &podClient2{
iface: iface.Pods(""),
},
ConfigMap: &configMapClient2{
iface: iface.ConfigMaps(""),
},
}
}
func NewForConfig(config rest.Config) (Interface, error) {
if config.NegotiatedSerializer == nil {
config.NegotiatedSerializer = dynamic.NegotiatedSerializer
}
restClient, err := restwatch.UnversionedRESTClientFor(&config)
if err != nil {
return nil, err
}
return &Client{
restClient: restClient,
nodeControllers: map[string]NodeController{},
serviceAccountControllers: map[string]ServiceAccountController{},
endpointsControllers: map[string]EndpointsController{},
serviceControllers: map[string]ServiceController{},
podControllers: map[string]PodController{},
configMapControllers: map[string]ConfigMapController{},
}, nil
}
func (c *Client) RESTClient() rest.Interface {
return c.restClient
}
func (c *Client) Sync(ctx context.Context) error {
return controller.Sync(ctx, c.starters...)
}
func (c *Client) Start(ctx context.Context, threadiness int) error {
return controller.Start(ctx, threadiness, c.starters...)
}
type NodesGetter interface {
Nodes(namespace string) NodeInterface
}
func (c *Client) Nodes(namespace string) NodeInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &NodeResource, NodeGroupVersionKind, nodeFactory{})
return &nodeClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ServiceAccountsGetter interface {
ServiceAccounts(namespace string) ServiceAccountInterface
}
func (c *Client) ServiceAccounts(namespace string) ServiceAccountInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ServiceAccountResource, ServiceAccountGroupVersionKind, serviceAccountFactory{})
return &serviceAccountClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
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
}
func (c *Client) Services(namespace string) ServiceInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ServiceResource, ServiceGroupVersionKind, serviceFactory{})
return &serviceClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type PodsGetter interface {
Pods(namespace string) PodInterface
}
func (c *Client) Pods(namespace string) PodInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &PodResource, PodGroupVersionKind, podFactory{})
return &podClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ConfigMapsGetter interface {
ConfigMaps(namespace string) ConfigMapInterface
}
func (c *Client) ConfigMaps(namespace string) ConfigMapInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ConfigMapResource, ConfigMapGroupVersionKind, configMapFactory{})
return &configMapClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}

View File

@ -1,440 +0,0 @@
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 (
NodeGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "Node",
}
NodeResource = metav1.APIResource{
Name: "nodes",
SingularName: "node",
Namespaced: false,
Kind: NodeGroupVersionKind.Kind,
}
)
func NewNode(namespace, name string, obj v1.Node) *v1.Node {
obj.APIVersion, obj.Kind = NodeGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type NodeList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []v1.Node
}
type NodeHandlerFunc func(key string, obj *v1.Node) (runtime.Object, error)
type NodeChangeHandlerFunc func(obj *v1.Node) (runtime.Object, error)
type NodeLister interface {
List(namespace string, selector labels.Selector) (ret []*v1.Node, err error)
Get(namespace, name string) (*v1.Node, error)
}
type NodeController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() NodeLister
AddHandler(ctx context.Context, name string, handler NodeHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler NodeHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type NodeInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*v1.Node) (*v1.Node, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Node, error)
Get(name string, opts metav1.GetOptions) (*v1.Node, error)
Update(*v1.Node) (*v1.Node, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*NodeList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() NodeController
AddHandler(ctx context.Context, name string, sync NodeHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle NodeLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync NodeHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle NodeLifecycle)
}
type nodeLister struct {
controller *nodeController
}
func (l *nodeLister) List(namespace string, selector labels.Selector) (ret []*v1.Node, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*v1.Node))
})
return
}
func (l *nodeLister) Get(namespace, name string) (*v1.Node, 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: NodeGroupVersionKind.Group,
Resource: "node",
}, key)
}
return obj.(*v1.Node), nil
}
type nodeController struct {
controller.GenericController
}
func (c *nodeController) Generic() controller.GenericController {
return c.GenericController
}
func (c *nodeController) Lister() NodeLister {
return &nodeLister{
controller: c,
}
}
func (c *nodeController) AddHandler(ctx context.Context, name string, handler NodeHandlerFunc) {
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.Node); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *nodeController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler NodeHandlerFunc) {
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.Node); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type nodeFactory struct {
}
func (c nodeFactory) Object() runtime.Object {
return &v1.Node{}
}
func (c nodeFactory) List() runtime.Object {
return &NodeList{}
}
func (s *nodeClient) Controller() NodeController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.nodeControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(NodeGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &nodeController{
GenericController: genericController,
}
s.client.nodeControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type nodeClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller NodeController
}
func (s *nodeClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *nodeClient) Create(o *v1.Node) (*v1.Node, error) {
obj, err := s.objectClient.Create(o)
return obj.(*v1.Node), err
}
func (s *nodeClient) Get(name string, opts metav1.GetOptions) (*v1.Node, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*v1.Node), err
}
func (s *nodeClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Node, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*v1.Node), err
}
func (s *nodeClient) Update(o *v1.Node) (*v1.Node, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*v1.Node), err
}
func (s *nodeClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *nodeClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *nodeClient) List(opts metav1.ListOptions) (*NodeList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*NodeList), err
}
func (s *nodeClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *nodeClient) Patch(o *v1.Node, patchType types.PatchType, data []byte, subresources ...string) (*v1.Node, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*v1.Node), err
}
func (s *nodeClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *nodeClient) AddHandler(ctx context.Context, name string, sync NodeHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *nodeClient) AddLifecycle(ctx context.Context, name string, lifecycle NodeLifecycle) {
sync := NewNodeLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *nodeClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync NodeHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *nodeClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle NodeLifecycle) {
sync := NewNodeLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type NodeIndexer func(obj *v1.Node) ([]string, error)
type NodeClientCache interface {
Get(namespace, name string) (*v1.Node, error)
List(namespace string, selector labels.Selector) ([]*v1.Node, error)
Index(name string, indexer NodeIndexer)
GetIndexed(name, key string) ([]*v1.Node, error)
}
type NodeClient interface {
Create(*v1.Node) (*v1.Node, error)
Get(namespace, name string, opts metav1.GetOptions) (*v1.Node, error)
Update(*v1.Node) (*v1.Node, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*NodeList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() NodeClientCache
OnCreate(ctx context.Context, name string, sync NodeChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync NodeChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync NodeChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() NodeInterface
}
type nodeClientCache struct {
client *nodeClient2
}
type nodeClient2 struct {
iface NodeInterface
controller NodeController
}
func (n *nodeClient2) Interface() NodeInterface {
return n.iface
}
func (n *nodeClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *nodeClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *nodeClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *nodeClient2) Create(obj *v1.Node) (*v1.Node, error) {
return n.iface.Create(obj)
}
func (n *nodeClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.Node, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *nodeClient2) Update(obj *v1.Node) (*v1.Node, error) {
return n.iface.Update(obj)
}
func (n *nodeClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *nodeClient2) List(namespace string, opts metav1.ListOptions) (*NodeList, error) {
return n.iface.List(opts)
}
func (n *nodeClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *nodeClientCache) Get(namespace, name string) (*v1.Node, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *nodeClientCache) List(namespace string, selector labels.Selector) ([]*v1.Node, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *nodeClient2) Cache() NodeClientCache {
n.loadController()
return &nodeClientCache{
client: n,
}
}
func (n *nodeClient2) OnCreate(ctx context.Context, name string, sync NodeChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &nodeLifecycleDelegate{create: sync})
}
func (n *nodeClient2) OnChange(ctx context.Context, name string, sync NodeChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &nodeLifecycleDelegate{update: sync})
}
func (n *nodeClient2) OnRemove(ctx context.Context, name string, sync NodeChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &nodeLifecycleDelegate{remove: sync})
}
func (n *nodeClientCache) Index(name string, indexer NodeIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*v1.Node); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *nodeClientCache) GetIndexed(name, key string) ([]*v1.Node, error) {
var result []*v1.Node
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.Node); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *nodeClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type nodeLifecycleDelegate struct {
create NodeChangeHandlerFunc
update NodeChangeHandlerFunc
remove NodeChangeHandlerFunc
}
func (n *nodeLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *nodeLifecycleDelegate) Create(obj *v1.Node) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *nodeLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *nodeLifecycleDelegate) Remove(obj *v1.Node) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *nodeLifecycleDelegate) Updated(obj *v1.Node) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@ -1,63 +0,0 @@
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type NodeLifecycle interface {
Create(obj *v1.Node) (runtime.Object, error)
Remove(obj *v1.Node) (runtime.Object, error)
Updated(obj *v1.Node) (runtime.Object, error)
}
type nodeLifecycleAdapter struct {
lifecycle NodeLifecycle
}
func (w *nodeLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *nodeLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *nodeLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.Node))
if o == nil {
return nil, err
}
return o, err
}
func (w *nodeLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.Node))
if o == nil {
return nil, err
}
return o, err
}
func (w *nodeLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.Node))
if o == nil {
return nil, err
}
return o, err
}
func NewNodeLifecycleAdapter(name string, clusterScoped bool, client NodeInterface, l NodeLifecycle) NodeHandlerFunc {
adapter := &nodeLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Node) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@ -1,441 +0,0 @@
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 (
PodGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "Pod",
}
PodResource = metav1.APIResource{
Name: "pods",
SingularName: "pod",
Namespaced: true,
Kind: PodGroupVersionKind.Kind,
}
)
func NewPod(namespace, name string, obj v1.Pod) *v1.Pod {
obj.APIVersion, obj.Kind = PodGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type PodList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []v1.Pod
}
type PodHandlerFunc func(key string, obj *v1.Pod) (runtime.Object, error)
type PodChangeHandlerFunc func(obj *v1.Pod) (runtime.Object, error)
type PodLister interface {
List(namespace string, selector labels.Selector) (ret []*v1.Pod, err error)
Get(namespace, name string) (*v1.Pod, error)
}
type PodController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() PodLister
AddHandler(ctx context.Context, name string, handler PodHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler PodHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type PodInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*v1.Pod) (*v1.Pod, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Pod, error)
Get(name string, opts metav1.GetOptions) (*v1.Pod, error)
Update(*v1.Pod) (*v1.Pod, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*PodList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() PodController
AddHandler(ctx context.Context, name string, sync PodHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle PodLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync PodHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle PodLifecycle)
}
type podLister struct {
controller *podController
}
func (l *podLister) List(namespace string, selector labels.Selector) (ret []*v1.Pod, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*v1.Pod))
})
return
}
func (l *podLister) Get(namespace, name string) (*v1.Pod, 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: PodGroupVersionKind.Group,
Resource: "pod",
}, key)
}
return obj.(*v1.Pod), nil
}
type podController struct {
controller.GenericController
}
func (c *podController) Generic() controller.GenericController {
return c.GenericController
}
func (c *podController) Lister() PodLister {
return &podLister{
controller: c,
}
}
func (c *podController) AddHandler(ctx context.Context, name string, handler PodHandlerFunc) {
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.Pod); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *podController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler PodHandlerFunc) {
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.Pod); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type podFactory struct {
}
func (c podFactory) Object() runtime.Object {
return &v1.Pod{}
}
func (c podFactory) List() runtime.Object {
return &PodList{}
}
func (s *podClient) Controller() PodController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.podControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(PodGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &podController{
GenericController: genericController,
}
s.client.podControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type podClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller PodController
}
func (s *podClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *podClient) Create(o *v1.Pod) (*v1.Pod, error) {
obj, err := s.objectClient.Create(o)
return obj.(*v1.Pod), err
}
func (s *podClient) Get(name string, opts metav1.GetOptions) (*v1.Pod, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*v1.Pod), err
}
func (s *podClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Pod, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*v1.Pod), err
}
func (s *podClient) Update(o *v1.Pod) (*v1.Pod, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*v1.Pod), err
}
func (s *podClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *podClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *podClient) List(opts metav1.ListOptions) (*PodList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*PodList), err
}
func (s *podClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *podClient) Patch(o *v1.Pod, patchType types.PatchType, data []byte, subresources ...string) (*v1.Pod, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*v1.Pod), err
}
func (s *podClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *podClient) AddHandler(ctx context.Context, name string, sync PodHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *podClient) AddLifecycle(ctx context.Context, name string, lifecycle PodLifecycle) {
sync := NewPodLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *podClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync PodHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *podClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle PodLifecycle) {
sync := NewPodLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type PodIndexer func(obj *v1.Pod) ([]string, error)
type PodClientCache interface {
Get(namespace, name string) (*v1.Pod, error)
List(namespace string, selector labels.Selector) ([]*v1.Pod, error)
Index(name string, indexer PodIndexer)
GetIndexed(name, key string) ([]*v1.Pod, error)
}
type PodClient interface {
Create(*v1.Pod) (*v1.Pod, error)
Get(namespace, name string, opts metav1.GetOptions) (*v1.Pod, error)
Update(*v1.Pod) (*v1.Pod, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*PodList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() PodClientCache
OnCreate(ctx context.Context, name string, sync PodChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync PodChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync PodChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() PodInterface
}
type podClientCache struct {
client *podClient2
}
type podClient2 struct {
iface PodInterface
controller PodController
}
func (n *podClient2) Interface() PodInterface {
return n.iface
}
func (n *podClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *podClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *podClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *podClient2) Create(obj *v1.Pod) (*v1.Pod, error) {
return n.iface.Create(obj)
}
func (n *podClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.Pod, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *podClient2) Update(obj *v1.Pod) (*v1.Pod, error) {
return n.iface.Update(obj)
}
func (n *podClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *podClient2) List(namespace string, opts metav1.ListOptions) (*PodList, error) {
return n.iface.List(opts)
}
func (n *podClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *podClientCache) Get(namespace, name string) (*v1.Pod, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *podClientCache) List(namespace string, selector labels.Selector) ([]*v1.Pod, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *podClient2) Cache() PodClientCache {
n.loadController()
return &podClientCache{
client: n,
}
}
func (n *podClient2) OnCreate(ctx context.Context, name string, sync PodChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &podLifecycleDelegate{create: sync})
}
func (n *podClient2) OnChange(ctx context.Context, name string, sync PodChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &podLifecycleDelegate{update: sync})
}
func (n *podClient2) OnRemove(ctx context.Context, name string, sync PodChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &podLifecycleDelegate{remove: sync})
}
func (n *podClientCache) Index(name string, indexer PodIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*v1.Pod); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *podClientCache) GetIndexed(name, key string) ([]*v1.Pod, error) {
var result []*v1.Pod
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.Pod); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *podClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type podLifecycleDelegate struct {
create PodChangeHandlerFunc
update PodChangeHandlerFunc
remove PodChangeHandlerFunc
}
func (n *podLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *podLifecycleDelegate) Create(obj *v1.Pod) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *podLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *podLifecycleDelegate) Remove(obj *v1.Pod) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *podLifecycleDelegate) Updated(obj *v1.Pod) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@ -1,63 +0,0 @@
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type PodLifecycle interface {
Create(obj *v1.Pod) (runtime.Object, error)
Remove(obj *v1.Pod) (runtime.Object, error)
Updated(obj *v1.Pod) (runtime.Object, error)
}
type podLifecycleAdapter struct {
lifecycle PodLifecycle
}
func (w *podLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *podLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *podLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.Pod))
if o == nil {
return nil, err
}
return o, err
}
func (w *podLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.Pod))
if o == nil {
return nil, err
}
return o, err
}
func (w *podLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.Pod))
if o == nil {
return nil, err
}
return o, err
}
func NewPodLifecycleAdapter(name string, clusterScoped bool, client PodInterface, l PodLifecycle) PodHandlerFunc {
adapter := &podLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Pod) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@ -1,44 +0,0 @@
package v1
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const (
GroupName = ""
Version = "v1"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
// TODO this gets cleaned up when the types are fixed
scheme.AddKnownTypes(SchemeGroupVersion,
&NodeList{},
&ServiceAccountList{},
&EndpointsList{},
&ServiceList{},
&PodList{},
&ConfigMapList{},
)
return nil
}

View File

@ -1,441 +0,0 @@
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 (
ServiceAccountGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "ServiceAccount",
}
ServiceAccountResource = metav1.APIResource{
Name: "serviceaccounts",
SingularName: "serviceaccount",
Namespaced: true,
Kind: ServiceAccountGroupVersionKind.Kind,
}
)
func NewServiceAccount(namespace, name string, obj v1.ServiceAccount) *v1.ServiceAccount {
obj.APIVersion, obj.Kind = ServiceAccountGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type ServiceAccountList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []v1.ServiceAccount
}
type ServiceAccountHandlerFunc func(key string, obj *v1.ServiceAccount) (runtime.Object, error)
type ServiceAccountChangeHandlerFunc func(obj *v1.ServiceAccount) (runtime.Object, error)
type ServiceAccountLister interface {
List(namespace string, selector labels.Selector) (ret []*v1.ServiceAccount, err error)
Get(namespace, name string) (*v1.ServiceAccount, error)
}
type ServiceAccountController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() ServiceAccountLister
AddHandler(ctx context.Context, name string, handler ServiceAccountHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler ServiceAccountHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type ServiceAccountInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*v1.ServiceAccount) (*v1.ServiceAccount, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.ServiceAccount, error)
Get(name string, opts metav1.GetOptions) (*v1.ServiceAccount, error)
Update(*v1.ServiceAccount) (*v1.ServiceAccount, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*ServiceAccountList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() ServiceAccountController
AddHandler(ctx context.Context, name string, sync ServiceAccountHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle ServiceAccountLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ServiceAccountHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ServiceAccountLifecycle)
}
type serviceAccountLister struct {
controller *serviceAccountController
}
func (l *serviceAccountLister) List(namespace string, selector labels.Selector) (ret []*v1.ServiceAccount, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*v1.ServiceAccount))
})
return
}
func (l *serviceAccountLister) Get(namespace, name string) (*v1.ServiceAccount, 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: ServiceAccountGroupVersionKind.Group,
Resource: "serviceAccount",
}, key)
}
return obj.(*v1.ServiceAccount), nil
}
type serviceAccountController struct {
controller.GenericController
}
func (c *serviceAccountController) Generic() controller.GenericController {
return c.GenericController
}
func (c *serviceAccountController) Lister() ServiceAccountLister {
return &serviceAccountLister{
controller: c,
}
}
func (c *serviceAccountController) AddHandler(ctx context.Context, name string, handler ServiceAccountHandlerFunc) {
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.ServiceAccount); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *serviceAccountController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler ServiceAccountHandlerFunc) {
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.ServiceAccount); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type serviceAccountFactory struct {
}
func (c serviceAccountFactory) Object() runtime.Object {
return &v1.ServiceAccount{}
}
func (c serviceAccountFactory) List() runtime.Object {
return &ServiceAccountList{}
}
func (s *serviceAccountClient) Controller() ServiceAccountController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.serviceAccountControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ServiceAccountGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &serviceAccountController{
GenericController: genericController,
}
s.client.serviceAccountControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type serviceAccountClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller ServiceAccountController
}
func (s *serviceAccountClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *serviceAccountClient) Create(o *v1.ServiceAccount) (*v1.ServiceAccount, error) {
obj, err := s.objectClient.Create(o)
return obj.(*v1.ServiceAccount), err
}
func (s *serviceAccountClient) Get(name string, opts metav1.GetOptions) (*v1.ServiceAccount, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*v1.ServiceAccount), err
}
func (s *serviceAccountClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.ServiceAccount, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*v1.ServiceAccount), err
}
func (s *serviceAccountClient) Update(o *v1.ServiceAccount) (*v1.ServiceAccount, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*v1.ServiceAccount), err
}
func (s *serviceAccountClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *serviceAccountClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *serviceAccountClient) List(opts metav1.ListOptions) (*ServiceAccountList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*ServiceAccountList), err
}
func (s *serviceAccountClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *serviceAccountClient) Patch(o *v1.ServiceAccount, patchType types.PatchType, data []byte, subresources ...string) (*v1.ServiceAccount, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*v1.ServiceAccount), err
}
func (s *serviceAccountClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *serviceAccountClient) AddHandler(ctx context.Context, name string, sync ServiceAccountHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *serviceAccountClient) AddLifecycle(ctx context.Context, name string, lifecycle ServiceAccountLifecycle) {
sync := NewServiceAccountLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *serviceAccountClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ServiceAccountHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *serviceAccountClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ServiceAccountLifecycle) {
sync := NewServiceAccountLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type ServiceAccountIndexer func(obj *v1.ServiceAccount) ([]string, error)
type ServiceAccountClientCache interface {
Get(namespace, name string) (*v1.ServiceAccount, error)
List(namespace string, selector labels.Selector) ([]*v1.ServiceAccount, error)
Index(name string, indexer ServiceAccountIndexer)
GetIndexed(name, key string) ([]*v1.ServiceAccount, error)
}
type ServiceAccountClient interface {
Create(*v1.ServiceAccount) (*v1.ServiceAccount, error)
Get(namespace, name string, opts metav1.GetOptions) (*v1.ServiceAccount, error)
Update(*v1.ServiceAccount) (*v1.ServiceAccount, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*ServiceAccountList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() ServiceAccountClientCache
OnCreate(ctx context.Context, name string, sync ServiceAccountChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync ServiceAccountChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync ServiceAccountChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() ServiceAccountInterface
}
type serviceAccountClientCache struct {
client *serviceAccountClient2
}
type serviceAccountClient2 struct {
iface ServiceAccountInterface
controller ServiceAccountController
}
func (n *serviceAccountClient2) Interface() ServiceAccountInterface {
return n.iface
}
func (n *serviceAccountClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *serviceAccountClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *serviceAccountClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *serviceAccountClient2) Create(obj *v1.ServiceAccount) (*v1.ServiceAccount, error) {
return n.iface.Create(obj)
}
func (n *serviceAccountClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.ServiceAccount, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *serviceAccountClient2) Update(obj *v1.ServiceAccount) (*v1.ServiceAccount, error) {
return n.iface.Update(obj)
}
func (n *serviceAccountClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *serviceAccountClient2) List(namespace string, opts metav1.ListOptions) (*ServiceAccountList, error) {
return n.iface.List(opts)
}
func (n *serviceAccountClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *serviceAccountClientCache) Get(namespace, name string) (*v1.ServiceAccount, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *serviceAccountClientCache) List(namespace string, selector labels.Selector) ([]*v1.ServiceAccount, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *serviceAccountClient2) Cache() ServiceAccountClientCache {
n.loadController()
return &serviceAccountClientCache{
client: n,
}
}
func (n *serviceAccountClient2) OnCreate(ctx context.Context, name string, sync ServiceAccountChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &serviceAccountLifecycleDelegate{create: sync})
}
func (n *serviceAccountClient2) OnChange(ctx context.Context, name string, sync ServiceAccountChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &serviceAccountLifecycleDelegate{update: sync})
}
func (n *serviceAccountClient2) OnRemove(ctx context.Context, name string, sync ServiceAccountChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &serviceAccountLifecycleDelegate{remove: sync})
}
func (n *serviceAccountClientCache) Index(name string, indexer ServiceAccountIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*v1.ServiceAccount); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *serviceAccountClientCache) GetIndexed(name, key string) ([]*v1.ServiceAccount, error) {
var result []*v1.ServiceAccount
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.ServiceAccount); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *serviceAccountClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type serviceAccountLifecycleDelegate struct {
create ServiceAccountChangeHandlerFunc
update ServiceAccountChangeHandlerFunc
remove ServiceAccountChangeHandlerFunc
}
func (n *serviceAccountLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *serviceAccountLifecycleDelegate) Create(obj *v1.ServiceAccount) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *serviceAccountLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *serviceAccountLifecycleDelegate) Remove(obj *v1.ServiceAccount) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *serviceAccountLifecycleDelegate) Updated(obj *v1.ServiceAccount) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@ -1,63 +0,0 @@
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type ServiceAccountLifecycle interface {
Create(obj *v1.ServiceAccount) (runtime.Object, error)
Remove(obj *v1.ServiceAccount) (runtime.Object, error)
Updated(obj *v1.ServiceAccount) (runtime.Object, error)
}
type serviceAccountLifecycleAdapter struct {
lifecycle ServiceAccountLifecycle
}
func (w *serviceAccountLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *serviceAccountLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *serviceAccountLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.ServiceAccount))
if o == nil {
return nil, err
}
return o, err
}
func (w *serviceAccountLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.ServiceAccount))
if o == nil {
return nil, err
}
return o, err
}
func (w *serviceAccountLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.ServiceAccount))
if o == nil {
return nil, err
}
return o, err
}
func NewServiceAccountLifecycleAdapter(name string, clusterScoped bool, client ServiceAccountInterface, l ServiceAccountLifecycle) ServiceAccountHandlerFunc {
adapter := &serviceAccountLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.ServiceAccount) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@ -1,441 +0,0 @@
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 (
ServiceGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "Service",
}
ServiceResource = metav1.APIResource{
Name: "services",
SingularName: "service",
Namespaced: true,
Kind: ServiceGroupVersionKind.Kind,
}
)
func NewService(namespace, name string, obj v1.Service) *v1.Service {
obj.APIVersion, obj.Kind = ServiceGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type ServiceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []v1.Service
}
type ServiceHandlerFunc func(key string, obj *v1.Service) (runtime.Object, error)
type ServiceChangeHandlerFunc func(obj *v1.Service) (runtime.Object, error)
type ServiceLister interface {
List(namespace string, selector labels.Selector) (ret []*v1.Service, err error)
Get(namespace, name string) (*v1.Service, error)
}
type ServiceController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() ServiceLister
AddHandler(ctx context.Context, name string, handler ServiceHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler ServiceHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type ServiceInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*v1.Service) (*v1.Service, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Service, error)
Get(name string, opts metav1.GetOptions) (*v1.Service, error)
Update(*v1.Service) (*v1.Service, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*ServiceList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() ServiceController
AddHandler(ctx context.Context, name string, sync ServiceHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle ServiceLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ServiceHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ServiceLifecycle)
}
type serviceLister struct {
controller *serviceController
}
func (l *serviceLister) List(namespace string, selector labels.Selector) (ret []*v1.Service, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*v1.Service))
})
return
}
func (l *serviceLister) Get(namespace, name string) (*v1.Service, 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: ServiceGroupVersionKind.Group,
Resource: "service",
}, key)
}
return obj.(*v1.Service), nil
}
type serviceController struct {
controller.GenericController
}
func (c *serviceController) Generic() controller.GenericController {
return c.GenericController
}
func (c *serviceController) Lister() ServiceLister {
return &serviceLister{
controller: c,
}
}
func (c *serviceController) AddHandler(ctx context.Context, name string, handler ServiceHandlerFunc) {
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.Service); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *serviceController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler ServiceHandlerFunc) {
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.Service); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type serviceFactory struct {
}
func (c serviceFactory) Object() runtime.Object {
return &v1.Service{}
}
func (c serviceFactory) List() runtime.Object {
return &ServiceList{}
}
func (s *serviceClient) Controller() ServiceController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.serviceControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ServiceGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &serviceController{
GenericController: genericController,
}
s.client.serviceControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type serviceClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller ServiceController
}
func (s *serviceClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *serviceClient) Create(o *v1.Service) (*v1.Service, error) {
obj, err := s.objectClient.Create(o)
return obj.(*v1.Service), err
}
func (s *serviceClient) Get(name string, opts metav1.GetOptions) (*v1.Service, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*v1.Service), err
}
func (s *serviceClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Service, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*v1.Service), err
}
func (s *serviceClient) Update(o *v1.Service) (*v1.Service, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*v1.Service), err
}
func (s *serviceClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *serviceClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *serviceClient) List(opts metav1.ListOptions) (*ServiceList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*ServiceList), err
}
func (s *serviceClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *serviceClient) Patch(o *v1.Service, patchType types.PatchType, data []byte, subresources ...string) (*v1.Service, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*v1.Service), err
}
func (s *serviceClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *serviceClient) AddHandler(ctx context.Context, name string, sync ServiceHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *serviceClient) AddLifecycle(ctx context.Context, name string, lifecycle ServiceLifecycle) {
sync := NewServiceLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *serviceClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ServiceHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *serviceClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ServiceLifecycle) {
sync := NewServiceLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type ServiceIndexer func(obj *v1.Service) ([]string, error)
type ServiceClientCache interface {
Get(namespace, name string) (*v1.Service, error)
List(namespace string, selector labels.Selector) ([]*v1.Service, error)
Index(name string, indexer ServiceIndexer)
GetIndexed(name, key string) ([]*v1.Service, error)
}
type ServiceClient interface {
Create(*v1.Service) (*v1.Service, error)
Get(namespace, name string, opts metav1.GetOptions) (*v1.Service, error)
Update(*v1.Service) (*v1.Service, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*ServiceList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() ServiceClientCache
OnCreate(ctx context.Context, name string, sync ServiceChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync ServiceChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync ServiceChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() ServiceInterface
}
type serviceClientCache struct {
client *serviceClient2
}
type serviceClient2 struct {
iface ServiceInterface
controller ServiceController
}
func (n *serviceClient2) Interface() ServiceInterface {
return n.iface
}
func (n *serviceClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *serviceClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *serviceClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *serviceClient2) Create(obj *v1.Service) (*v1.Service, error) {
return n.iface.Create(obj)
}
func (n *serviceClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.Service, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *serviceClient2) Update(obj *v1.Service) (*v1.Service, error) {
return n.iface.Update(obj)
}
func (n *serviceClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *serviceClient2) List(namespace string, opts metav1.ListOptions) (*ServiceList, error) {
return n.iface.List(opts)
}
func (n *serviceClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *serviceClientCache) Get(namespace, name string) (*v1.Service, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *serviceClientCache) List(namespace string, selector labels.Selector) ([]*v1.Service, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *serviceClient2) Cache() ServiceClientCache {
n.loadController()
return &serviceClientCache{
client: n,
}
}
func (n *serviceClient2) OnCreate(ctx context.Context, name string, sync ServiceChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &serviceLifecycleDelegate{create: sync})
}
func (n *serviceClient2) OnChange(ctx context.Context, name string, sync ServiceChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &serviceLifecycleDelegate{update: sync})
}
func (n *serviceClient2) OnRemove(ctx context.Context, name string, sync ServiceChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &serviceLifecycleDelegate{remove: sync})
}
func (n *serviceClientCache) Index(name string, indexer ServiceIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*v1.Service); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *serviceClientCache) GetIndexed(name, key string) ([]*v1.Service, error) {
var result []*v1.Service
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.Service); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *serviceClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type serviceLifecycleDelegate struct {
create ServiceChangeHandlerFunc
update ServiceChangeHandlerFunc
remove ServiceChangeHandlerFunc
}
func (n *serviceLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *serviceLifecycleDelegate) Create(obj *v1.Service) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *serviceLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *serviceLifecycleDelegate) Remove(obj *v1.Service) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *serviceLifecycleDelegate) Updated(obj *v1.Service) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@ -1,63 +0,0 @@
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type ServiceLifecycle interface {
Create(obj *v1.Service) (runtime.Object, error)
Remove(obj *v1.Service) (runtime.Object, error)
Updated(obj *v1.Service) (runtime.Object, error)
}
type serviceLifecycleAdapter struct {
lifecycle ServiceLifecycle
}
func (w *serviceLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *serviceLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *serviceLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.Service))
if o == nil {
return nil, err
}
return o, err
}
func (w *serviceLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.Service))
if o == nil {
return nil, err
}
return o, err
}
func (w *serviceLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.Service))
if o == nil {
return nil, err
}
return o, err
}
func NewServiceLifecycleAdapter(name string, clusterScoped bool, client ServiceInterface, l ServiceLifecycle) ServiceHandlerFunc {
adapter := &serviceLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Service) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@ -1,19 +0,0 @@
package v1
import (
"github.com/rancher/norman/types"
"github.com/rancher/norman/types/factory"
)
var (
APIVersion = types.APIVersion{
Version: "v1",
Group: "k3s.cattle.io",
Path: "/v1-k3s",
}
Schemas = factory.Schemas(&APIVersion).
MustImport(&APIVersion, Addon{}).
MustImport(&APIVersion, HelmChart{}).
MustImport(&APIVersion, ListenerConfig{})
)

View File

@ -1,440 +0,0 @@
package v1
import (
"context"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"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 (
AddonGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "Addon",
}
AddonResource = metav1.APIResource{
Name: "addons",
SingularName: "addon",
Namespaced: true,
Kind: AddonGroupVersionKind.Kind,
}
)
func NewAddon(namespace, name string, obj Addon) *Addon {
obj.APIVersion, obj.Kind = AddonGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type AddonList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Addon
}
type AddonHandlerFunc func(key string, obj *Addon) (runtime.Object, error)
type AddonChangeHandlerFunc func(obj *Addon) (runtime.Object, error)
type AddonLister interface {
List(namespace string, selector labels.Selector) (ret []*Addon, err error)
Get(namespace, name string) (*Addon, error)
}
type AddonController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() AddonLister
AddHandler(ctx context.Context, name string, handler AddonHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler AddonHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type AddonInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*Addon) (*Addon, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*Addon, error)
Get(name string, opts metav1.GetOptions) (*Addon, error)
Update(*Addon) (*Addon, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*AddonList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() AddonController
AddHandler(ctx context.Context, name string, sync AddonHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle AddonLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync AddonHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle AddonLifecycle)
}
type addonLister struct {
controller *addonController
}
func (l *addonLister) List(namespace string, selector labels.Selector) (ret []*Addon, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*Addon))
})
return
}
func (l *addonLister) Get(namespace, name string) (*Addon, 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: AddonGroupVersionKind.Group,
Resource: "addon",
}, key)
}
return obj.(*Addon), nil
}
type addonController struct {
controller.GenericController
}
func (c *addonController) Generic() controller.GenericController {
return c.GenericController
}
func (c *addonController) Lister() AddonLister {
return &addonLister{
controller: c,
}
}
func (c *addonController) AddHandler(ctx context.Context, name string, handler AddonHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*Addon); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *addonController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler AddonHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*Addon); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type addonFactory struct {
}
func (c addonFactory) Object() runtime.Object {
return &Addon{}
}
func (c addonFactory) List() runtime.Object {
return &AddonList{}
}
func (s *addonClient) Controller() AddonController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.addonControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(AddonGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &addonController{
GenericController: genericController,
}
s.client.addonControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type addonClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller AddonController
}
func (s *addonClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *addonClient) Create(o *Addon) (*Addon, error) {
obj, err := s.objectClient.Create(o)
return obj.(*Addon), err
}
func (s *addonClient) Get(name string, opts metav1.GetOptions) (*Addon, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*Addon), err
}
func (s *addonClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*Addon, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*Addon), err
}
func (s *addonClient) Update(o *Addon) (*Addon, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*Addon), err
}
func (s *addonClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *addonClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *addonClient) List(opts metav1.ListOptions) (*AddonList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*AddonList), err
}
func (s *addonClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *addonClient) Patch(o *Addon, patchType types.PatchType, data []byte, subresources ...string) (*Addon, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*Addon), err
}
func (s *addonClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *addonClient) AddHandler(ctx context.Context, name string, sync AddonHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *addonClient) AddLifecycle(ctx context.Context, name string, lifecycle AddonLifecycle) {
sync := NewAddonLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *addonClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync AddonHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *addonClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle AddonLifecycle) {
sync := NewAddonLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type AddonIndexer func(obj *Addon) ([]string, error)
type AddonClientCache interface {
Get(namespace, name string) (*Addon, error)
List(namespace string, selector labels.Selector) ([]*Addon, error)
Index(name string, indexer AddonIndexer)
GetIndexed(name, key string) ([]*Addon, error)
}
type AddonClient interface {
Create(*Addon) (*Addon, error)
Get(namespace, name string, opts metav1.GetOptions) (*Addon, error)
Update(*Addon) (*Addon, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*AddonList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() AddonClientCache
OnCreate(ctx context.Context, name string, sync AddonChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync AddonChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync AddonChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() AddonInterface
}
type addonClientCache struct {
client *addonClient2
}
type addonClient2 struct {
iface AddonInterface
controller AddonController
}
func (n *addonClient2) Interface() AddonInterface {
return n.iface
}
func (n *addonClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *addonClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *addonClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *addonClient2) Create(obj *Addon) (*Addon, error) {
return n.iface.Create(obj)
}
func (n *addonClient2) Get(namespace, name string, opts metav1.GetOptions) (*Addon, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *addonClient2) Update(obj *Addon) (*Addon, error) {
return n.iface.Update(obj)
}
func (n *addonClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *addonClient2) List(namespace string, opts metav1.ListOptions) (*AddonList, error) {
return n.iface.List(opts)
}
func (n *addonClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *addonClientCache) Get(namespace, name string) (*Addon, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *addonClientCache) List(namespace string, selector labels.Selector) ([]*Addon, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *addonClient2) Cache() AddonClientCache {
n.loadController()
return &addonClientCache{
client: n,
}
}
func (n *addonClient2) OnCreate(ctx context.Context, name string, sync AddonChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &addonLifecycleDelegate{create: sync})
}
func (n *addonClient2) OnChange(ctx context.Context, name string, sync AddonChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &addonLifecycleDelegate{update: sync})
}
func (n *addonClient2) OnRemove(ctx context.Context, name string, sync AddonChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &addonLifecycleDelegate{remove: sync})
}
func (n *addonClientCache) Index(name string, indexer AddonIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*Addon); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *addonClientCache) GetIndexed(name, key string) ([]*Addon, error) {
var result []*Addon
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
if err != nil {
return nil, err
}
for _, obj := range objs {
if v, ok := obj.(*Addon); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *addonClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type addonLifecycleDelegate struct {
create AddonChangeHandlerFunc
update AddonChangeHandlerFunc
remove AddonChangeHandlerFunc
}
func (n *addonLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *addonLifecycleDelegate) Create(obj *Addon) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *addonLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *addonLifecycleDelegate) Remove(obj *Addon) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *addonLifecycleDelegate) Updated(obj *Addon) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@ -1,62 +0,0 @@
package v1
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type AddonLifecycle interface {
Create(obj *Addon) (runtime.Object, error)
Remove(obj *Addon) (runtime.Object, error)
Updated(obj *Addon) (runtime.Object, error)
}
type addonLifecycleAdapter struct {
lifecycle AddonLifecycle
}
func (w *addonLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *addonLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *addonLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*Addon))
if o == nil {
return nil, err
}
return o, err
}
func (w *addonLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*Addon))
if o == nil {
return nil, err
}
return o, err
}
func (w *addonLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*Addon))
if o == nil {
return nil, err
}
return o, err
}
func NewAddonLifecycleAdapter(name string, clusterScoped bool, client AddonInterface, l AddonLifecycle) AddonHandlerFunc {
adapter := &addonLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *Addon) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@ -1,268 +0,0 @@
package v1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
intstr "k8s.io/apimachinery/pkg/util/intstr"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Addon) DeepCopyInto(out *Addon) {
*out = *in
out.Namespaced = in.Namespaced
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Addon.
func (in *Addon) DeepCopy() *Addon {
if in == nil {
return nil
}
out := new(Addon)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Addon) 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 *AddonList) DeepCopyInto(out *AddonList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Addon, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonList.
func (in *AddonList) DeepCopy() *AddonList {
if in == nil {
return nil
}
out := new(AddonList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *AddonList) 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 *AddonSpec) DeepCopyInto(out *AddonSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonSpec.
func (in *AddonSpec) DeepCopy() *AddonSpec {
if in == nil {
return nil
}
out := new(AddonSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AddonStatus) DeepCopyInto(out *AddonStatus) {
*out = *in
if in.GVKs != nil {
in, out := &in.GVKs, &out.GVKs
*out = make([]schema.GroupVersionKind, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonStatus.
func (in *AddonStatus) DeepCopy() *AddonStatus {
if in == nil {
return nil
}
out := new(AddonStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HelmChart) DeepCopyInto(out *HelmChart) {
*out = *in
out.Namespaced = in.Namespaced
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChart.
func (in *HelmChart) DeepCopy() *HelmChart {
if in == nil {
return nil
}
out := new(HelmChart)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *HelmChart) 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 *HelmChartList) DeepCopyInto(out *HelmChartList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]HelmChart, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartList.
func (in *HelmChartList) DeepCopy() *HelmChartList {
if in == nil {
return nil
}
out := new(HelmChartList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *HelmChartList) 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 *HelmChartSpec) DeepCopyInto(out *HelmChartSpec) {
*out = *in
if in.Set != nil {
in, out := &in.Set, &out.Set
*out = make(map[string]intstr.IntOrString, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartSpec.
func (in *HelmChartSpec) DeepCopy() *HelmChartSpec {
if in == nil {
return nil
}
out := new(HelmChartSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HelmChartStatus) DeepCopyInto(out *HelmChartStatus) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartStatus.
func (in *HelmChartStatus) DeepCopy() *HelmChartStatus {
if in == nil {
return nil
}
out := new(HelmChartStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ListenerConfig) DeepCopyInto(out *ListenerConfig) {
*out = *in
out.Namespaced = in.Namespaced
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListenerConfig.
func (in *ListenerConfig) DeepCopy() *ListenerConfig {
if in == nil {
return nil
}
out := new(ListenerConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ListenerConfig) 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 *ListenerConfigList) DeepCopyInto(out *ListenerConfigList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ListenerConfig, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListenerConfigList.
func (in *ListenerConfigList) DeepCopy() *ListenerConfigList {
if in == nil {
return nil
}
out := new(ListenerConfigList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ListenerConfigList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}

View File

@ -1,440 +0,0 @@
package v1
import (
"context"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"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 (
HelmChartGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "HelmChart",
}
HelmChartResource = metav1.APIResource{
Name: "helmcharts",
SingularName: "helmchart",
Namespaced: true,
Kind: HelmChartGroupVersionKind.Kind,
}
)
func NewHelmChart(namespace, name string, obj HelmChart) *HelmChart {
obj.APIVersion, obj.Kind = HelmChartGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type HelmChartList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []HelmChart
}
type HelmChartHandlerFunc func(key string, obj *HelmChart) (runtime.Object, error)
type HelmChartChangeHandlerFunc func(obj *HelmChart) (runtime.Object, error)
type HelmChartLister interface {
List(namespace string, selector labels.Selector) (ret []*HelmChart, err error)
Get(namespace, name string) (*HelmChart, error)
}
type HelmChartController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() HelmChartLister
AddHandler(ctx context.Context, name string, handler HelmChartHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler HelmChartHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type HelmChartInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*HelmChart) (*HelmChart, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*HelmChart, error)
Get(name string, opts metav1.GetOptions) (*HelmChart, error)
Update(*HelmChart) (*HelmChart, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*HelmChartList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() HelmChartController
AddHandler(ctx context.Context, name string, sync HelmChartHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle HelmChartLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync HelmChartHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle HelmChartLifecycle)
}
type helmChartLister struct {
controller *helmChartController
}
func (l *helmChartLister) List(namespace string, selector labels.Selector) (ret []*HelmChart, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*HelmChart))
})
return
}
func (l *helmChartLister) Get(namespace, name string) (*HelmChart, 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: HelmChartGroupVersionKind.Group,
Resource: "helmChart",
}, key)
}
return obj.(*HelmChart), nil
}
type helmChartController struct {
controller.GenericController
}
func (c *helmChartController) Generic() controller.GenericController {
return c.GenericController
}
func (c *helmChartController) Lister() HelmChartLister {
return &helmChartLister{
controller: c,
}
}
func (c *helmChartController) AddHandler(ctx context.Context, name string, handler HelmChartHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*HelmChart); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *helmChartController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler HelmChartHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*HelmChart); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type helmChartFactory struct {
}
func (c helmChartFactory) Object() runtime.Object {
return &HelmChart{}
}
func (c helmChartFactory) List() runtime.Object {
return &HelmChartList{}
}
func (s *helmChartClient) Controller() HelmChartController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.helmChartControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(HelmChartGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &helmChartController{
GenericController: genericController,
}
s.client.helmChartControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type helmChartClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller HelmChartController
}
func (s *helmChartClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *helmChartClient) Create(o *HelmChart) (*HelmChart, error) {
obj, err := s.objectClient.Create(o)
return obj.(*HelmChart), err
}
func (s *helmChartClient) Get(name string, opts metav1.GetOptions) (*HelmChart, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*HelmChart), err
}
func (s *helmChartClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*HelmChart, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*HelmChart), err
}
func (s *helmChartClient) Update(o *HelmChart) (*HelmChart, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*HelmChart), err
}
func (s *helmChartClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *helmChartClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *helmChartClient) List(opts metav1.ListOptions) (*HelmChartList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*HelmChartList), err
}
func (s *helmChartClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *helmChartClient) Patch(o *HelmChart, patchType types.PatchType, data []byte, subresources ...string) (*HelmChart, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*HelmChart), err
}
func (s *helmChartClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *helmChartClient) AddHandler(ctx context.Context, name string, sync HelmChartHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *helmChartClient) AddLifecycle(ctx context.Context, name string, lifecycle HelmChartLifecycle) {
sync := NewHelmChartLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *helmChartClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync HelmChartHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *helmChartClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle HelmChartLifecycle) {
sync := NewHelmChartLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type HelmChartIndexer func(obj *HelmChart) ([]string, error)
type HelmChartClientCache interface {
Get(namespace, name string) (*HelmChart, error)
List(namespace string, selector labels.Selector) ([]*HelmChart, error)
Index(name string, indexer HelmChartIndexer)
GetIndexed(name, key string) ([]*HelmChart, error)
}
type HelmChartClient interface {
Create(*HelmChart) (*HelmChart, error)
Get(namespace, name string, opts metav1.GetOptions) (*HelmChart, error)
Update(*HelmChart) (*HelmChart, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*HelmChartList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() HelmChartClientCache
OnCreate(ctx context.Context, name string, sync HelmChartChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync HelmChartChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync HelmChartChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() HelmChartInterface
}
type helmChartClientCache struct {
client *helmChartClient2
}
type helmChartClient2 struct {
iface HelmChartInterface
controller HelmChartController
}
func (n *helmChartClient2) Interface() HelmChartInterface {
return n.iface
}
func (n *helmChartClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *helmChartClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *helmChartClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *helmChartClient2) Create(obj *HelmChart) (*HelmChart, error) {
return n.iface.Create(obj)
}
func (n *helmChartClient2) Get(namespace, name string, opts metav1.GetOptions) (*HelmChart, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *helmChartClient2) Update(obj *HelmChart) (*HelmChart, error) {
return n.iface.Update(obj)
}
func (n *helmChartClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *helmChartClient2) List(namespace string, opts metav1.ListOptions) (*HelmChartList, error) {
return n.iface.List(opts)
}
func (n *helmChartClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *helmChartClientCache) Get(namespace, name string) (*HelmChart, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *helmChartClientCache) List(namespace string, selector labels.Selector) ([]*HelmChart, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *helmChartClient2) Cache() HelmChartClientCache {
n.loadController()
return &helmChartClientCache{
client: n,
}
}
func (n *helmChartClient2) OnCreate(ctx context.Context, name string, sync HelmChartChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &helmChartLifecycleDelegate{create: sync})
}
func (n *helmChartClient2) OnChange(ctx context.Context, name string, sync HelmChartChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &helmChartLifecycleDelegate{update: sync})
}
func (n *helmChartClient2) OnRemove(ctx context.Context, name string, sync HelmChartChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &helmChartLifecycleDelegate{remove: sync})
}
func (n *helmChartClientCache) Index(name string, indexer HelmChartIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*HelmChart); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *helmChartClientCache) GetIndexed(name, key string) ([]*HelmChart, error) {
var result []*HelmChart
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
if err != nil {
return nil, err
}
for _, obj := range objs {
if v, ok := obj.(*HelmChart); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *helmChartClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type helmChartLifecycleDelegate struct {
create HelmChartChangeHandlerFunc
update HelmChartChangeHandlerFunc
remove HelmChartChangeHandlerFunc
}
func (n *helmChartLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *helmChartLifecycleDelegate) Create(obj *HelmChart) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *helmChartLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *helmChartLifecycleDelegate) Remove(obj *HelmChart) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *helmChartLifecycleDelegate) Updated(obj *HelmChart) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@ -1,62 +0,0 @@
package v1
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type HelmChartLifecycle interface {
Create(obj *HelmChart) (runtime.Object, error)
Remove(obj *HelmChart) (runtime.Object, error)
Updated(obj *HelmChart) (runtime.Object, error)
}
type helmChartLifecycleAdapter struct {
lifecycle HelmChartLifecycle
}
func (w *helmChartLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *helmChartLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *helmChartLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*HelmChart))
if o == nil {
return nil, err
}
return o, err
}
func (w *helmChartLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*HelmChart))
if o == nil {
return nil, err
}
return o, err
}
func (w *helmChartLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*HelmChart))
if o == nil {
return nil, err
}
return o, err
}
func NewHelmChartLifecycleAdapter(name string, clusterScoped bool, client HelmChartInterface, l HelmChartLifecycle) HelmChartHandlerFunc {
adapter := &helmChartLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *HelmChart) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@ -1,159 +0,0 @@
package v1
import (
"context"
"sync"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"github.com/rancher/norman/objectclient/dynamic"
"github.com/rancher/norman/restwatch"
"k8s.io/client-go/rest"
)
type (
contextKeyType struct{}
contextClientsKeyType struct{}
)
type Interface interface {
RESTClient() rest.Interface
controller.Starter
AddonsGetter
HelmChartsGetter
ListenerConfigsGetter
}
type Clients struct {
Interface Interface
Addon AddonClient
HelmChart HelmChartClient
ListenerConfig ListenerConfigClient
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
addonControllers map[string]AddonController
helmChartControllers map[string]HelmChartController
listenerConfigControllers map[string]ListenerConfigController
}
func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) {
c, err := NewForConfig(config)
if err != nil {
return ctx, nil, err
}
cs := NewClientsFromInterface(c)
ctx = context.WithValue(ctx, contextKeyType{}, c)
ctx = context.WithValue(ctx, contextClientsKeyType{}, cs)
return ctx, c, nil
}
func ClientsFrom(ctx context.Context) *Clients {
return ctx.Value(contextClientsKeyType{}).(*Clients)
}
func From(ctx context.Context) Interface {
return ctx.Value(contextKeyType{}).(Interface)
}
func NewClients(config rest.Config) (*Clients, error) {
iface, err := NewForConfig(config)
if err != nil {
return nil, err
}
return NewClientsFromInterface(iface), nil
}
func NewClientsFromInterface(iface Interface) *Clients {
return &Clients{
Interface: iface,
Addon: &addonClient2{
iface: iface.Addons(""),
},
HelmChart: &helmChartClient2{
iface: iface.HelmCharts(""),
},
ListenerConfig: &listenerConfigClient2{
iface: iface.ListenerConfigs(""),
},
}
}
func NewForConfig(config rest.Config) (Interface, error) {
if config.NegotiatedSerializer == nil {
config.NegotiatedSerializer = dynamic.NegotiatedSerializer
}
restClient, err := restwatch.UnversionedRESTClientFor(&config)
if err != nil {
return nil, err
}
return &Client{
restClient: restClient,
addonControllers: map[string]AddonController{},
helmChartControllers: map[string]HelmChartController{},
listenerConfigControllers: map[string]ListenerConfigController{},
}, nil
}
func (c *Client) RESTClient() rest.Interface {
return c.restClient
}
func (c *Client) Sync(ctx context.Context) error {
return controller.Sync(ctx, c.starters...)
}
func (c *Client) Start(ctx context.Context, threadiness int) error {
return controller.Start(ctx, threadiness, c.starters...)
}
type AddonsGetter interface {
Addons(namespace string) AddonInterface
}
func (c *Client) Addons(namespace string) AddonInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &AddonResource, AddonGroupVersionKind, addonFactory{})
return &addonClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type HelmChartsGetter interface {
HelmCharts(namespace string) HelmChartInterface
}
func (c *Client) HelmCharts(namespace string) HelmChartInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &HelmChartResource, HelmChartGroupVersionKind, helmChartFactory{})
return &helmChartClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ListenerConfigsGetter interface {
ListenerConfigs(namespace string) ListenerConfigInterface
}
func (c *Client) ListenerConfigs(namespace string) ListenerConfigInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ListenerConfigResource, ListenerConfigGroupVersionKind, listenerConfigFactory{})
return &listenerConfigClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}

View File

@ -1,440 +0,0 @@
package v1
import (
"context"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"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 (
ListenerConfigGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "ListenerConfig",
}
ListenerConfigResource = metav1.APIResource{
Name: "listenerconfigs",
SingularName: "listenerconfig",
Namespaced: true,
Kind: ListenerConfigGroupVersionKind.Kind,
}
)
func NewListenerConfig(namespace, name string, obj ListenerConfig) *ListenerConfig {
obj.APIVersion, obj.Kind = ListenerConfigGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type ListenerConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ListenerConfig
}
type ListenerConfigHandlerFunc func(key string, obj *ListenerConfig) (runtime.Object, error)
type ListenerConfigChangeHandlerFunc func(obj *ListenerConfig) (runtime.Object, error)
type ListenerConfigLister interface {
List(namespace string, selector labels.Selector) (ret []*ListenerConfig, err error)
Get(namespace, name string) (*ListenerConfig, error)
}
type ListenerConfigController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() ListenerConfigLister
AddHandler(ctx context.Context, name string, handler ListenerConfigHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler ListenerConfigHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type ListenerConfigInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*ListenerConfig) (*ListenerConfig, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ListenerConfig, error)
Get(name string, opts metav1.GetOptions) (*ListenerConfig, error)
Update(*ListenerConfig) (*ListenerConfig, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*ListenerConfigList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() ListenerConfigController
AddHandler(ctx context.Context, name string, sync ListenerConfigHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle ListenerConfigLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ListenerConfigHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ListenerConfigLifecycle)
}
type listenerConfigLister struct {
controller *listenerConfigController
}
func (l *listenerConfigLister) List(namespace string, selector labels.Selector) (ret []*ListenerConfig, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*ListenerConfig))
})
return
}
func (l *listenerConfigLister) Get(namespace, name string) (*ListenerConfig, 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: ListenerConfigGroupVersionKind.Group,
Resource: "listenerConfig",
}, key)
}
return obj.(*ListenerConfig), nil
}
type listenerConfigController struct {
controller.GenericController
}
func (c *listenerConfigController) Generic() controller.GenericController {
return c.GenericController
}
func (c *listenerConfigController) Lister() ListenerConfigLister {
return &listenerConfigLister{
controller: c,
}
}
func (c *listenerConfigController) AddHandler(ctx context.Context, name string, handler ListenerConfigHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*ListenerConfig); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *listenerConfigController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler ListenerConfigHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*ListenerConfig); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type listenerConfigFactory struct {
}
func (c listenerConfigFactory) Object() runtime.Object {
return &ListenerConfig{}
}
func (c listenerConfigFactory) List() runtime.Object {
return &ListenerConfigList{}
}
func (s *listenerConfigClient) Controller() ListenerConfigController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.listenerConfigControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ListenerConfigGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &listenerConfigController{
GenericController: genericController,
}
s.client.listenerConfigControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type listenerConfigClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller ListenerConfigController
}
func (s *listenerConfigClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *listenerConfigClient) Create(o *ListenerConfig) (*ListenerConfig, error) {
obj, err := s.objectClient.Create(o)
return obj.(*ListenerConfig), err
}
func (s *listenerConfigClient) Get(name string, opts metav1.GetOptions) (*ListenerConfig, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*ListenerConfig), err
}
func (s *listenerConfigClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ListenerConfig, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*ListenerConfig), err
}
func (s *listenerConfigClient) Update(o *ListenerConfig) (*ListenerConfig, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*ListenerConfig), err
}
func (s *listenerConfigClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *listenerConfigClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *listenerConfigClient) List(opts metav1.ListOptions) (*ListenerConfigList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*ListenerConfigList), err
}
func (s *listenerConfigClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *listenerConfigClient) Patch(o *ListenerConfig, patchType types.PatchType, data []byte, subresources ...string) (*ListenerConfig, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*ListenerConfig), err
}
func (s *listenerConfigClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *listenerConfigClient) AddHandler(ctx context.Context, name string, sync ListenerConfigHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *listenerConfigClient) AddLifecycle(ctx context.Context, name string, lifecycle ListenerConfigLifecycle) {
sync := NewListenerConfigLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *listenerConfigClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ListenerConfigHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *listenerConfigClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ListenerConfigLifecycle) {
sync := NewListenerConfigLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type ListenerConfigIndexer func(obj *ListenerConfig) ([]string, error)
type ListenerConfigClientCache interface {
Get(namespace, name string) (*ListenerConfig, error)
List(namespace string, selector labels.Selector) ([]*ListenerConfig, error)
Index(name string, indexer ListenerConfigIndexer)
GetIndexed(name, key string) ([]*ListenerConfig, error)
}
type ListenerConfigClient interface {
Create(*ListenerConfig) (*ListenerConfig, error)
Get(namespace, name string, opts metav1.GetOptions) (*ListenerConfig, error)
Update(*ListenerConfig) (*ListenerConfig, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*ListenerConfigList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() ListenerConfigClientCache
OnCreate(ctx context.Context, name string, sync ListenerConfigChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync ListenerConfigChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync ListenerConfigChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() ListenerConfigInterface
}
type listenerConfigClientCache struct {
client *listenerConfigClient2
}
type listenerConfigClient2 struct {
iface ListenerConfigInterface
controller ListenerConfigController
}
func (n *listenerConfigClient2) Interface() ListenerConfigInterface {
return n.iface
}
func (n *listenerConfigClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *listenerConfigClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *listenerConfigClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *listenerConfigClient2) Create(obj *ListenerConfig) (*ListenerConfig, error) {
return n.iface.Create(obj)
}
func (n *listenerConfigClient2) Get(namespace, name string, opts metav1.GetOptions) (*ListenerConfig, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *listenerConfigClient2) Update(obj *ListenerConfig) (*ListenerConfig, error) {
return n.iface.Update(obj)
}
func (n *listenerConfigClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *listenerConfigClient2) List(namespace string, opts metav1.ListOptions) (*ListenerConfigList, error) {
return n.iface.List(opts)
}
func (n *listenerConfigClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *listenerConfigClientCache) Get(namespace, name string) (*ListenerConfig, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *listenerConfigClientCache) List(namespace string, selector labels.Selector) ([]*ListenerConfig, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *listenerConfigClient2) Cache() ListenerConfigClientCache {
n.loadController()
return &listenerConfigClientCache{
client: n,
}
}
func (n *listenerConfigClient2) OnCreate(ctx context.Context, name string, sync ListenerConfigChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &listenerConfigLifecycleDelegate{create: sync})
}
func (n *listenerConfigClient2) OnChange(ctx context.Context, name string, sync ListenerConfigChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &listenerConfigLifecycleDelegate{update: sync})
}
func (n *listenerConfigClient2) OnRemove(ctx context.Context, name string, sync ListenerConfigChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &listenerConfigLifecycleDelegate{remove: sync})
}
func (n *listenerConfigClientCache) Index(name string, indexer ListenerConfigIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*ListenerConfig); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *listenerConfigClientCache) GetIndexed(name, key string) ([]*ListenerConfig, error) {
var result []*ListenerConfig
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
if err != nil {
return nil, err
}
for _, obj := range objs {
if v, ok := obj.(*ListenerConfig); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *listenerConfigClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type listenerConfigLifecycleDelegate struct {
create ListenerConfigChangeHandlerFunc
update ListenerConfigChangeHandlerFunc
remove ListenerConfigChangeHandlerFunc
}
func (n *listenerConfigLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *listenerConfigLifecycleDelegate) Create(obj *ListenerConfig) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *listenerConfigLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *listenerConfigLifecycleDelegate) Remove(obj *ListenerConfig) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *listenerConfigLifecycleDelegate) Updated(obj *ListenerConfig) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@ -1,62 +0,0 @@
package v1
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type ListenerConfigLifecycle interface {
Create(obj *ListenerConfig) (runtime.Object, error)
Remove(obj *ListenerConfig) (runtime.Object, error)
Updated(obj *ListenerConfig) (runtime.Object, error)
}
type listenerConfigLifecycleAdapter struct {
lifecycle ListenerConfigLifecycle
}
func (w *listenerConfigLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *listenerConfigLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *listenerConfigLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*ListenerConfig))
if o == nil {
return nil, err
}
return o, err
}
func (w *listenerConfigLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*ListenerConfig))
if o == nil {
return nil, err
}
return o, err
}
func (w *listenerConfigLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*ListenerConfig))
if o == nil {
return nil, err
}
return o, err
}
func NewListenerConfigLifecycleAdapter(name string, clusterScoped bool, client ListenerConfigInterface, l ListenerConfigLifecycle) ListenerConfigHandlerFunc {
adapter := &listenerConfigLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *ListenerConfig) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@ -1,44 +0,0 @@
package v1
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const (
GroupName = "k3s.cattle.io"
Version = "v1"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
// TODO this gets cleaned up when the types are fixed
scheme.AddKnownTypes(SchemeGroupVersion,
&Addon{},
&AddonList{},
&HelmChart{},
&HelmChartList{},
&ListenerConfig{},
&ListenerConfigList{},
)
return nil
}

View File

@ -1,440 +0,0 @@
package v1
import (
"context"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
v1 "k8s.io/api/rbac/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 (
ClusterRoleBindingGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "ClusterRoleBinding",
}
ClusterRoleBindingResource = metav1.APIResource{
Name: "clusterrolebindings",
SingularName: "clusterrolebinding",
Namespaced: false,
Kind: ClusterRoleBindingGroupVersionKind.Kind,
}
)
func NewClusterRoleBinding(namespace, name string, obj v1.ClusterRoleBinding) *v1.ClusterRoleBinding {
obj.APIVersion, obj.Kind = ClusterRoleBindingGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type ClusterRoleBindingList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []v1.ClusterRoleBinding
}
type ClusterRoleBindingHandlerFunc func(key string, obj *v1.ClusterRoleBinding) (runtime.Object, error)
type ClusterRoleBindingChangeHandlerFunc func(obj *v1.ClusterRoleBinding) (runtime.Object, error)
type ClusterRoleBindingLister interface {
List(namespace string, selector labels.Selector) (ret []*v1.ClusterRoleBinding, err error)
Get(namespace, name string) (*v1.ClusterRoleBinding, error)
}
type ClusterRoleBindingController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() ClusterRoleBindingLister
AddHandler(ctx context.Context, name string, handler ClusterRoleBindingHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler ClusterRoleBindingHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type ClusterRoleBindingInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*v1.ClusterRoleBinding) (*v1.ClusterRoleBinding, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.ClusterRoleBinding, error)
Get(name string, opts metav1.GetOptions) (*v1.ClusterRoleBinding, error)
Update(*v1.ClusterRoleBinding) (*v1.ClusterRoleBinding, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*ClusterRoleBindingList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() ClusterRoleBindingController
AddHandler(ctx context.Context, name string, sync ClusterRoleBindingHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle ClusterRoleBindingLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ClusterRoleBindingHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ClusterRoleBindingLifecycle)
}
type clusterRoleBindingLister struct {
controller *clusterRoleBindingController
}
func (l *clusterRoleBindingLister) List(namespace string, selector labels.Selector) (ret []*v1.ClusterRoleBinding, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*v1.ClusterRoleBinding))
})
return
}
func (l *clusterRoleBindingLister) Get(namespace, name string) (*v1.ClusterRoleBinding, 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: ClusterRoleBindingGroupVersionKind.Group,
Resource: "clusterRoleBinding",
}, key)
}
return obj.(*v1.ClusterRoleBinding), nil
}
type clusterRoleBindingController struct {
controller.GenericController
}
func (c *clusterRoleBindingController) Generic() controller.GenericController {
return c.GenericController
}
func (c *clusterRoleBindingController) Lister() ClusterRoleBindingLister {
return &clusterRoleBindingLister{
controller: c,
}
}
func (c *clusterRoleBindingController) AddHandler(ctx context.Context, name string, handler ClusterRoleBindingHandlerFunc) {
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.ClusterRoleBinding); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *clusterRoleBindingController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler ClusterRoleBindingHandlerFunc) {
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.ClusterRoleBinding); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type clusterRoleBindingFactory struct {
}
func (c clusterRoleBindingFactory) Object() runtime.Object {
return &v1.ClusterRoleBinding{}
}
func (c clusterRoleBindingFactory) List() runtime.Object {
return &ClusterRoleBindingList{}
}
func (s *clusterRoleBindingClient) Controller() ClusterRoleBindingController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.clusterRoleBindingControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ClusterRoleBindingGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &clusterRoleBindingController{
GenericController: genericController,
}
s.client.clusterRoleBindingControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type clusterRoleBindingClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller ClusterRoleBindingController
}
func (s *clusterRoleBindingClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *clusterRoleBindingClient) Create(o *v1.ClusterRoleBinding) (*v1.ClusterRoleBinding, error) {
obj, err := s.objectClient.Create(o)
return obj.(*v1.ClusterRoleBinding), err
}
func (s *clusterRoleBindingClient) Get(name string, opts metav1.GetOptions) (*v1.ClusterRoleBinding, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*v1.ClusterRoleBinding), err
}
func (s *clusterRoleBindingClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.ClusterRoleBinding, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*v1.ClusterRoleBinding), err
}
func (s *clusterRoleBindingClient) Update(o *v1.ClusterRoleBinding) (*v1.ClusterRoleBinding, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*v1.ClusterRoleBinding), err
}
func (s *clusterRoleBindingClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *clusterRoleBindingClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *clusterRoleBindingClient) List(opts metav1.ListOptions) (*ClusterRoleBindingList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*ClusterRoleBindingList), err
}
func (s *clusterRoleBindingClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *clusterRoleBindingClient) Patch(o *v1.ClusterRoleBinding, patchType types.PatchType, data []byte, subresources ...string) (*v1.ClusterRoleBinding, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*v1.ClusterRoleBinding), err
}
func (s *clusterRoleBindingClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *clusterRoleBindingClient) AddHandler(ctx context.Context, name string, sync ClusterRoleBindingHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *clusterRoleBindingClient) AddLifecycle(ctx context.Context, name string, lifecycle ClusterRoleBindingLifecycle) {
sync := NewClusterRoleBindingLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *clusterRoleBindingClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ClusterRoleBindingHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *clusterRoleBindingClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ClusterRoleBindingLifecycle) {
sync := NewClusterRoleBindingLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type ClusterRoleBindingIndexer func(obj *v1.ClusterRoleBinding) ([]string, error)
type ClusterRoleBindingClientCache interface {
Get(namespace, name string) (*v1.ClusterRoleBinding, error)
List(namespace string, selector labels.Selector) ([]*v1.ClusterRoleBinding, error)
Index(name string, indexer ClusterRoleBindingIndexer)
GetIndexed(name, key string) ([]*v1.ClusterRoleBinding, error)
}
type ClusterRoleBindingClient interface {
Create(*v1.ClusterRoleBinding) (*v1.ClusterRoleBinding, error)
Get(namespace, name string, opts metav1.GetOptions) (*v1.ClusterRoleBinding, error)
Update(*v1.ClusterRoleBinding) (*v1.ClusterRoleBinding, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*ClusterRoleBindingList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() ClusterRoleBindingClientCache
OnCreate(ctx context.Context, name string, sync ClusterRoleBindingChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync ClusterRoleBindingChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync ClusterRoleBindingChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() ClusterRoleBindingInterface
}
type clusterRoleBindingClientCache struct {
client *clusterRoleBindingClient2
}
type clusterRoleBindingClient2 struct {
iface ClusterRoleBindingInterface
controller ClusterRoleBindingController
}
func (n *clusterRoleBindingClient2) Interface() ClusterRoleBindingInterface {
return n.iface
}
func (n *clusterRoleBindingClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *clusterRoleBindingClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *clusterRoleBindingClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *clusterRoleBindingClient2) Create(obj *v1.ClusterRoleBinding) (*v1.ClusterRoleBinding, error) {
return n.iface.Create(obj)
}
func (n *clusterRoleBindingClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.ClusterRoleBinding, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *clusterRoleBindingClient2) Update(obj *v1.ClusterRoleBinding) (*v1.ClusterRoleBinding, error) {
return n.iface.Update(obj)
}
func (n *clusterRoleBindingClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *clusterRoleBindingClient2) List(namespace string, opts metav1.ListOptions) (*ClusterRoleBindingList, error) {
return n.iface.List(opts)
}
func (n *clusterRoleBindingClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *clusterRoleBindingClientCache) Get(namespace, name string) (*v1.ClusterRoleBinding, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *clusterRoleBindingClientCache) List(namespace string, selector labels.Selector) ([]*v1.ClusterRoleBinding, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *clusterRoleBindingClient2) Cache() ClusterRoleBindingClientCache {
n.loadController()
return &clusterRoleBindingClientCache{
client: n,
}
}
func (n *clusterRoleBindingClient2) OnCreate(ctx context.Context, name string, sync ClusterRoleBindingChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &clusterRoleBindingLifecycleDelegate{create: sync})
}
func (n *clusterRoleBindingClient2) OnChange(ctx context.Context, name string, sync ClusterRoleBindingChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &clusterRoleBindingLifecycleDelegate{update: sync})
}
func (n *clusterRoleBindingClient2) OnRemove(ctx context.Context, name string, sync ClusterRoleBindingChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &clusterRoleBindingLifecycleDelegate{remove: sync})
}
func (n *clusterRoleBindingClientCache) Index(name string, indexer ClusterRoleBindingIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*v1.ClusterRoleBinding); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *clusterRoleBindingClientCache) GetIndexed(name, key string) ([]*v1.ClusterRoleBinding, error) {
var result []*v1.ClusterRoleBinding
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.ClusterRoleBinding); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *clusterRoleBindingClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type clusterRoleBindingLifecycleDelegate struct {
create ClusterRoleBindingChangeHandlerFunc
update ClusterRoleBindingChangeHandlerFunc
remove ClusterRoleBindingChangeHandlerFunc
}
func (n *clusterRoleBindingLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *clusterRoleBindingLifecycleDelegate) Create(obj *v1.ClusterRoleBinding) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *clusterRoleBindingLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *clusterRoleBindingLifecycleDelegate) Remove(obj *v1.ClusterRoleBinding) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *clusterRoleBindingLifecycleDelegate) Updated(obj *v1.ClusterRoleBinding) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@ -1,63 +0,0 @@
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type ClusterRoleBindingLifecycle interface {
Create(obj *v1.ClusterRoleBinding) (runtime.Object, error)
Remove(obj *v1.ClusterRoleBinding) (runtime.Object, error)
Updated(obj *v1.ClusterRoleBinding) (runtime.Object, error)
}
type clusterRoleBindingLifecycleAdapter struct {
lifecycle ClusterRoleBindingLifecycle
}
func (w *clusterRoleBindingLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *clusterRoleBindingLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *clusterRoleBindingLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.ClusterRoleBinding))
if o == nil {
return nil, err
}
return o, err
}
func (w *clusterRoleBindingLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.ClusterRoleBinding))
if o == nil {
return nil, err
}
return o, err
}
func (w *clusterRoleBindingLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.ClusterRoleBinding))
if o == nil {
return nil, err
}
return o, err
}
func NewClusterRoleBindingLifecycleAdapter(name string, clusterScoped bool, client ClusterRoleBindingInterface, l ClusterRoleBindingLifecycle) ClusterRoleBindingHandlerFunc {
adapter := &clusterRoleBindingLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.ClusterRoleBinding) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@ -1,39 +0,0 @@
package v1
import (
rbacv1 "k8s.io/api/rbac/v1"
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 *ClusterRoleBindingList) DeepCopyInto(out *ClusterRoleBindingList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]rbacv1.ClusterRoleBinding, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRoleBindingList.
func (in *ClusterRoleBindingList) DeepCopy() *ClusterRoleBindingList {
if in == nil {
return nil
}
out := new(ClusterRoleBindingList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterRoleBindingList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}

View File

@ -1,119 +0,0 @@
package v1
import (
"context"
"sync"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"github.com/rancher/norman/objectclient/dynamic"
"github.com/rancher/norman/restwatch"
"k8s.io/client-go/rest"
)
type (
contextKeyType struct{}
contextClientsKeyType struct{}
)
type Interface interface {
RESTClient() rest.Interface
controller.Starter
ClusterRoleBindingsGetter
}
type Clients struct {
Interface Interface
ClusterRoleBinding ClusterRoleBindingClient
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
clusterRoleBindingControllers map[string]ClusterRoleBindingController
}
func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) {
c, err := NewForConfig(config)
if err != nil {
return ctx, nil, err
}
cs := NewClientsFromInterface(c)
ctx = context.WithValue(ctx, contextKeyType{}, c)
ctx = context.WithValue(ctx, contextClientsKeyType{}, cs)
return ctx, c, nil
}
func ClientsFrom(ctx context.Context) *Clients {
return ctx.Value(contextClientsKeyType{}).(*Clients)
}
func From(ctx context.Context) Interface {
return ctx.Value(contextKeyType{}).(Interface)
}
func NewClients(config rest.Config) (*Clients, error) {
iface, err := NewForConfig(config)
if err != nil {
return nil, err
}
return NewClientsFromInterface(iface), nil
}
func NewClientsFromInterface(iface Interface) *Clients {
return &Clients{
Interface: iface,
ClusterRoleBinding: &clusterRoleBindingClient2{
iface: iface.ClusterRoleBindings(""),
},
}
}
func NewForConfig(config rest.Config) (Interface, error) {
if config.NegotiatedSerializer == nil {
config.NegotiatedSerializer = dynamic.NegotiatedSerializer
}
restClient, err := restwatch.UnversionedRESTClientFor(&config)
if err != nil {
return nil, err
}
return &Client{
restClient: restClient,
clusterRoleBindingControllers: map[string]ClusterRoleBindingController{},
}, nil
}
func (c *Client) RESTClient() rest.Interface {
return c.restClient
}
func (c *Client) Sync(ctx context.Context) error {
return controller.Sync(ctx, c.starters...)
}
func (c *Client) Start(ctx context.Context, threadiness int) error {
return controller.Start(ctx, threadiness, c.starters...)
}
type ClusterRoleBindingsGetter interface {
ClusterRoleBindings(namespace string) ClusterRoleBindingInterface
}
func (c *Client) ClusterRoleBindings(namespace string) ClusterRoleBindingInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ClusterRoleBindingResource, ClusterRoleBindingGroupVersionKind, clusterRoleBindingFactory{})
return &clusterRoleBindingClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}

View File

@ -1,39 +0,0 @@
package v1
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const (
GroupName = "rbac.authorization.k8s.io"
Version = "v1"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
// TODO this gets cleaned up when the types are fixed
scheme.AddKnownTypes(SchemeGroupVersion,
&ClusterRoleBindingList{},
)
return nil
}

View File

@ -11,7 +11,12 @@ package=github.com/opencontainers/runc/contrib/cmd/recvtty
k8s.io/kubernetes v1.14.1-k3s.4 https://github.com/rancher/k3s.git transitive=true,staging=true
github.com/rancher/norman 50017efee23caa79542ef685b65a7b783e0a73ca https://github.com/ibuildthecloud/norman.git
github.com/rancher/wrangler 4202dbfa88013c19238bb004d82e013f0593493d
github.com/rancher/wrangler-api efe26ac6a9d720e1bfa5a8cc5f8dce5ad598ce26
github.com/rancher/dynamiclistener 077eb13a904f2c62496f31b158135d9743526f82
github.com/rancher/remotedialer 20ec38853712bb6d348f0db9ac47d34c954c6b00
github.com/rancher/helm-controller 4f3b43bfd868bcb74fe847f8df88c482e9b70ff8
github.com/matryer/moq ee5226d43009 https://github.com/rancher/moq.git
github.com/coreos/flannel 823afe66b2266bf71f5bec24e6e28b26d70cfc7c https://github.com/ibuildthecloud/flannel.git
github.com/natefinch/lumberjack aee4629129445bbdfb69aa565537dcfa16544311
github.com/gorilla/mux v1.6.2
@ -121,3 +126,4 @@ github.com/rootless-containers/rootlesskit 893c1c3de71f54c301fdb85a7c0dd15c1933
github.com/theckman/go-flock v0.7.1
github.com/morikuni/aec 39771216ff4c63d11f5e604076f9c45e8be1067b

25
vendor/github.com/matryer/moq/.gitignore generated vendored Normal file
View File

@ -0,0 +1,25 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof
.vscode

19
vendor/github.com/matryer/moq/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,19 @@
language: go
sudo: false
go:
- 1.9.x
- 1.10.x
- 1.11.x
- tip
before_install:
- go get golang.org/x/lint/golint
before_script:
- go vet ./...
- golint ./...
script:
- go test -v ./...

21
vendor/github.com/matryer/moq/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016 Mat Ryer and David Hernandez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

108
vendor/github.com/matryer/moq/README.md generated vendored Normal file
View File

@ -0,0 +1,108 @@
![moq logo](moq-logo-small.png) [![Build Status](https://travis-ci.org/matryer/moq.svg?branch=master)](https://travis-ci.org/matryer/moq) [![Go Report Card](https://goreportcard.com/badge/github.com/matryer/moq)](https://goreportcard.com/report/github.com/matryer/moq)
Interface mocking tool for go generate.
By [Mat Ryer](https://twitter.com/matryer) and [David Hernandez](https://github.com/dahernan), with ideas lovingly stolen from [Ernesto Jimenez](https://github.com/ernesto-jimenez).
### What is Moq?
Moq is a tool that generates a struct from any interface. The struct can be used in test code as a mock of the interface.
![Preview](preview.png)
above: Moq generates the code on the right.
You can read more in the [Meet Moq blog post](http://bit.ly/meetmoq).
### Installing
To start using Moq, just run go get:
```
$ go get github.com/matryer/moq
```
### Usage
```
moq [flags] destination interface [interface2 [interface3 [...]]]
-out string
output file (default stdout)
-pkg string
package name (default will infer)
```
In a command line:
```
$ moq -out mocks_test.go . MyInterface
```
In code (for go generate):
```go
package my
//go:generate moq -out myinterface_moq_test.go . MyInterface
type MyInterface interface {
Method1() error
Method2(i int)
}
```
Then run `go generate` for your package.
### How to use it
Mocking interfaces is a nice way to write unit tests where you can easily control the behaviour of the mocked object.
Moq creates a struct that has a function field for each method, which you can declare in your test code.
This this example, Moq generated the `EmailSenderMock` type:
```go
func TestCompleteSignup(t *testing.T) {
var sentTo string
mockedEmailSender = &EmailSenderMock{
SendFunc: func(to, subject, body string) error {
sentTo = to
return nil
},
}
CompleteSignUp("me@email.com", mockedEmailSender)
callsToSend := len(mockedEmailSender.SendCalls())
if callsToSend != 1 {
t.Errorf("Send was called %d times", callsToSend)
}
if sentTo != "me@email.com" {
t.Errorf("unexpected recipient: %s", sentTo)
}
}
func CompleteSignUp(to string, sender EmailSender) {
// TODO: this
}
```
The mocked structure implements the interface, where each method calls the associated function field.
## Tips
* Keep mocked logic inside the test that is using it
* Only mock the fields you need
* It will panic if a nil function gets called
* Name arguments in the interface for a better experience
* Use closured variables inside your test function to capture details about the calls to the methods
* Use `.MethodCalls()` to track the calls
* Use `go:generate` to invoke the `moq` command
## License
The Moq project (and all code) is licensed under the [MIT License](LICENSE).
The Moq logo was created by [Chris Ryer](http://chrisryer.co.uk) and is licensed under the [Creative Commons Attribution 3.0 License](https://creativecommons.org/licenses/by/3.0/).

BIN
vendor/github.com/matryer/moq/moq-logo-small.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
vendor/github.com/matryer/moq/moq-logo.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

379
vendor/github.com/matryer/moq/pkg/moq/moq.go generated vendored Normal file
View File

@ -0,0 +1,379 @@
package moq
import (
"bytes"
"errors"
"fmt"
"go/format"
"go/types"
"io"
"os"
"path"
"path/filepath"
"strings"
"text/template"
"golang.org/x/tools/go/packages"
)
// This list comes from the golint codebase. Golint will complain about any of
// these being mixed-case, like "Id" instead of "ID".
var golintInitialisms = []string{
"ACL",
"API",
"ASCII",
"CPU",
"CSS",
"DNS",
"EOF",
"GUID",
"HTML",
"HTTP",
"HTTPS",
"ID",
"IP",
"JSON",
"LHS",
"QPS",
"RAM",
"RHS",
"RPC",
"SLA",
"SMTP",
"SQL",
"SSH",
"TCP",
"TLS",
"TTL",
"UDP",
"UI",
"UID",
"UUID",
"URI",
"URL",
"UTF8",
"VM",
"XML",
"XMPP",
"XSRF",
"XSS",
}
// Mocker can generate mock structs.
type Mocker struct {
srcPkg *packages.Package
tmpl *template.Template
pkgName string
pkgPath string
// importByPath of the format key:path value:alias
importByPath map[string]string
// importByAlias of the format key:alias value:path
importByAlias map[string]string
}
// New makes a new Mocker for the specified package directory.
func New(src, packageName string) (*Mocker, error) {
srcPkg, err := pkgInfoFromPath(src, packages.LoadSyntax)
if err != nil {
return nil, fmt.Errorf("Couldn't load source package: %s", err)
}
pkgPath := srcPkg.PkgPath
if len(packageName) == 0 {
packageName = srcPkg.Name
} else {
mockPkgPath := filepath.Join(src, packageName)
if _, err := os.Stat(mockPkgPath); os.IsNotExist(err) {
os.Mkdir(mockPkgPath, os.ModePerm)
}
mockPkg, err := pkgInfoFromPath(mockPkgPath, packages.LoadFiles)
if err != nil {
return nil, fmt.Errorf("Couldn't load mock package: %s", err)
}
pkgPath = mockPkg.PkgPath
}
tmpl, err := template.New("moq").Funcs(templateFuncs).Parse(moqTemplate)
if err != nil {
return nil, err
}
return &Mocker{
tmpl: tmpl,
srcPkg: srcPkg,
pkgName: packageName,
pkgPath: pkgPath,
importByPath: make(map[string]string),
importByAlias: make(map[string]string),
}, nil
}
// Mock generates a mock for the specified interface name.
func (m *Mocker) Mock(w io.Writer, name ...string) error {
if len(name) == 0 {
return errors.New("must specify one interface")
}
doc := doc{
PackageName: m.pkgName,
Imports: moqImports,
}
// Add sync first to ensure it doesn't get an alias which will break the template
m.addSyncImport()
var syncNeeded bool
tpkg := m.srcPkg.Types
for _, n := range name {
iface := tpkg.Scope().Lookup(n)
if iface == nil {
return fmt.Errorf("cannot find interface %s", n)
}
if !types.IsInterface(iface.Type()) {
return fmt.Errorf("%s (%s) not an interface", n, iface.Type().String())
}
iiface := iface.Type().Underlying().(*types.Interface).Complete()
obj := obj{
InterfaceName: n,
}
for i := 0; i < iiface.NumMethods(); i++ {
syncNeeded = true
meth := iiface.Method(i)
sig := meth.Type().(*types.Signature)
method := &method{
Name: meth.Name(),
}
obj.Methods = append(obj.Methods, method)
method.Params = m.extractArgs(sig, sig.Params(), "in%d")
method.Returns = m.extractArgs(sig, sig.Results(), "out%d")
}
doc.Objects = append(doc.Objects, obj)
}
if !syncNeeded {
delete(m.importByAlias, "sync")
delete(m.importByPath, "sync")
}
if tpkg.Name() != m.pkgName {
if _, ok := m.importByPath[tpkg.Path()]; !ok {
alias := m.getUniqueAlias(tpkg.Name())
m.importByAlias[alias] = tpkg.Path()
m.importByPath[tpkg.Path()] = alias
}
doc.SourcePackagePrefix = m.importByPath[tpkg.Path()] + "."
}
for alias, path := range m.importByAlias {
aliasImport := fmt.Sprintf(`%s "%s"`, alias, stripVendorPath(path))
doc.Imports = append(doc.Imports, aliasImport)
}
var buf bytes.Buffer
err := m.tmpl.Execute(&buf, doc)
if err != nil {
return err
}
formatted, err := format.Source(buf.Bytes())
if err != nil {
return fmt.Errorf("go/format: %s", err)
}
if _, err := w.Write(formatted); err != nil {
return err
}
return nil
}
func (m *Mocker) addSyncImport() {
if _, ok := m.importByPath["sync"]; !ok {
m.importByAlias["sync"] = "sync"
m.importByPath["sync"] = "sync"
}
}
func (m *Mocker) packageQualifier(pkg *types.Package) string {
if m.pkgPath == pkg.Path() {
return ""
}
path := pkg.Path()
if pkg.Path() == "." {
wd, err := os.Getwd()
if err == nil {
path = stripGopath(wd)
}
}
if alias, ok := m.importByPath[path]; ok {
return alias
}
alias := pkg.Name()
if _, ok := m.importByAlias[alias]; ok {
alias = m.getUniqueAlias(alias)
}
m.importByAlias[alias] = path
m.importByPath[path] = alias
return alias
}
func (m *Mocker) getUniqueAlias(alias string) string {
for i := 0; ; i++ {
newAlias := alias + string('a'+byte(i))
if _, exists := m.importByAlias[newAlias]; !exists {
return newAlias
}
}
}
func (m *Mocker) extractArgs(sig *types.Signature, list *types.Tuple, nameFormat string) []*param {
var params []*param
listLen := list.Len()
for ii := 0; ii < listLen; ii++ {
p := list.At(ii)
name := p.Name()
if name == "" {
name = fmt.Sprintf(nameFormat, ii+1)
}
typename := types.TypeString(p.Type(), m.packageQualifier)
// check for final variadic argument
variadic := sig.Variadic() && ii == listLen-1 && typename[0:2] == "[]"
param := &param{
Name: name,
Type: typename,
Variadic: variadic,
}
params = append(params, param)
}
return params
}
func pkgInfoFromPath(src string, mode packages.LoadMode) (*packages.Package, error) {
conf := packages.Config{
Mode: mode,
Dir: src,
}
pkgs, err := packages.Load(&conf)
if err != nil {
return nil, err
}
if len(pkgs) == 0 {
return nil, errors.New("No packages found")
}
if len(pkgs) > 1 {
return nil, errors.New("More than one package was found")
}
return pkgs[0], nil
}
type doc struct {
PackageName string
SourcePackagePrefix string
Objects []obj
Imports []string
}
type obj struct {
InterfaceName string
Methods []*method
}
type method struct {
Name string
Params []*param
Returns []*param
}
func (m *method) Arglist() string {
params := make([]string, len(m.Params))
for i, p := range m.Params {
params[i] = p.String()
}
return strings.Join(params, ", ")
}
func (m *method) ArgCallList() string {
params := make([]string, len(m.Params))
for i, p := range m.Params {
params[i] = p.CallName()
}
return strings.Join(params, ", ")
}
func (m *method) ReturnArglist() string {
params := make([]string, len(m.Returns))
for i, p := range m.Returns {
params[i] = p.TypeString()
}
if len(m.Returns) > 1 {
return fmt.Sprintf("(%s)", strings.Join(params, ", "))
}
return strings.Join(params, ", ")
}
type param struct {
Name string
Type string
Variadic bool
}
func (p param) String() string {
return fmt.Sprintf("%s %s", p.Name, p.TypeString())
}
func (p param) CallName() string {
if p.Variadic {
return p.Name + "..."
}
return p.Name
}
func (p param) TypeString() string {
if p.Variadic {
return "..." + p.Type[2:]
}
return p.Type
}
var templateFuncs = template.FuncMap{
"Exported": func(s string) string {
if s == "" {
return ""
}
for _, initialism := range golintInitialisms {
if strings.ToUpper(s) == initialism {
return initialism
}
}
return strings.ToUpper(s[0:1]) + s[1:]
},
}
// stripVendorPath strips the vendor dir prefix from a package path.
// For example we might encounter an absolute path like
// github.com/foo/bar/vendor/github.com/pkg/errors which is resolved
// to github.com/pkg/errors.
func stripVendorPath(p string) string {
parts := strings.Split(p, "/vendor/")
if len(parts) == 1 {
return p
}
return strings.TrimLeft(path.Join(parts[1:]...), "/")
}
// stripGopath takes the directory to a package and remove the gopath to get the
// canonical package name.
//
// taken from https://github.com/ernesto-jimenez/gogen
// Copyright (c) 2015 Ernesto Jiménez
func stripGopath(p string) string {
for _, gopath := range gopaths() {
p = strings.TrimPrefix(p, path.Join(gopath, "src")+"/")
}
return p
}
func gopaths() []string {
return strings.Split(os.Getenv("GOPATH"), string(filepath.ListSeparator))
}

107
vendor/github.com/matryer/moq/pkg/moq/template.go generated vendored Normal file
View File

@ -0,0 +1,107 @@
package moq
// moqImports are the imports all moq files get.
var moqImports = []string{}
// moqTemplate is the template for mocked code.
var moqTemplate = `// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package {{.PackageName}}
{{- $sourcePackagePrefix := .SourcePackagePrefix}}
import (
{{- range .Imports }}
{{.}}
{{- end }}
)
{{ range $i, $obj := .Objects -}}
var (
{{- range .Methods }}
lock{{$obj.InterfaceName}}Mock{{.Name}} sync.RWMutex
{{- end }}
)
// Ensure, that {{.InterfaceName}}Mock does implement {{.InterfaceName}}.
// If this is not the case, regenerate this file with moq.
var _ {{$sourcePackagePrefix}}{{.InterfaceName}} = &{{.InterfaceName}}Mock{}
// {{.InterfaceName}}Mock is a mock implementation of {{.InterfaceName}}.
//
// func TestSomethingThatUses{{.InterfaceName}}(t *testing.T) {
//
// // make and configure a mocked {{.InterfaceName}}
// mocked{{.InterfaceName}} := &{{.InterfaceName}}Mock{ {{ range .Methods }}
// {{.Name}}Func: func({{ .Arglist }}) {{.ReturnArglist}} {
// panic("mock out the {{.Name}} method")
// },{{- end }}
// }
//
// // use mocked{{.InterfaceName}} in code that requires {{.InterfaceName}}
// // and then make assertions.
//
// }
type {{.InterfaceName}}Mock struct {
{{- range .Methods }}
// {{.Name}}Func mocks the {{.Name}} method.
{{.Name}}Func func({{ .Arglist }}) {{.ReturnArglist}}
{{ end }}
// calls tracks calls to the methods.
calls struct {
{{- range .Methods }}
// {{ .Name }} holds details about calls to the {{.Name}} method.
{{ .Name }} []struct {
{{- range .Params }}
// {{ .Name | Exported }} is the {{ .Name }} argument value.
{{ .Name | Exported }} {{ .Type }}
{{- end }}
}
{{- end }}
}
}
{{ range .Methods }}
// {{.Name}} calls {{.Name}}Func.
func (mock *{{$obj.InterfaceName}}Mock) {{.Name}}({{.Arglist}}) {{.ReturnArglist}} {
if mock.{{.Name}}Func == nil {
panic("{{$obj.InterfaceName}}Mock.{{.Name}}Func: method is nil but {{$obj.InterfaceName}}.{{.Name}} was just called")
}
callInfo := struct {
{{- range .Params }}
{{ .Name | Exported }} {{ .Type }}
{{- end }}
}{
{{- range .Params }}
{{ .Name | Exported }}: {{ .Name }},
{{- end }}
}
lock{{$obj.InterfaceName}}Mock{{.Name}}.Lock()
mock.calls.{{.Name}} = append(mock.calls.{{.Name}}, callInfo)
lock{{$obj.InterfaceName}}Mock{{.Name}}.Unlock()
{{- if .ReturnArglist }}
return mock.{{.Name}}Func({{.ArgCallList}})
{{- else }}
mock.{{.Name}}Func({{.ArgCallList}})
{{- end }}
}
// {{.Name}}Calls gets all the calls that were made to {{.Name}}.
// Check the length with:
// len(mocked{{$obj.InterfaceName}}.{{.Name}}Calls())
func (mock *{{$obj.InterfaceName}}Mock) {{.Name}}Calls() []struct {
{{- range .Params }}
{{ .Name | Exported }} {{ .Type }}
{{- end }}
} {
var calls []struct {
{{- range .Params }}
{{ .Name | Exported }} {{ .Type }}
{{- end }}
}
lock{{$obj.InterfaceName}}Mock{{.Name}}.RLock()
calls = mock.calls.{{.Name}}
lock{{$obj.InterfaceName}}Mock{{.Name}}.RUnlock()
return calls
}
{{ end -}}
{{ end -}}`

BIN
vendor/github.com/matryer/moq/preview.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 KiB

178
vendor/github.com/rancher/dynamiclistener/LICENSE generated vendored Normal file
View File

@ -0,0 +1,178 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

14
vendor/github.com/rancher/dynamiclistener/go.mod generated vendored Normal file
View File

@ -0,0 +1,14 @@
module github.com/rancher/dynamiclistener
go 1.12
require (
github.com/hashicorp/golang-lru v0.5.1
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/sirupsen/logrus v1.4.1
github.com/stretchr/testify v1.3.0 // indirect
golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c // indirect
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862 // indirect
golang.org/x/text v0.3.2 // indirect
)

38
vendor/github.com/rancher/dynamiclistener/go.sum generated vendored Normal file
View File

@ -0,0 +1,38 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284 h1:rlLehGeYg6jfoyz/eDqDU1iRXLKfR42nnNh57ytKEWo=
golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c h1:uOCk1iQW6Vc18bnC13MfzScl+wdKBmM9Y9kU7Z83/lw=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862 h1:rM0ROo5vb9AdYJi1110yjWGMej9ITfKddS89P3Fkhug=
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

View File

@ -22,10 +22,9 @@ import (
"time"
lru "github.com/hashicorp/golang-lru"
cert "github.com/rancher/norman/pkg/cert"
cert "github.com/rancher/dynamiclistener/cert"
"github.com/sirupsen/logrus"
"golang.org/x/crypto/acme/autocert"
apierrors "k8s.io/apimachinery/pkg/api/errors"
)
const (
@ -66,9 +65,7 @@ func NewServer(listenConfigStorage ListenerConfigStorage, config UserConfig) (Se
}
lc, err := listenConfigStorage.Get()
if apierrors.IsNotFound(err) {
lc = &ListenerStatus{}
} else if err != nil {
if err != nil {
return nil, err
}
@ -104,9 +101,7 @@ func (s *server) save() {
changed := false
cfg, err := s.listenConfigStorage.Get()
if apierrors.IsNotFound(err) {
cfg = &ListenerStatus{}
} else if err != nil {
if err != nil {
return
}

View File

@ -2,8 +2,6 @@ package dynamiclistener
import (
"net/http"
"k8s.io/kubernetes/pkg/util/maps"
)
type ListenerConfigStorage interface {
@ -48,9 +46,17 @@ func (l *ListenerStatus) DeepCopyInto(t *ListenerStatus) {
t.Revision = l.Revision
t.CACert = l.CACert
t.CAKey = l.CAKey
t.GeneratedCerts = maps.CopySS(t.GeneratedCerts)
t.GeneratedCerts = copyMap(t.GeneratedCerts)
t.KnownIPs = map[string]bool{}
for k, v := range l.KnownIPs {
t.KnownIPs[k] = v
}
}
func copyMap(m map[string]string) map[string]string {
ret := map[string]string{}
for k, v := range m {
ret[k] = v
}
return ret
}

View File

@ -1,5 +1,4 @@
./bin
./.dapper
./dist
./.cache
./.trash-cache
./.idea
./dist

221
vendor/github.com/rancher/helm-controller/.drone.yml generated vendored Normal file
View File

@ -0,0 +1,221 @@
---
kind: pipeline
name: amd64
platform:
os: linux
arch: amd64
steps:
- name: build
image: rancher/dapper:v0.4.1
commands:
- dapper ci
volumes:
- name: docker
path: /var/run/docker.sock
- name: github_binary_release
image: plugins/github-release
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-amd64.txt
checksum_flatten: true
files:
- "dist/artifacts/*"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
- name: docker-publish
image: plugins/docker
settings:
dockerfile: package/Dockerfile
password:
from_secret: docker_password
repo: "rancher/helm-controller"
tag: "${DRONE_TAG}-amd64"
username:
from_secret: docker_username
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
volumes:
- name: docker
host:
path: /var/run/docker.sock
---
kind: pipeline
name: arm64
platform:
os: linux
arch: arm64
steps:
- name: build
image: rancher/dapper:v0.4.1
commands:
- dapper ci
volumes:
- name: docker
path: /var/run/docker.sock
- name: github_binary_release
image: plugins/github-release
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-arm64.txt
checksum_flatten: true
files:
- "dist/artifacts/*"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
- name: docker-publish
image: plugins/docker
settings:
dockerfile: package/Dockerfile
password:
from_secret: docker_password
repo: "rancher/helm-controller"
tag: "${DRONE_TAG}-arm64"
username:
from_secret: docker_username
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
volumes:
- name: docker
host:
path: /var/run/docker.sock
---
kind: pipeline
name: arm
platform:
os: linux
arch: arm
steps:
- name: build
image: rancher/dapper:v0.4.1
commands:
- dapper ci
volumes:
- name: docker
path: /var/run/docker.sock
- name: github_binary_release
image: plugins/github-release
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-arm.txt
checksum_flatten: true
files:
- "dist/artifacts/*"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
- name: docker-publish
image: plugins/docker
settings:
dockerfile: package/Dockerfile
password:
from_secret: docker_password
repo: "rancher/helm-controller"
tag: "${DRONE_TAG}-arm"
username:
from_secret: docker_username
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
volumes:
- name: docker
host:
path: /var/run/docker.sock
---
kind: pipeline
name: manifest
platform:
os: linux
arch: amd64
steps:
- name: manifest
image: plugins/manifest:1.0.2
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
platforms:
- linux/amd64
- linux/arm64
- linux/arm
target: "rancher/helm-controller:${DRONE_TAG}"
template: "rancher/helm-controller:${DRONE_TAG}-ARCH"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
depends_on:
- amd64
- arm64
- arm

6
vendor/github.com/rancher/helm-controller/.gitignore generated vendored Normal file
View File

@ -0,0 +1,6 @@
.DS_Store
/.dapper
/.idea
/bin
/dist
helm-controller

View File

@ -0,0 +1,26 @@
FROM golang:1.12.1-alpine3.9
RUN apk -U add bash git gcc musl-dev docker vim less file curl wget ca-certificates
RUN go get -d golang.org/x/lint/golint && \
git -C /go/src/golang.org/x/lint/golint checkout -b current 06c8688daad7faa9da5a0c2f163a3d14aac986ca && \
go install golang.org/x/lint/golint && \
rm -rf /go/src /go/pkg
RUN mkdir -p /go/src/golang.org/x && \
cd /go/src/golang.org/x && git clone https://github.com/golang/tools && \
git -C /go/src/golang.org/x/tools checkout -b current aa82965741a9fecd12b026fbb3d3c6ed3231b8f8 && \
go install golang.org/x/tools/cmd/goimports
RUN rm -rf /go/src /go/pkg
RUN if [ "${ARCH}" == "amd64" ]; then \
curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.15.0; \
fi
ENV DAPPER_ENV REPO TAG DRONE_TAG
ENV DAPPER_SOURCE /go/src/github.com/rancher/helm-controller/
ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_DOCKER_SOCKET true
ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache
ENV HOME ${DAPPER_SOURCE}
WORKDIR ${DAPPER_SOURCE}
ENTRYPOINT ["./scripts/entry"]
CMD ["ci"]

View File

@ -0,0 +1,26 @@
FROM golang:1.12.1-alpine3.9
RUN apk -U add bash git gcc musl-dev docker vim less file curl wget ca-certificates
RUN go get -d golang.org/x/lint/golint && \
git -C /go/src/golang.org/x/lint/golint checkout -b current 06c8688daad7faa9da5a0c2f163a3d14aac986ca && \
go install golang.org/x/lint/golint && \
rm -rf /go/src /go/pkg
RUN mkdir -p /go/src/golang.org/x && \
cd /go/src/golang.org/x && git clone https://github.com/golang/tools && \
git -C /go/src/golang.org/x/tools checkout -b current aa82965741a9fecd12b026fbb3d3c6ed3231b8f8 && \
go install golang.org/x/tools/cmd/goimports
RUN rm -rf /go/src /go/pkg
RUN if [ "${ARCH}" == "amd64" ]; then \
curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.15.0; \
fi
ENV DAPPER_ENV REPO TAG DRONE_TAG
ENV DAPPER_SOURCE /go/src/github.com/rancher/helm-controller/
ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_DOCKER_SOCKET true
ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache
ENV HOME ${DAPPER_SOURCE}
WORKDIR ${DAPPER_SOURCE}
ENTRYPOINT ["./scripts/entry"]
CMD ["ci"]

23
vendor/github.com/rancher/helm-controller/Makefile generated vendored Normal file
View File

@ -0,0 +1,23 @@
TARGETS := $(shell ls scripts)
.dapper:
@echo Downloading dapper
@curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > .dapper.tmp
@@chmod +x .dapper.tmp
@./.dapper.tmp -v
@mv .dapper.tmp .dapper
$(TARGETS): .dapper
./.dapper $@
trash: .dapper
./.dapper -m bind trash
trash-keep: .dapper
./.dapper -m bind trash -k
deps: trash
.DEFAULT_GOAL := ci
.PHONY: $(TARGETS)

50
vendor/github.com/rancher/helm-controller/README.md generated vendored Normal file
View File

@ -0,0 +1,50 @@
helm-controller
========
A simple way to manage helm charts with a Custom Resource Definitions in k8s.
## Manifests and Deploying
The `./manifests` folder contains useful YAML manifests to use for deploying and developing the Helm Controller. This simply YAML deployment creates a HelmChart CRD + a Deployment using the `rancher/helm-controller` container. The YAML might need some modifications for your environment so read below for Namespaced vs Cluster deployments and how to use them properly.
#### Namespaced Deploys
Use the `deploy-namespaced.yaml` to create a namespace and add the Helm Controller and CRD to that namespace locking down the Helm Controller to only see changes to CRDs within that namespace. This is defaulted to `helm-controller` so update the YAML to your needs before running `kubectl create`
#### Cluster Scoped Deploys
If you'd like your helm controller to watch the entire cluster for HelmChart CRD changes use the `deploy-cluster-scoped.yaml` deploy manifest. By default it will add the helm-controller to the `kube-system` so update `metadata.namespace` for your needs.
## Uninstalling
To remove the Helm Controller run `kubectl delete` and pass the deployment YAML used using to create the Deployment `-f` parameter.
## Developing and Building
The Helm Controller is easy to get running locally, follow the instructions for your needs and requires a running k8s server + CRDs etc. When you have a working k8s cluster you can use can use `./manifest/crd.yaml` to create the CRD and `./manifest/example-helmchart.yaml` which runs the `stable/traefik` helm chart.
#### Locally
Building and running natively will start a daemon which will watch a local k8s API. See Manifests section above about how to to create the CRD and Objects using the provided manifests.
```
go build -o ./bin/helm-controller
./bin/helm-controller --kubeconfig $HOME/.kube/config
```
#### docker/k8s
An easy way to get started with docker/k8s is to install docker for windows/mac and use the included k8s cluster. Once functioning you can easily build locally and get a docker container to pull the Helm Controller container and run it in k8s. Use `make` to launch a linux container and build to create a container. Use the `./manifests/deploy-*.yaml` definitions to get it into your cluster and update `containers.image` to point to your locally image e.g. `image: rancher/helm-controller:dev`
#### Options and Usage
Use `./bin/helm-controller help` to get full usage details. The outside of a k8s Pod the most important options are `--kubeconfig` or `--masterurl` or it will not run. All options have corresponding ENV variables you could use.
## Testing
`go test ./...`
## License
Copyright (c) 2019 [Rancher Labs, Inc.](http://rancher.com)
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](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.

17
vendor/github.com/rancher/helm-controller/go.mod generated vendored Normal file
View File

@ -0,0 +1,17 @@
module github.com/rancher/helm-controller
go 1.12
require (
github.com/rancher/wrangler v0.1.3
github.com/rancher/wrangler-api v0.1.3
github.com/sirupsen/logrus v1.4.1
github.com/stretchr/testify v1.3.0
github.com/urfave/cli v1.20.0
k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b
k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
k8s.io/klog v0.3.0
)
replace github.com/matryer/moq => github.com/rancher/moq v0.0.0-20190404221404-ee5226d43009

230
vendor/github.com/rancher/helm-controller/go.sum generated vendored Normal file
View File

@ -0,0 +1,230 @@
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/evanphx/json-patch v4.1.0+incompatible h1:K1MDoo4AZ4wU0GIU/fPmtZg7VpzLjCxu+UwBD1FvwOc=
github.com/evanphx/json-patch v4.1.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch v4.2.0+incompatible h1:fUDGZCv/7iAN7u0puUVhvKCcsR6vRfwrJatElLBEf0I=
github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0=
github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg=
github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc=
github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415 h1:WSBJMqJbLxsn+bTCPyPYZfqHdJmc8MK4wrBjMft6BAM=
github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef h1:veQD95Isof8w9/WXiA+pa3tz3fJXkt5B7QaRBrM62gk=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/googleapis/gnostic v0.0.0-20170426233943-68f4ded48ba9/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
github.com/googleapis/gnostic v0.2.0 h1:l6N3VoaVzTncYYW+9yOz2LJJammFZGBO13sqgEhpy9g=
github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc h1:f8eY6cV/x1x+HLjOp4r72s/31/V2aTUtg5oKRRPf8/Q=
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/imdario/mergo v0.3.7 h1:Y+UAYTZ7gDEuOfhxKWy+dvb5dRQ6rJjFSdX2HZY1/gI=
github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/jetstack/cert-manager v0.7.2/go.mod h1:nbddmhjWxYGt04bxvwVGUSeLhZ2PCyNvd7MpXdq+yWY=
github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/knative/build v0.6.0/go.mod h1:/sU74ZQkwlYA5FwYDJhYTy61i/Kn+5eWfln2jDbw3Qo=
github.com/knative/pkg v0.0.0-20190514205332-5e4512dcb2ca/go.mod h1:7Ijfhw7rfB+H9VtosIsDYvZQ+qYTz7auK3fHW/5z4ww=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a/go.mod h1:M1qoD/MqPgTZIk0EWKB38wE28ACRfVcn+cU08jyArI0=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w=
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rancher/moq v0.0.0-20190404221404-ee5226d43009 h1:Xsxh7fX3+2wAUJtPy8g2lZh0cYuyifqhBL0vxCIYojs=
github.com/rancher/moq v0.0.0-20190404221404-ee5226d43009/go.mod h1:wpITyDPTi/Na5h73XkbuEf2AP9fbgrIGqqxVzFhYD6U=
github.com/rancher/wrangler v0.0.0-20190508234038-148d437b510d h1:a7LRgBKNx8USp166pvf4ijrpZmUl8I4Gl6qfFyZpEeo=
github.com/rancher/wrangler v0.0.0-20190508234038-148d437b510d/go.mod h1:snD4YYjLOsxOwXNQORUkKr0y2TOVk54yWjgZ7myL8es=
github.com/rancher/wrangler v0.0.0-20190509213517-cd48b2f2b218 h1:4oOkdVjB8JlNX/89BwMX/tq8h+N31C0egp2XrLfj/nI=
github.com/rancher/wrangler v0.0.0-20190509213517-cd48b2f2b218/go.mod h1:MJVnlQzIsxIt65C9TkmqpYB9mjJW812s2jPNjxYPHNA=
github.com/rancher/wrangler v0.0.0-20190516181950-a7cf48fa83ef/go.mod h1:EYP7cqpg42YqElaCm+U9ieSrGQKAXxUH5xsr+XGpWyE=
github.com/rancher/wrangler v0.1.0 h1:AIvfe1KLVbj7vsp/pWXeBrjxqP7hHZHHECxsniTC78M=
github.com/rancher/wrangler v0.1.0/go.mod h1:EYP7cqpg42YqElaCm+U9ieSrGQKAXxUH5xsr+XGpWyE=
github.com/rancher/wrangler v0.1.1 h1:Xz0i5RtpWaqV/83xisxESOBIjf3JnsPExukR+3fiD8M=
github.com/rancher/wrangler v0.1.1/go.mod h1:EYP7cqpg42YqElaCm+U9ieSrGQKAXxUH5xsr+XGpWyE=
github.com/rancher/wrangler v0.1.2 h1:+oehkcBDInF6dcnG1ZWczL/tV/c7J8ILP3qEFCme7lw=
github.com/rancher/wrangler v0.1.2/go.mod h1:EYP7cqpg42YqElaCm+U9ieSrGQKAXxUH5xsr+XGpWyE=
github.com/rancher/wrangler v0.1.3 h1:WVMLj7kxTOx2pQyAnUKbbFhuFqhAuzkrsSvk37VaYwY=
github.com/rancher/wrangler v0.1.3/go.mod h1:EYP7cqpg42YqElaCm+U9ieSrGQKAXxUH5xsr+XGpWyE=
github.com/rancher/wrangler-api v0.1.1 h1:qzIgDnURHTlJ31jMTy917L3y0tAjYRaHhMdmT+Z393s=
github.com/rancher/wrangler-api v0.1.1/go.mod h1:vholckBg588JqP3M3vyEDUz/ERaB1M3ilnCuV5XxPHM=
github.com/rancher/wrangler-api v0.1.2 h1:PKWfgxQKNG5v2R7Uo+NYWk6wRXShV55WymiKAFk9eIU=
github.com/rancher/wrangler-api v0.1.2/go.mod h1:zD0Xy4pu2mTUE9pabkOwdzhwms8Yl9AGvDJzGW260Wk=
github.com/rancher/wrangler-api v0.1.3 h1:W6FPEb9cGRNpidiw6S5mu+C6iZ4Ji+wBobjybPOdxQo=
github.com/rancher/wrangler-api v0.1.3/go.mod h1:KPJcBpKwfzsfBL8BO+3fU17NBw8bAk3DUVnHIwE8BGE=
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff h1:VARhShG49tiji6mdRNp7JTNDtJ0FhuprF93GBQ37xGU=
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.1 h1:aCvUg6QPl3ibpQUxyLkrEkCHtPqYJL4x9AuhqVqFis4=
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a h1:YX8ljsm6wXlHZO+aRz9Exqr0evNhKRNe5K/gi+zKh4U=
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190318221613-d196dffd7c2b h1:ZWpVMTsK0ey5WJCu+vVdfMldWq7/ezaOcjnKWIHWVkE=
golang.org/x/net v0.0.0-20190318221613-d196dffd7c2b/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a h1:tImsplftrFpALCYumobsd0K86vlAs/eXGFms2txfJfA=
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 h1:bjcUS9ztw9kFmmIxJInhon/0Is3p+EHBKNgquIzo1OI=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313 h1:pczuHS43Cp2ktBEEmLwScxgjWsBSzdaQiKzUyf3DTTc=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384 h1:TFlARGu6Czu1z7q93HTxcP1P+/ZFC/IKythI5RzrnRg=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190411180116-681f9ce8ac52 h1:9RlW/mHPSeoxtqVWkJ7ZugoTFX8WFZRzmCep/niCbtU=
golang.org/x/tools v0.0.0-20190411180116-681f9ce8ac52/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0=
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ=
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
k8s.io/api v0.0.0-20190222213804-5cb15d344471 h1:MzQGt8qWQCR+39kbYRd0uQqsvSidpYqJLFeWiJ9l4OE=
k8s.io/api v0.0.0-20190222213804-5cb15d344471/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b h1:aBGgKJUM9Hk/3AE8WaZIApnTxG35kbuQba2w+SXqezo=
k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
k8s.io/apiextensions-apiserver v0.0.0-20190325193600-475668423e9f h1:+GpMltIq6SUOswgSQ3HcxgldikyBCreeRDkCYOzwfGk=
k8s.io/apiextensions-apiserver v0.0.0-20190325193600-475668423e9f/go.mod h1:IxkesAMoaCRoLrPJdZNZUQp9NfZnzqaVzLhb2VEQzXE=
k8s.io/apiextensions-apiserver v0.0.0-20190409022649-727a075fdec8/go.mod h1:IxkesAMoaCRoLrPJdZNZUQp9NfZnzqaVzLhb2VEQzXE=
k8s.io/apimachinery v0.0.0-20190221213512-86fb29eff628 h1:UYfHH+KEF88OTg+GojQUwFTNxbxwmoktLwutUzR0GPg=
k8s.io/apimachinery v0.0.0-20190221213512-86fb29eff628/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d h1:Jmdtdt1ZnoGfWWIIik61Z7nKYgO3J+swQJtPYsP9wHA=
k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
k8s.io/client-go v2.0.0-alpha.0.0.20190307161346-7621a5ebb88b+incompatible h1:SBpo3pl4emC76nXrrQB25cUzPngCnfzwthOsvcvgsVM=
k8s.io/client-go v2.0.0-alpha.0.0.20190307161346-7621a5ebb88b+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible h1:U5Bt+dab9K8qaUmXINrkXO135kA11/i5Kg1RUydgaMQ=
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
k8s.io/code-generator v0.0.0-20181117043124-c2090bec4d9b h1:KH0fUlgdFZH8UMxJ/FDCYHpczfSQKefetq5NjL6BVF0=
k8s.io/code-generator v0.0.0-20181117043124-c2090bec4d9b/go.mod h1:MYiN+ZJZ9HkETbgVZdWw2AsuAi9PZ4V80cwfuf2axe8=
k8s.io/code-generator v0.0.0-20190311093542-50b561225d70 h1:lgPp615xLHxN84RBd+viA/oHzJfI0miFYFH4T9wpPQ4=
k8s.io/code-generator v0.0.0-20190311093542-50b561225d70/go.mod h1:MYiN+ZJZ9HkETbgVZdWw2AsuAi9PZ4V80cwfuf2axe8=
k8s.io/code-generator v0.0.0-20190419212335-ff26e7842f9d h1:QY1FeareEgkYrWnF2D2XxZFlF0k5Ir4uE8YjD1kHi94=
k8s.io/code-generator v0.0.0-20190419212335-ff26e7842f9d/go.mod h1:rVrFWfTVftGH7bb972nWC6N4QkJ4LU7FOXu8GH2UkJo=
k8s.io/gengo v0.0.0-20190116091435-f8a0810f38af/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20190327210449-e17681d19d3a h1:QoHVuRquf80YZ+/bovwxoMO3Q/A3nt3yTgS0/0nejuk=
k8s.io/gengo v0.0.0-20190327210449-e17681d19d3a/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v0.2.0 h1:0ElL0OHzF3N+OhoJTL0uca20SxtYt4X4+bzHeqrB83c=
k8s.io/klog v0.2.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v0.3.0 h1:0VPpR+sizsiivjIfIAQH/rl8tan6jvWkS7lU+0di3lE=
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/kube-openapi v0.0.0-20190401085232-94e1e7b7574c h1:kJCzg2vGCzah5icgkKR7O1Dzn0NA2iGlym27sb0ZfGE=
k8s.io/kube-openapi v0.0.0-20190401085232-94e1e7b7574c/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc=
k8s.io/kube-openapi v0.0.0-20190502190224-411b2483e503 h1:IrnrEIp9du1SngrzGC1fdYEdos7Il6I6EVxwFQHJwCg=
k8s.io/kube-openapi v0.0.0-20190502190224-411b2483e503/go.mod h1:iU+ZGYsNlvU9XKUSso6SQfKTCCw7lFduMZy26Mgr2Fw=
k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7 h1:8r+l4bNWjRlsFYlQJnKJ2p7s1YQPj4XyXiJVqDHRx7c=
k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7/go.mod h1:8k8uAuAQ0rXslZKaEWd0c3oVhZz7sSzSiPnVZayjIX0=
k8s.io/utils v0.0.0-20190506122338-8fab8cb257d5 h1:VBM/0P5TWxwk+Nw6Z+lAw3DKgO76g90ETOiA6rfLV1Y=
k8s.io/utils v0.0.0-20190506122338-8fab8cb257d5/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I=
sigs.k8s.io/structured-merge-diff v0.0.0-20190426204423-ea680f03cc65/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=

View File

@ -1,5 +1,5 @@
/*
Copyright 2016 The Kubernetes Authors.
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.
@ -14,16 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package maps
// Code generated by main. DO NOT EDIT.
// CopySS makes a shallow copy of a map.
func CopySS(m map[string]string) map[string]string {
if m == nil {
return nil
}
copy := make(map[string]string, len(m))
for k, v := range m {
copy[k] = v
}
return copy
}
// +k8s:deepcopy-gen=package
// +groupName=helm.cattle.io
package v1

View File

@ -0,0 +1,30 @@
package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type HelmChart struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec HelmChartSpec `json:"spec,omitempty"`
Status HelmChartStatus `json:"status,omitempty"`
}
type HelmChartSpec struct {
TargetNamespace string `json:"targetNamespace,omitempty"`
Chart string `json:"chart,omitempty"`
Version string `json:"version,omitempty"`
Repo string `json:"repo,omitempty"`
Set map[string]intstr.IntOrString `json:"set,omitempty"`
ValuesContent string `json:"valuesContent,omitempty"`
}
type HelmChartStatus struct {
JobName string `json:"jobName,omitempty"`
}

View File

@ -0,0 +1,126 @@
// +build !ignore_autogenerated
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package v1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
intstr "k8s.io/apimachinery/pkg/util/intstr"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HelmChart) DeepCopyInto(out *HelmChart) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChart.
func (in *HelmChart) DeepCopy() *HelmChart {
if in == nil {
return nil
}
out := new(HelmChart)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *HelmChart) 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 *HelmChartList) DeepCopyInto(out *HelmChartList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]HelmChart, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartList.
func (in *HelmChartList) DeepCopy() *HelmChartList {
if in == nil {
return nil
}
out := new(HelmChartList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *HelmChartList) 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 *HelmChartSpec) DeepCopyInto(out *HelmChartSpec) {
*out = *in
if in.Set != nil {
in, out := &in.Set, &out.Set
*out = make(map[string]intstr.IntOrString, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartSpec.
func (in *HelmChartSpec) DeepCopy() *HelmChartSpec {
if in == nil {
return nil
}
out := new(HelmChartSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HelmChartStatus) DeepCopyInto(out *HelmChartStatus) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartStatus.
func (in *HelmChartStatus) DeepCopy() *HelmChartStatus {
if in == nil {
return nil
}
out := new(HelmChartStatus)
in.DeepCopyInto(out)
return out
}

View File

@ -0,0 +1,42 @@
/*
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 main. DO NOT EDIT.
// +k8s:deepcopy-gen=package
// +groupName=helm.cattle.io
package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// HelmChartList is a list of HelmChart resources
type HelmChartList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []HelmChart `json:"items"`
}
func NewHelmChart(namespace, name string, obj HelmChart) *HelmChart {
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("HelmChart").ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}

View File

@ -0,0 +1,56 @@
/*
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 main. DO NOT EDIT.
// +k8s:deepcopy-gen=package
// +groupName=helm.cattle.io
package v1
import (
helm "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: helm.GroupName, Version: "v1"}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&HelmChart{},
&HelmChartList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}

View File

@ -0,0 +1,24 @@
/*
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 main. DO NOT EDIT.
package helm
const (
// Package-wide consts from generator "zz_generated_register".
GroupName = "helm.cattle.io"
)

View File

@ -0,0 +1,90 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package versioned
import (
helmv1 "github.com/rancher/helm-controller/pkg/generated/clientset/versioned/typed/helm.cattle.io/v1"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
)
type Interface interface {
Discovery() discovery.DiscoveryInterface
HelmV1() helmv1.HelmV1Interface
}
// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
helmV1 *helmv1.HelmV1Client
}
// HelmV1 retrieves the HelmV1Client
func (c *Clientset) HelmV1() helmv1.HelmV1Interface {
return c.helmV1
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
if c == nil {
return nil
}
return c.DiscoveryClient
}
// NewForConfig creates a new Clientset for the given config.
func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
}
var cs Clientset
var err error
cs.helmV1, err = helmv1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
return &cs, nil
}
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset
cs.helmV1 = helmv1.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
}
// New creates a new Clientset for the given RESTClient.
func New(c rest.Interface) *Clientset {
var cs Clientset
cs.helmV1 = helmv1.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs
}

View File

@ -0,0 +1,20 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
// This package has the automatically generated clientset.
package versioned

View File

@ -0,0 +1,20 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
// This package contains the scheme of the automatically generated clientset.
package scheme

View File

@ -0,0 +1,56 @@
/*
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 main. DO NOT EDIT.
package scheme
import (
helmv1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
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"
)
var Scheme = runtime.NewScheme()
var Codecs = serializer.NewCodecFactory(Scheme)
var ParameterCodec = runtime.NewParameterCodec(Scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
helmv1.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
// of clientsets, like in:
//
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
var AddToScheme = localSchemeBuilder.AddToScheme
func init() {
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
utilruntime.Must(AddToScheme(Scheme))
}

View File

@ -0,0 +1,20 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1

View File

@ -0,0 +1,21 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package v1
type HelmChartExpansion interface{}

View File

@ -0,0 +1,90 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package v1
import (
v1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
"github.com/rancher/helm-controller/pkg/generated/clientset/versioned/scheme"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
rest "k8s.io/client-go/rest"
)
type HelmV1Interface interface {
RESTClient() rest.Interface
HelmChartsGetter
}
// HelmV1Client is used to interact with features provided by the helm.cattle.io group.
type HelmV1Client struct {
restClient rest.Interface
}
func (c *HelmV1Client) HelmCharts(namespace string) HelmChartInterface {
return newHelmCharts(c, namespace)
}
// NewForConfig creates a new HelmV1Client for the given config.
func NewForConfig(c *rest.Config) (*HelmV1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &HelmV1Client{client}, nil
}
// NewForConfigOrDie creates a new HelmV1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *HelmV1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new HelmV1Client for the given RESTClient.
func New(c rest.Interface) *HelmV1Client {
return &HelmV1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *HelmV1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@ -0,0 +1,191 @@
/*
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 main. DO NOT EDIT.
package v1
import (
"time"
v1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
scheme "github.com/rancher/helm-controller/pkg/generated/clientset/versioned/scheme"
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"
)
// HelmChartsGetter has a method to return a HelmChartInterface.
// A group's client should implement this interface.
type HelmChartsGetter interface {
HelmCharts(namespace string) HelmChartInterface
}
// HelmChartInterface has methods to work with HelmChart resources.
type HelmChartInterface interface {
Create(*v1.HelmChart) (*v1.HelmChart, error)
Update(*v1.HelmChart) (*v1.HelmChart, error)
UpdateStatus(*v1.HelmChart) (*v1.HelmChart, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
Get(name string, options metav1.GetOptions) (*v1.HelmChart, error)
List(opts metav1.ListOptions) (*v1.HelmChartList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.HelmChart, err error)
HelmChartExpansion
}
// helmCharts implements HelmChartInterface
type helmCharts struct {
client rest.Interface
ns string
}
// newHelmCharts returns a HelmCharts
func newHelmCharts(c *HelmV1Client, namespace string) *helmCharts {
return &helmCharts{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the helmChart, and returns the corresponding helmChart object, and an error if there is any.
func (c *helmCharts) Get(name string, options metav1.GetOptions) (result *v1.HelmChart, err error) {
result = &v1.HelmChart{}
err = c.client.Get().
Namespace(c.ns).
Resource("helmcharts").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of HelmCharts that match those selectors.
func (c *helmCharts) List(opts metav1.ListOptions) (result *v1.HelmChartList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1.HelmChartList{}
err = c.client.Get().
Namespace(c.ns).
Resource("helmcharts").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested helmCharts.
func (c *helmCharts) 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("helmcharts").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
// Create takes the representation of a helmChart and creates it. Returns the server's representation of the helmChart, and an error, if there is any.
func (c *helmCharts) Create(helmChart *v1.HelmChart) (result *v1.HelmChart, err error) {
result = &v1.HelmChart{}
err = c.client.Post().
Namespace(c.ns).
Resource("helmcharts").
Body(helmChart).
Do().
Into(result)
return
}
// Update takes the representation of a helmChart and updates it. Returns the server's representation of the helmChart, and an error, if there is any.
func (c *helmCharts) Update(helmChart *v1.HelmChart) (result *v1.HelmChart, err error) {
result = &v1.HelmChart{}
err = c.client.Put().
Namespace(c.ns).
Resource("helmcharts").
Name(helmChart.Name).
Body(helmChart).
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 *helmCharts) UpdateStatus(helmChart *v1.HelmChart) (result *v1.HelmChart, err error) {
result = &v1.HelmChart{}
err = c.client.Put().
Namespace(c.ns).
Resource("helmcharts").
Name(helmChart.Name).
SubResource("status").
Body(helmChart).
Do().
Into(result)
return
}
// Delete takes name of the helmChart and deletes it. Returns an error if one occurs.
func (c *helmCharts) Delete(name string, options *metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("helmcharts").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *helmCharts) 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("helmcharts").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()
}
// Patch applies the patch and returns the patched helmChart.
func (c *helmCharts) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.HelmChart, err error) {
result = &v1.HelmChart{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("helmcharts").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,101 @@
/*
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 main. DO NOT EDIT.
package helm
import (
"context"
"time"
clientset "github.com/rancher/helm-controller/pkg/generated/clientset/versioned"
informers "github.com/rancher/helm-controller/pkg/generated/informers/externalversions"
"github.com/rancher/wrangler/pkg/generic"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/rest"
)
type Factory struct {
synced bool
informerFactory informers.SharedInformerFactory
clientset clientset.Interface
controllerManager *generic.ControllerManager
threadiness map[schema.GroupVersionKind]int
}
func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
f, err := NewFactoryFromConfig(config)
if err != nil {
panic(err)
}
return f
}
func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
cs, err := clientset.NewForConfig(config)
if err != nil {
return nil, err
}
informerFactory := informers.NewSharedInformerFactory(cs, 2*time.Hour)
return NewFactory(cs, informerFactory), nil
}
func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace string) (*Factory, error) {
if namespace == "" {
return NewFactoryFromConfig(config)
}
cs, err := clientset.NewForConfig(config)
if err != nil {
return nil, err
}
informerFactory := informers.NewSharedInformerFactoryWithOptions(cs, 2*time.Hour, informers.WithNamespace(namespace))
return NewFactory(cs, informerFactory), nil
}
func NewFactory(clientset clientset.Interface, informerFactory informers.SharedInformerFactory) *Factory {
return &Factory{
threadiness: map[schema.GroupVersionKind]int{},
controllerManager: &generic.ControllerManager{},
clientset: clientset,
informerFactory: informerFactory,
}
}
func (c *Factory) SetThreadiness(gvk schema.GroupVersionKind, threadiness int) {
c.threadiness[gvk] = threadiness
}
func (c *Factory) Sync(ctx context.Context) error {
c.informerFactory.Start(ctx.Done())
c.informerFactory.WaitForCacheSync(ctx.Done())
return nil
}
func (c *Factory) Start(ctx context.Context, defaultThreadiness int) error {
if err := c.Sync(ctx); err != nil {
return err
}
return c.controllerManager.Start(ctx, defaultThreadiness, c.threadiness)
}
func (c *Factory) Helm() Interface {
return New(c.controllerManager, c.informerFactory.Helm(), c.clientset)
}

View File

@ -0,0 +1,50 @@
/*
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 main. DO NOT EDIT.
package helm
import (
clientset "github.com/rancher/helm-controller/pkg/generated/clientset/versioned"
v1 "github.com/rancher/helm-controller/pkg/generated/controllers/helm.cattle.io/v1"
informers "github.com/rancher/helm-controller/pkg/generated/informers/externalversions/helm.cattle.io"
"github.com/rancher/wrangler/pkg/generic"
)
type Interface interface {
V1() v1.Interface
}
type group struct {
controllerManager *generic.ControllerManager
informers informers.Interface
client clientset.Interface
}
// New returns a new Interface.
func New(controllerManager *generic.ControllerManager, informers informers.Interface,
client clientset.Interface) Interface {
return &group{
controllerManager: controllerManager,
informers: informers,
client: client,
}
}
func (g *group) V1() v1.Interface {
return v1.New(g.controllerManager, g.client.HelmV1(), g.informers.V1())
}

View File

@ -0,0 +1,242 @@
/*
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 main. DO NOT EDIT.
package v1
import (
"context"
v1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
clientset "github.com/rancher/helm-controller/pkg/generated/clientset/versioned/typed/helm.cattle.io/v1"
informers "github.com/rancher/helm-controller/pkg/generated/informers/externalversions/helm.cattle.io/v1"
listers "github.com/rancher/helm-controller/pkg/generated/listers/helm.cattle.io/v1"
"github.com/rancher/wrangler/pkg/generic"
"k8s.io/apimachinery/pkg/api/equality"
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"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
)
type HelmChartHandler func(string, *v1.HelmChart) (*v1.HelmChart, error)
type HelmChartController interface {
HelmChartClient
OnChange(ctx context.Context, name string, sync HelmChartHandler)
OnRemove(ctx context.Context, name string, sync HelmChartHandler)
Enqueue(namespace, name string)
Cache() HelmChartCache
Informer() cache.SharedIndexInformer
GroupVersionKind() schema.GroupVersionKind
AddGenericHandler(ctx context.Context, name string, handler generic.Handler)
AddGenericRemoveHandler(ctx context.Context, name string, handler generic.Handler)
Updater() generic.Updater
}
type HelmChartClient interface {
Create(*v1.HelmChart) (*v1.HelmChart, error)
Update(*v1.HelmChart) (*v1.HelmChart, error)
UpdateStatus(*v1.HelmChart) (*v1.HelmChart, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
Get(namespace, name string, options metav1.GetOptions) (*v1.HelmChart, error)
List(namespace string, opts metav1.ListOptions) (*v1.HelmChartList, error)
Watch(namespace string, opts metav1.ListOptions) (watch.Interface, error)
Patch(namespace, name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.HelmChart, err error)
}
type HelmChartCache interface {
Get(namespace, name string) (*v1.HelmChart, error)
List(namespace string, selector labels.Selector) ([]*v1.HelmChart, error)
AddIndexer(indexName string, indexer HelmChartIndexer)
GetByIndex(indexName, key string) ([]*v1.HelmChart, error)
}
type HelmChartIndexer func(obj *v1.HelmChart) ([]string, error)
type helmChartController struct {
controllerManager *generic.ControllerManager
clientGetter clientset.HelmChartsGetter
informer informers.HelmChartInformer
gvk schema.GroupVersionKind
}
func NewHelmChartController(gvk schema.GroupVersionKind, controllerManager *generic.ControllerManager, clientGetter clientset.HelmChartsGetter, informer informers.HelmChartInformer) HelmChartController {
return &helmChartController{
controllerManager: controllerManager,
clientGetter: clientGetter,
informer: informer,
gvk: gvk,
}
}
func FromHelmChartHandlerToHandler(sync HelmChartHandler) generic.Handler {
return func(key string, obj runtime.Object) (ret runtime.Object, err error) {
var v *v1.HelmChart
if obj == nil {
v, err = sync(key, nil)
} else {
v, err = sync(key, obj.(*v1.HelmChart))
}
if v == nil {
return nil, err
}
return v, err
}
}
func (c *helmChartController) Updater() generic.Updater {
return func(obj runtime.Object) (runtime.Object, error) {
newObj, err := c.Update(obj.(*v1.HelmChart))
if newObj == nil {
return nil, err
}
return newObj, err
}
}
func UpdateHelmChartOnChange(updater generic.Updater, handler HelmChartHandler) HelmChartHandler {
return func(key string, obj *v1.HelmChart) (*v1.HelmChart, error) {
if obj == nil {
return handler(key, nil)
}
copyObj := obj.DeepCopy()
newObj, err := handler(key, copyObj)
if newObj != nil {
copyObj = newObj
}
if obj.ResourceVersion == copyObj.ResourceVersion && !equality.Semantic.DeepEqual(obj, copyObj) {
newObj, err := updater(copyObj)
if newObj != nil && err == nil {
copyObj = newObj.(*v1.HelmChart)
}
}
return copyObj, err
}
}
func (c *helmChartController) AddGenericHandler(ctx context.Context, name string, handler generic.Handler) {
c.controllerManager.AddHandler(ctx, c.gvk, c.informer.Informer(), name, handler)
}
func (c *helmChartController) AddGenericRemoveHandler(ctx context.Context, name string, handler generic.Handler) {
removeHandler := generic.NewRemoveHandler(name, c.Updater(), handler)
c.controllerManager.AddHandler(ctx, c.gvk, c.informer.Informer(), name, removeHandler)
}
func (c *helmChartController) OnChange(ctx context.Context, name string, sync HelmChartHandler) {
c.AddGenericHandler(ctx, name, FromHelmChartHandlerToHandler(sync))
}
func (c *helmChartController) OnRemove(ctx context.Context, name string, sync HelmChartHandler) {
removeHandler := generic.NewRemoveHandler(name, c.Updater(), FromHelmChartHandlerToHandler(sync))
c.AddGenericHandler(ctx, name, removeHandler)
}
func (c *helmChartController) Enqueue(namespace, name string) {
c.controllerManager.Enqueue(c.gvk, c.informer.Informer(), namespace, name)
}
func (c *helmChartController) Informer() cache.SharedIndexInformer {
return c.informer.Informer()
}
func (c *helmChartController) GroupVersionKind() schema.GroupVersionKind {
return c.gvk
}
func (c *helmChartController) Cache() HelmChartCache {
return &helmChartCache{
lister: c.informer.Lister(),
indexer: c.informer.Informer().GetIndexer(),
}
}
func (c *helmChartController) Create(obj *v1.HelmChart) (*v1.HelmChart, error) {
return c.clientGetter.HelmCharts(obj.Namespace).Create(obj)
}
func (c *helmChartController) Update(obj *v1.HelmChart) (*v1.HelmChart, error) {
return c.clientGetter.HelmCharts(obj.Namespace).Update(obj)
}
func (c *helmChartController) UpdateStatus(obj *v1.HelmChart) (*v1.HelmChart, error) {
return c.clientGetter.HelmCharts(obj.Namespace).UpdateStatus(obj)
}
func (c *helmChartController) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return c.clientGetter.HelmCharts(namespace).Delete(name, options)
}
func (c *helmChartController) Get(namespace, name string, options metav1.GetOptions) (*v1.HelmChart, error) {
return c.clientGetter.HelmCharts(namespace).Get(name, options)
}
func (c *helmChartController) List(namespace string, opts metav1.ListOptions) (*v1.HelmChartList, error) {
return c.clientGetter.HelmCharts(namespace).List(opts)
}
func (c *helmChartController) Watch(namespace string, opts metav1.ListOptions) (watch.Interface, error) {
return c.clientGetter.HelmCharts(namespace).Watch(opts)
}
func (c *helmChartController) Patch(namespace, name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.HelmChart, err error) {
return c.clientGetter.HelmCharts(namespace).Patch(name, pt, data, subresources...)
}
type helmChartCache struct {
lister listers.HelmChartLister
indexer cache.Indexer
}
func (c *helmChartCache) Get(namespace, name string) (*v1.HelmChart, error) {
return c.lister.HelmCharts(namespace).Get(name)
}
func (c *helmChartCache) List(namespace string, selector labels.Selector) ([]*v1.HelmChart, error) {
return c.lister.HelmCharts(namespace).List(selector)
}
func (c *helmChartCache) AddIndexer(indexName string, indexer HelmChartIndexer) {
utilruntime.Must(c.indexer.AddIndexers(map[string]cache.IndexFunc{
indexName: func(obj interface{}) (strings []string, e error) {
return indexer(obj.(*v1.HelmChart))
},
}))
}
func (c *helmChartCache) GetByIndex(indexName, key string) (result []*v1.HelmChart, err error) {
objs, err := c.indexer.ByIndex(indexName, key)
if err != nil {
return nil, err
}
for _, obj := range objs {
result = append(result, obj.(*v1.HelmChart))
}
return result, nil
}

View File

@ -0,0 +1,49 @@
/*
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 main. DO NOT EDIT.
package v1
import (
v1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
clientset "github.com/rancher/helm-controller/pkg/generated/clientset/versioned/typed/helm.cattle.io/v1"
informers "github.com/rancher/helm-controller/pkg/generated/informers/externalversions/helm.cattle.io/v1"
"github.com/rancher/wrangler/pkg/generic"
)
type Interface interface {
HelmChart() HelmChartController
}
func New(controllerManager *generic.ControllerManager, client clientset.HelmV1Interface,
informers informers.Interface) Interface {
return &version{
controllerManager: controllerManager,
client: client,
informers: informers,
}
}
type version struct {
controllerManager *generic.ControllerManager
informers informers.Interface
client clientset.HelmV1Interface
}
func (c *version) HelmChart() HelmChartController {
return NewHelmChartController(v1.SchemeGroupVersion.WithKind("HelmChart"), c.controllerManager, c.client, c.informers.HelmCharts())
}

View File

@ -0,0 +1,180 @@
/*
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 main. DO NOT EDIT.
package externalversions
import (
reflect "reflect"
sync "sync"
time "time"
versioned "github.com/rancher/helm-controller/pkg/generated/clientset/versioned"
helmcattleio "github.com/rancher/helm-controller/pkg/generated/informers/externalversions/helm.cattle.io"
internalinterfaces "github.com/rancher/helm-controller/pkg/generated/informers/externalversions/internalinterfaces"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
)
// SharedInformerOption defines the functional option type for SharedInformerFactory.
type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory
type sharedInformerFactory struct {
client versioned.Interface
namespace string
tweakListOptions internalinterfaces.TweakListOptionsFunc
lock sync.Mutex
defaultResync time.Duration
customResync map[reflect.Type]time.Duration
informers map[reflect.Type]cache.SharedIndexInformer
// startedInformers is used for tracking which informers have been started.
// This allows Start() to be called multiple times safely.
startedInformers map[reflect.Type]bool
}
// WithCustomResyncConfig sets a custom resync period for the specified informer types.
func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption {
return func(factory *sharedInformerFactory) *sharedInformerFactory {
for k, v := range resyncConfig {
factory.customResync[reflect.TypeOf(k)] = v
}
return factory
}
}
// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory.
func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption {
return func(factory *sharedInformerFactory) *sharedInformerFactory {
factory.tweakListOptions = tweakListOptions
return factory
}
}
// WithNamespace limits the SharedInformerFactory to the specified namespace.
func WithNamespace(namespace string) SharedInformerOption {
return func(factory *sharedInformerFactory) *sharedInformerFactory {
factory.namespace = namespace
return factory
}
}
// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces.
func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory {
return NewSharedInformerFactoryWithOptions(client, defaultResync)
}
// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory.
// Listers obtained via this SharedInformerFactory will be subject to the same filters
// as specified here.
// Deprecated: Please use NewSharedInformerFactoryWithOptions instead
func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory {
return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions))
}
// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options.
func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory {
factory := &sharedInformerFactory{
client: client,
namespace: v1.NamespaceAll,
defaultResync: defaultResync,
informers: make(map[reflect.Type]cache.SharedIndexInformer),
startedInformers: make(map[reflect.Type]bool),
customResync: make(map[reflect.Type]time.Duration),
}
// Apply all options
for _, opt := range options {
factory = opt(factory)
}
return factory
}
// Start initializes all requested informers.
func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
f.lock.Lock()
defer f.lock.Unlock()
for informerType, informer := range f.informers {
if !f.startedInformers[informerType] {
go informer.Run(stopCh)
f.startedInformers[informerType] = true
}
}
}
// WaitForCacheSync waits for all started informers' cache were synced.
func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool {
informers := func() map[reflect.Type]cache.SharedIndexInformer {
f.lock.Lock()
defer f.lock.Unlock()
informers := map[reflect.Type]cache.SharedIndexInformer{}
for informerType, informer := range f.informers {
if f.startedInformers[informerType] {
informers[informerType] = informer
}
}
return informers
}()
res := map[reflect.Type]bool{}
for informType, informer := range informers {
res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced)
}
return res
}
// InternalInformerFor returns the SharedIndexInformer for obj using an internal
// client.
func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer {
f.lock.Lock()
defer f.lock.Unlock()
informerType := reflect.TypeOf(obj)
informer, exists := f.informers[informerType]
if exists {
return informer
}
resyncPeriod, exists := f.customResync[informerType]
if !exists {
resyncPeriod = f.defaultResync
}
informer = newFunc(f.client, resyncPeriod)
f.informers[informerType] = informer
return informer
}
// SharedInformerFactory provides shared informers for resources in all known
// API group versions.
type SharedInformerFactory interface {
internalinterfaces.SharedInformerFactory
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
Helm() helmcattleio.Interface
}
func (f *sharedInformerFactory) Helm() helmcattleio.Interface {
return helmcattleio.New(f, f.namespace, f.tweakListOptions)
}

View File

@ -0,0 +1,62 @@
/*
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 main. DO NOT EDIT.
package externalversions
import (
"fmt"
v1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
)
// GenericInformer is type of SharedIndexInformer which will locate and delegate to other
// sharedInformers based on type
type GenericInformer interface {
Informer() cache.SharedIndexInformer
Lister() cache.GenericLister
}
type genericInformer struct {
informer cache.SharedIndexInformer
resource schema.GroupResource
}
// Informer returns the SharedIndexInformer.
func (f *genericInformer) Informer() cache.SharedIndexInformer {
return f.informer
}
// Lister returns the GenericLister.
func (f *genericInformer) Lister() cache.GenericLister {
return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource)
}
// ForResource gives generic access to a shared informer of the matching type
// TODO extend this to unknown resources with a client pool
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
switch resource {
// Group=helm.cattle.io, Version=v1
case v1.SchemeGroupVersion.WithResource("helmcharts"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Helm().V1().HelmCharts().Informer()}, nil
}
return nil, fmt.Errorf("no informer found for %v", resource)
}

View File

@ -0,0 +1,46 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package helm
import (
v1 "github.com/rancher/helm-controller/pkg/generated/informers/externalversions/helm.cattle.io/v1"
internalinterfaces "github.com/rancher/helm-controller/pkg/generated/informers/externalversions/internalinterfaces"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// V1 provides access to shared informers for resources in V1.
V1() v1.Interface
}
type group struct {
factory internalinterfaces.SharedInformerFactory
namespace string
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// V1 returns a new v1.Interface.
func (g *group) V1() v1.Interface {
return v1.New(g.factory, g.namespace, g.tweakListOptions)
}

View File

@ -0,0 +1,89 @@
/*
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 main. DO NOT EDIT.
package v1
import (
time "time"
helmcattleiov1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
versioned "github.com/rancher/helm-controller/pkg/generated/clientset/versioned"
internalinterfaces "github.com/rancher/helm-controller/pkg/generated/informers/externalversions/internalinterfaces"
v1 "github.com/rancher/helm-controller/pkg/generated/listers/helm.cattle.io/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"
)
// HelmChartInformer provides access to a shared informer and lister for
// HelmCharts.
type HelmChartInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1.HelmChartLister
}
type helmChartInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewHelmChartInformer constructs a new informer for HelmChart 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 NewHelmChartInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredHelmChartInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredHelmChartInformer constructs a new informer for HelmChart 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 NewFilteredHelmChartInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.HelmV1().HelmCharts(namespace).List(options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.HelmV1().HelmCharts(namespace).Watch(options)
},
},
&helmcattleiov1.HelmChart{},
resyncPeriod,
indexers,
)
}
func (f *helmChartInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredHelmChartInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *helmChartInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&helmcattleiov1.HelmChart{}, f.defaultInformer)
}
func (f *helmChartInformer) Lister() v1.HelmChartLister {
return v1.NewHelmChartLister(f.Informer().GetIndexer())
}

View File

@ -0,0 +1,45 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package v1
import (
internalinterfaces "github.com/rancher/helm-controller/pkg/generated/informers/externalversions/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// HelmCharts returns a HelmChartInformer.
HelmCharts() HelmChartInformer
}
type version struct {
factory internalinterfaces.SharedInformerFactory
namespace string
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// HelmCharts returns a HelmChartInformer.
func (v *version) HelmCharts() HelmChartInformer {
return &helmChartInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}

View File

@ -0,0 +1,40 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package internalinterfaces
import (
time "time"
versioned "github.com/rancher/helm-controller/pkg/generated/clientset/versioned"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
cache "k8s.io/client-go/tools/cache"
)
// 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
type SharedInformerFactory interface {
Start(stopCh <-chan struct{})
InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer
}
// TweakListOptionsFunc is a function that transforms a v1.ListOptions.
type TweakListOptionsFunc func(*v1.ListOptions)

Some files were not shown because too many files have changed in this diff Show More