1
0
mirror of https://github.com/rancher/types.git synced 2025-07-30 20:44:34 +00:00

Merge pull request #120 from cjellick/cluster-scoped2

Cluster scoped
This commit is contained in:
Craig Jellick 2018-01-16 09:10:50 -07:00 committed by GitHub
commit fc5ed5c928
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
101 changed files with 1692 additions and 157 deletions

View File

@ -47,6 +47,7 @@ type DeploymentController interface {
Informer() cache.SharedIndexInformer
Lister() DeploymentLister
AddHandler(name string, handler DeploymentHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler DeploymentHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -66,6 +67,8 @@ type DeploymentInterface interface {
Controller() DeploymentController
AddHandler(name string, sync DeploymentHandlerFunc)
AddLifecycle(name string, lifecycle DeploymentLifecycle)
AddClusterScopedHandler(name, clusterName string, sync DeploymentHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle DeploymentLifecycle)
}
type deploymentLister struct {
@ -122,6 +125,24 @@ func (c *deploymentController) AddHandler(name string, handler DeploymentHandler
})
}
func (c *deploymentController) AddClusterScopedHandler(name, cluster string, handler DeploymentHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1beta2.Deployment))
})
}
type deploymentFactory struct {
}
@ -218,6 +239,15 @@ func (s *deploymentClient) AddHandler(name string, sync DeploymentHandlerFunc) {
}
func (s *deploymentClient) AddLifecycle(name string, lifecycle DeploymentLifecycle) {
sync := NewDeploymentLifecycleAdapter(name, s, lifecycle)
sync := NewDeploymentLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *deploymentClient) AddClusterScopedHandler(name, clusterName string, sync DeploymentHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *deploymentClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle DeploymentLifecycle) {
sync := NewDeploymentLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -40,9 +40,9 @@ func (w *deploymentLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object
return o, err
}
func NewDeploymentLifecycleAdapter(name string, client DeploymentInterface, l DeploymentLifecycle) DeploymentHandlerFunc {
func NewDeploymentLifecycleAdapter(name string, clusterScoped bool, client DeploymentInterface, l DeploymentLifecycle) DeploymentHandlerFunc {
adapter := &deploymentLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1beta2.Deployment) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type ComponentStatusController interface {
Informer() cache.SharedIndexInformer
Lister() ComponentStatusLister
AddHandler(name string, handler ComponentStatusHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler ComponentStatusHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type ComponentStatusInterface interface {
Controller() ComponentStatusController
AddHandler(name string, sync ComponentStatusHandlerFunc)
AddLifecycle(name string, lifecycle ComponentStatusLifecycle)
AddClusterScopedHandler(name, clusterName string, sync ComponentStatusHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle ComponentStatusLifecycle)
}
type componentStatusLister struct {
@ -121,6 +124,24 @@ func (c *componentStatusController) AddHandler(name string, handler ComponentSta
})
}
func (c *componentStatusController) AddClusterScopedHandler(name, cluster string, handler ComponentStatusHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1.ComponentStatus))
})
}
type componentStatusFactory struct {
}
@ -217,6 +238,15 @@ func (s *componentStatusClient) AddHandler(name string, sync ComponentStatusHand
}
func (s *componentStatusClient) AddLifecycle(name string, lifecycle ComponentStatusLifecycle) {
sync := NewComponentStatusLifecycleAdapter(name, s, lifecycle)
sync := NewComponentStatusLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *componentStatusClient) AddClusterScopedHandler(name, clusterName string, sync ComponentStatusHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *componentStatusClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ComponentStatusLifecycle) {
sync := NewComponentStatusLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -40,9 +40,9 @@ func (w *componentStatusLifecycleAdapter) Updated(obj runtime.Object) (runtime.O
return o, err
}
func NewComponentStatusLifecycleAdapter(name string, client ComponentStatusInterface, l ComponentStatusLifecycle) ComponentStatusHandlerFunc {
func NewComponentStatusLifecycleAdapter(name string, clusterScoped bool, client ComponentStatusInterface, l ComponentStatusLifecycle) ComponentStatusHandlerFunc {
adapter := &componentStatusLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.ComponentStatus) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -47,6 +47,7 @@ type EndpointsController interface {
Informer() cache.SharedIndexInformer
Lister() EndpointsLister
AddHandler(name string, handler EndpointsHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler EndpointsHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -66,6 +67,8 @@ type EndpointsInterface interface {
Controller() EndpointsController
AddHandler(name string, sync EndpointsHandlerFunc)
AddLifecycle(name string, lifecycle EndpointsLifecycle)
AddClusterScopedHandler(name, clusterName string, sync EndpointsHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle EndpointsLifecycle)
}
type endpointsLister struct {
@ -122,6 +125,24 @@ func (c *endpointsController) AddHandler(name string, handler EndpointsHandlerFu
})
}
func (c *endpointsController) AddClusterScopedHandler(name, cluster string, handler EndpointsHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1.Endpoints))
})
}
type endpointsFactory struct {
}
@ -218,6 +239,15 @@ func (s *endpointsClient) AddHandler(name string, sync EndpointsHandlerFunc) {
}
func (s *endpointsClient) AddLifecycle(name string, lifecycle EndpointsLifecycle) {
sync := NewEndpointsLifecycleAdapter(name, s, lifecycle)
sync := NewEndpointsLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *endpointsClient) AddClusterScopedHandler(name, clusterName string, sync EndpointsHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *endpointsClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle EndpointsLifecycle) {
sync := NewEndpointsLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -40,9 +40,9 @@ func (w *endpointsLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object,
return o, err
}
func NewEndpointsLifecycleAdapter(name string, client EndpointsInterface, l EndpointsLifecycle) EndpointsHandlerFunc {
func NewEndpointsLifecycleAdapter(name string, clusterScoped bool, client EndpointsInterface, l EndpointsLifecycle) EndpointsHandlerFunc {
adapter := &endpointsLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Endpoints) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type EventController interface {
Informer() cache.SharedIndexInformer
Lister() EventLister
AddHandler(name string, handler EventHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler EventHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type EventInterface interface {
Controller() EventController
AddHandler(name string, sync EventHandlerFunc)
AddLifecycle(name string, lifecycle EventLifecycle)
AddClusterScopedHandler(name, clusterName string, sync EventHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle EventLifecycle)
}
type eventLister struct {
@ -121,6 +124,24 @@ func (c *eventController) AddHandler(name string, handler EventHandlerFunc) {
})
}
func (c *eventController) AddClusterScopedHandler(name, cluster string, handler EventHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1.Event))
})
}
type eventFactory struct {
}
@ -217,6 +238,15 @@ func (s *eventClient) AddHandler(name string, sync EventHandlerFunc) {
}
func (s *eventClient) AddLifecycle(name string, lifecycle EventLifecycle) {
sync := NewEventLifecycleAdapter(name, s, lifecycle)
sync := NewEventLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *eventClient) AddClusterScopedHandler(name, clusterName string, sync EventHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *eventClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle EventLifecycle) {
sync := NewEventLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -40,9 +40,9 @@ func (w *eventLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, err
return o, err
}
func NewEventLifecycleAdapter(name string, client EventInterface, l EventLifecycle) EventHandlerFunc {
func NewEventLifecycleAdapter(name string, clusterScoped bool, client EventInterface, l EventLifecycle) EventHandlerFunc {
adapter := &eventLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Event) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type NamespaceController interface {
Informer() cache.SharedIndexInformer
Lister() NamespaceLister
AddHandler(name string, handler NamespaceHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler NamespaceHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type NamespaceInterface interface {
Controller() NamespaceController
AddHandler(name string, sync NamespaceHandlerFunc)
AddLifecycle(name string, lifecycle NamespaceLifecycle)
AddClusterScopedHandler(name, clusterName string, sync NamespaceHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle NamespaceLifecycle)
}
type namespaceLister struct {
@ -121,6 +124,24 @@ func (c *namespaceController) AddHandler(name string, handler NamespaceHandlerFu
})
}
func (c *namespaceController) AddClusterScopedHandler(name, cluster string, handler NamespaceHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1.Namespace))
})
}
type namespaceFactory struct {
}
@ -217,6 +238,15 @@ func (s *namespaceClient) AddHandler(name string, sync NamespaceHandlerFunc) {
}
func (s *namespaceClient) AddLifecycle(name string, lifecycle NamespaceLifecycle) {
sync := NewNamespaceLifecycleAdapter(name, s, lifecycle)
sync := NewNamespaceLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *namespaceClient) AddClusterScopedHandler(name, clusterName string, sync NamespaceHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *namespaceClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle NamespaceLifecycle) {
sync := NewNamespaceLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -40,9 +40,9 @@ func (w *namespaceLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object,
return o, err
}
func NewNamespaceLifecycleAdapter(name string, client NamespaceInterface, l NamespaceLifecycle) NamespaceHandlerFunc {
func NewNamespaceLifecycleAdapter(name string, clusterScoped bool, client NamespaceInterface, l NamespaceLifecycle) NamespaceHandlerFunc {
adapter := &namespaceLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Namespace) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type NodeController interface {
Informer() cache.SharedIndexInformer
Lister() NodeLister
AddHandler(name string, handler NodeHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler NodeHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type NodeInterface interface {
Controller() NodeController
AddHandler(name string, sync NodeHandlerFunc)
AddLifecycle(name string, lifecycle NodeLifecycle)
AddClusterScopedHandler(name, clusterName string, sync NodeHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle NodeLifecycle)
}
type nodeLister struct {
@ -121,6 +124,24 @@ func (c *nodeController) AddHandler(name string, handler NodeHandlerFunc) {
})
}
func (c *nodeController) AddClusterScopedHandler(name, cluster string, handler NodeHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1.Node))
})
}
type nodeFactory struct {
}
@ -217,6 +238,15 @@ func (s *nodeClient) AddHandler(name string, sync NodeHandlerFunc) {
}
func (s *nodeClient) AddLifecycle(name string, lifecycle NodeLifecycle) {
sync := NewNodeLifecycleAdapter(name, s, lifecycle)
sync := NewNodeLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *nodeClient) AddClusterScopedHandler(name, clusterName string, sync NodeHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *nodeClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle NodeLifecycle) {
sync := NewNodeLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -40,9 +40,9 @@ func (w *nodeLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, erro
return o, err
}
func NewNodeLifecycleAdapter(name string, client NodeInterface, l NodeLifecycle) NodeHandlerFunc {
func NewNodeLifecycleAdapter(name string, clusterScoped bool, client NodeInterface, l NodeLifecycle) NodeHandlerFunc {
adapter := &nodeLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Node) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -47,6 +47,7 @@ type PodController interface {
Informer() cache.SharedIndexInformer
Lister() PodLister
AddHandler(name string, handler PodHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler PodHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -66,6 +67,8 @@ type PodInterface interface {
Controller() PodController
AddHandler(name string, sync PodHandlerFunc)
AddLifecycle(name string, lifecycle PodLifecycle)
AddClusterScopedHandler(name, clusterName string, sync PodHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle PodLifecycle)
}
type podLister struct {
@ -122,6 +125,24 @@ func (c *podController) AddHandler(name string, handler PodHandlerFunc) {
})
}
func (c *podController) AddClusterScopedHandler(name, cluster string, handler PodHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1.Pod))
})
}
type podFactory struct {
}
@ -218,6 +239,15 @@ func (s *podClient) AddHandler(name string, sync PodHandlerFunc) {
}
func (s *podClient) AddLifecycle(name string, lifecycle PodLifecycle) {
sync := NewPodLifecycleAdapter(name, s, lifecycle)
sync := NewPodLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *podClient) AddClusterScopedHandler(name, clusterName string, sync PodHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *podClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle PodLifecycle) {
sync := NewPodLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -40,9 +40,9 @@ func (w *podLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error
return o, err
}
func NewPodLifecycleAdapter(name string, client PodInterface, l PodLifecycle) PodHandlerFunc {
func NewPodLifecycleAdapter(name string, clusterScoped bool, client PodInterface, l PodLifecycle) PodHandlerFunc {
adapter := &podLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Pod) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -47,6 +47,7 @@ type SecretController interface {
Informer() cache.SharedIndexInformer
Lister() SecretLister
AddHandler(name string, handler SecretHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler SecretHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -66,6 +67,8 @@ type SecretInterface interface {
Controller() SecretController
AddHandler(name string, sync SecretHandlerFunc)
AddLifecycle(name string, lifecycle SecretLifecycle)
AddClusterScopedHandler(name, clusterName string, sync SecretHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle SecretLifecycle)
}
type secretLister struct {
@ -122,6 +125,24 @@ func (c *secretController) AddHandler(name string, handler SecretHandlerFunc) {
})
}
func (c *secretController) AddClusterScopedHandler(name, cluster string, handler SecretHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1.Secret))
})
}
type secretFactory struct {
}
@ -218,6 +239,15 @@ func (s *secretClient) AddHandler(name string, sync SecretHandlerFunc) {
}
func (s *secretClient) AddLifecycle(name string, lifecycle SecretLifecycle) {
sync := NewSecretLifecycleAdapter(name, s, lifecycle)
sync := NewSecretLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *secretClient) AddClusterScopedHandler(name, clusterName string, sync SecretHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *secretClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle SecretLifecycle) {
sync := NewSecretLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -40,9 +40,9 @@ func (w *secretLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, er
return o, err
}
func NewSecretLifecycleAdapter(name string, client SecretInterface, l SecretLifecycle) SecretHandlerFunc {
func NewSecretLifecycleAdapter(name string, clusterScoped bool, client SecretInterface, l SecretLifecycle) SecretHandlerFunc {
adapter := &secretLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Secret) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -47,6 +47,7 @@ type ServiceController interface {
Informer() cache.SharedIndexInformer
Lister() ServiceLister
AddHandler(name string, handler ServiceHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler ServiceHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -66,6 +67,8 @@ type ServiceInterface interface {
Controller() ServiceController
AddHandler(name string, sync ServiceHandlerFunc)
AddLifecycle(name string, lifecycle ServiceLifecycle)
AddClusterScopedHandler(name, clusterName string, sync ServiceHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle ServiceLifecycle)
}
type serviceLister struct {
@ -122,6 +125,24 @@ func (c *serviceController) AddHandler(name string, handler ServiceHandlerFunc)
})
}
func (c *serviceController) AddClusterScopedHandler(name, cluster string, handler ServiceHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1.Service))
})
}
type serviceFactory struct {
}
@ -218,6 +239,15 @@ func (s *serviceClient) AddHandler(name string, sync ServiceHandlerFunc) {
}
func (s *serviceClient) AddLifecycle(name string, lifecycle ServiceLifecycle) {
sync := NewServiceLifecycleAdapter(name, s, lifecycle)
sync := NewServiceLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *serviceClient) AddClusterScopedHandler(name, clusterName string, sync ServiceHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *serviceClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ServiceLifecycle) {
sync := NewServiceLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -40,9 +40,9 @@ func (w *serviceLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, e
return o, err
}
func NewServiceLifecycleAdapter(name string, client ServiceInterface, l ServiceLifecycle) ServiceHandlerFunc {
func NewServiceLifecycleAdapter(name string, clusterScoped bool, client ServiceInterface, l ServiceLifecycle) ServiceHandlerFunc {
adapter := &serviceLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Service) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type PodSecurityPolicyController interface {
Informer() cache.SharedIndexInformer
Lister() PodSecurityPolicyLister
AddHandler(name string, handler PodSecurityPolicyHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler PodSecurityPolicyHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type PodSecurityPolicyInterface interface {
Controller() PodSecurityPolicyController
AddHandler(name string, sync PodSecurityPolicyHandlerFunc)
AddLifecycle(name string, lifecycle PodSecurityPolicyLifecycle)
AddClusterScopedHandler(name, clusterName string, sync PodSecurityPolicyHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle PodSecurityPolicyLifecycle)
}
type podSecurityPolicyLister struct {
@ -121,6 +124,24 @@ func (c *podSecurityPolicyController) AddHandler(name string, handler PodSecurit
})
}
func (c *podSecurityPolicyController) AddClusterScopedHandler(name, cluster string, handler PodSecurityPolicyHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1beta1.PodSecurityPolicy))
})
}
type podSecurityPolicyFactory struct {
}
@ -217,6 +238,15 @@ func (s *podSecurityPolicyClient) AddHandler(name string, sync PodSecurityPolicy
}
func (s *podSecurityPolicyClient) AddLifecycle(name string, lifecycle PodSecurityPolicyLifecycle) {
sync := NewPodSecurityPolicyLifecycleAdapter(name, s, lifecycle)
sync := NewPodSecurityPolicyLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *podSecurityPolicyClient) AddClusterScopedHandler(name, clusterName string, sync PodSecurityPolicyHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *podSecurityPolicyClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle PodSecurityPolicyLifecycle) {
sync := NewPodSecurityPolicyLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -40,9 +40,9 @@ func (w *podSecurityPolicyLifecycleAdapter) Updated(obj runtime.Object) (runtime
return o, err
}
func NewPodSecurityPolicyLifecycleAdapter(name string, client PodSecurityPolicyInterface, l PodSecurityPolicyLifecycle) PodSecurityPolicyHandlerFunc {
func NewPodSecurityPolicyLifecycleAdapter(name string, clusterScoped bool, client PodSecurityPolicyInterface, l PodSecurityPolicyLifecycle) PodSecurityPolicyHandlerFunc {
adapter := &podSecurityPolicyLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1beta1.PodSecurityPolicy) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type CatalogController interface {
Informer() cache.SharedIndexInformer
Lister() CatalogLister
AddHandler(name string, handler CatalogHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler CatalogHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type CatalogInterface interface {
Controller() CatalogController
AddHandler(name string, sync CatalogHandlerFunc)
AddLifecycle(name string, lifecycle CatalogLifecycle)
AddClusterScopedHandler(name, clusterName string, sync CatalogHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle CatalogLifecycle)
}
type catalogLister struct {
@ -120,6 +123,24 @@ func (c *catalogController) AddHandler(name string, handler CatalogHandlerFunc)
})
}
func (c *catalogController) AddClusterScopedHandler(name, cluster string, handler CatalogHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*Catalog))
})
}
type catalogFactory struct {
}
@ -216,6 +237,15 @@ func (s *catalogClient) AddHandler(name string, sync CatalogHandlerFunc) {
}
func (s *catalogClient) AddLifecycle(name string, lifecycle CatalogLifecycle) {
sync := NewCatalogLifecycleAdapter(name, s, lifecycle)
sync := NewCatalogLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *catalogClient) AddClusterScopedHandler(name, clusterName string, sync CatalogHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *catalogClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle CatalogLifecycle) {
sync := NewCatalogLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *catalogLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, e
return o, err
}
func NewCatalogLifecycleAdapter(name string, client CatalogInterface, l CatalogLifecycle) CatalogHandlerFunc {
func NewCatalogLifecycleAdapter(name string, clusterScoped bool, client CatalogInterface, l CatalogLifecycle) CatalogHandlerFunc {
adapter := &catalogLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *Catalog) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type ClusterController interface {
Informer() cache.SharedIndexInformer
Lister() ClusterLister
AddHandler(name string, handler ClusterHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler ClusterHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type ClusterInterface interface {
Controller() ClusterController
AddHandler(name string, sync ClusterHandlerFunc)
AddLifecycle(name string, lifecycle ClusterLifecycle)
AddClusterScopedHandler(name, clusterName string, sync ClusterHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterLifecycle)
}
type clusterLister struct {
@ -120,6 +123,24 @@ func (c *clusterController) AddHandler(name string, handler ClusterHandlerFunc)
})
}
func (c *clusterController) AddClusterScopedHandler(name, cluster string, handler ClusterHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*Cluster))
})
}
type clusterFactory struct {
}
@ -216,6 +237,15 @@ func (s *clusterClient) AddHandler(name string, sync ClusterHandlerFunc) {
}
func (s *clusterClient) AddLifecycle(name string, lifecycle ClusterLifecycle) {
sync := NewClusterLifecycleAdapter(name, s, lifecycle)
sync := NewClusterLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *clusterClient) AddClusterScopedHandler(name, clusterName string, sync ClusterHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *clusterClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterLifecycle) {
sync := NewClusterLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -46,6 +46,7 @@ type ClusterEventController interface {
Informer() cache.SharedIndexInformer
Lister() ClusterEventLister
AddHandler(name string, handler ClusterEventHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler ClusterEventHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type ClusterEventInterface interface {
Controller() ClusterEventController
AddHandler(name string, sync ClusterEventHandlerFunc)
AddLifecycle(name string, lifecycle ClusterEventLifecycle)
AddClusterScopedHandler(name, clusterName string, sync ClusterEventHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterEventLifecycle)
}
type clusterEventLister struct {
@ -121,6 +124,24 @@ func (c *clusterEventController) AddHandler(name string, handler ClusterEventHan
})
}
func (c *clusterEventController) AddClusterScopedHandler(name, cluster string, handler ClusterEventHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*ClusterEvent))
})
}
type clusterEventFactory struct {
}
@ -217,6 +238,15 @@ func (s *clusterEventClient) AddHandler(name string, sync ClusterEventHandlerFun
}
func (s *clusterEventClient) AddLifecycle(name string, lifecycle ClusterEventLifecycle) {
sync := NewClusterEventLifecycleAdapter(name, s, lifecycle)
sync := NewClusterEventLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *clusterEventClient) AddClusterScopedHandler(name, clusterName string, sync ClusterEventHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *clusterEventClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterEventLifecycle) {
sync := NewClusterEventLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *clusterEventLifecycleAdapter) Updated(obj runtime.Object) (runtime.Obje
return o, err
}
func NewClusterEventLifecycleAdapter(name string, client ClusterEventInterface, l ClusterEventLifecycle) ClusterEventHandlerFunc {
func NewClusterEventLifecycleAdapter(name string, clusterScoped bool, client ClusterEventInterface, l ClusterEventLifecycle) ClusterEventHandlerFunc {
adapter := &clusterEventLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *ClusterEvent) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -39,9 +39,9 @@ func (w *clusterLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, e
return o, err
}
func NewClusterLifecycleAdapter(name string, client ClusterInterface, l ClusterLifecycle) ClusterHandlerFunc {
func NewClusterLifecycleAdapter(name string, clusterScoped bool, client ClusterInterface, l ClusterLifecycle) ClusterHandlerFunc {
adapter := &clusterLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *Cluster) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type ClusterRegistrationTokenController interface {
Informer() cache.SharedIndexInformer
Lister() ClusterRegistrationTokenLister
AddHandler(name string, handler ClusterRegistrationTokenHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler ClusterRegistrationTokenHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type ClusterRegistrationTokenInterface interface {
Controller() ClusterRegistrationTokenController
AddHandler(name string, sync ClusterRegistrationTokenHandlerFunc)
AddLifecycle(name string, lifecycle ClusterRegistrationTokenLifecycle)
AddClusterScopedHandler(name, clusterName string, sync ClusterRegistrationTokenHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterRegistrationTokenLifecycle)
}
type clusterRegistrationTokenLister struct {
@ -121,6 +124,24 @@ func (c *clusterRegistrationTokenController) AddHandler(name string, handler Clu
})
}
func (c *clusterRegistrationTokenController) AddClusterScopedHandler(name, cluster string, handler ClusterRegistrationTokenHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*ClusterRegistrationToken))
})
}
type clusterRegistrationTokenFactory struct {
}
@ -217,6 +238,15 @@ func (s *clusterRegistrationTokenClient) AddHandler(name string, sync ClusterReg
}
func (s *clusterRegistrationTokenClient) AddLifecycle(name string, lifecycle ClusterRegistrationTokenLifecycle) {
sync := NewClusterRegistrationTokenLifecycleAdapter(name, s, lifecycle)
sync := NewClusterRegistrationTokenLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *clusterRegistrationTokenClient) AddClusterScopedHandler(name, clusterName string, sync ClusterRegistrationTokenHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *clusterRegistrationTokenClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterRegistrationTokenLifecycle) {
sync := NewClusterRegistrationTokenLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *clusterRegistrationTokenLifecycleAdapter) Updated(obj runtime.Object) (
return o, err
}
func NewClusterRegistrationTokenLifecycleAdapter(name string, client ClusterRegistrationTokenInterface, l ClusterRegistrationTokenLifecycle) ClusterRegistrationTokenHandlerFunc {
func NewClusterRegistrationTokenLifecycleAdapter(name string, clusterScoped bool, client ClusterRegistrationTokenInterface, l ClusterRegistrationTokenLifecycle) ClusterRegistrationTokenHandlerFunc {
adapter := &clusterRegistrationTokenLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *ClusterRegistrationToken) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type ClusterRoleTemplateBindingController interface {
Informer() cache.SharedIndexInformer
Lister() ClusterRoleTemplateBindingLister
AddHandler(name string, handler ClusterRoleTemplateBindingHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler ClusterRoleTemplateBindingHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type ClusterRoleTemplateBindingInterface interface {
Controller() ClusterRoleTemplateBindingController
AddHandler(name string, sync ClusterRoleTemplateBindingHandlerFunc)
AddLifecycle(name string, lifecycle ClusterRoleTemplateBindingLifecycle)
AddClusterScopedHandler(name, clusterName string, sync ClusterRoleTemplateBindingHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterRoleTemplateBindingLifecycle)
}
type clusterRoleTemplateBindingLister struct {
@ -121,6 +124,24 @@ func (c *clusterRoleTemplateBindingController) AddHandler(name string, handler C
})
}
func (c *clusterRoleTemplateBindingController) AddClusterScopedHandler(name, cluster string, handler ClusterRoleTemplateBindingHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*ClusterRoleTemplateBinding))
})
}
type clusterRoleTemplateBindingFactory struct {
}
@ -217,6 +238,15 @@ func (s *clusterRoleTemplateBindingClient) AddHandler(name string, sync ClusterR
}
func (s *clusterRoleTemplateBindingClient) AddLifecycle(name string, lifecycle ClusterRoleTemplateBindingLifecycle) {
sync := NewClusterRoleTemplateBindingLifecycleAdapter(name, s, lifecycle)
sync := NewClusterRoleTemplateBindingLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *clusterRoleTemplateBindingClient) AddClusterScopedHandler(name, clusterName string, sync ClusterRoleTemplateBindingHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *clusterRoleTemplateBindingClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterRoleTemplateBindingLifecycle) {
sync := NewClusterRoleTemplateBindingLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *clusterRoleTemplateBindingLifecycleAdapter) Updated(obj runtime.Object)
return o, err
}
func NewClusterRoleTemplateBindingLifecycleAdapter(name string, client ClusterRoleTemplateBindingInterface, l ClusterRoleTemplateBindingLifecycle) ClusterRoleTemplateBindingHandlerFunc {
func NewClusterRoleTemplateBindingLifecycleAdapter(name string, clusterScoped bool, client ClusterRoleTemplateBindingInterface, l ClusterRoleTemplateBindingLifecycle) ClusterRoleTemplateBindingHandlerFunc {
adapter := &clusterRoleTemplateBindingLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *ClusterRoleTemplateBinding) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type DynamicSchemaController interface {
Informer() cache.SharedIndexInformer
Lister() DynamicSchemaLister
AddHandler(name string, handler DynamicSchemaHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler DynamicSchemaHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type DynamicSchemaInterface interface {
Controller() DynamicSchemaController
AddHandler(name string, sync DynamicSchemaHandlerFunc)
AddLifecycle(name string, lifecycle DynamicSchemaLifecycle)
AddClusterScopedHandler(name, clusterName string, sync DynamicSchemaHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle DynamicSchemaLifecycle)
}
type dynamicSchemaLister struct {
@ -120,6 +123,24 @@ func (c *dynamicSchemaController) AddHandler(name string, handler DynamicSchemaH
})
}
func (c *dynamicSchemaController) AddClusterScopedHandler(name, cluster string, handler DynamicSchemaHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*DynamicSchema))
})
}
type dynamicSchemaFactory struct {
}
@ -216,6 +237,15 @@ func (s *dynamicSchemaClient) AddHandler(name string, sync DynamicSchemaHandlerF
}
func (s *dynamicSchemaClient) AddLifecycle(name string, lifecycle DynamicSchemaLifecycle) {
sync := NewDynamicSchemaLifecycleAdapter(name, s, lifecycle)
sync := NewDynamicSchemaLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *dynamicSchemaClient) AddClusterScopedHandler(name, clusterName string, sync DynamicSchemaHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *dynamicSchemaClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle DynamicSchemaLifecycle) {
sync := NewDynamicSchemaLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *dynamicSchemaLifecycleAdapter) Updated(obj runtime.Object) (runtime.Obj
return o, err
}
func NewDynamicSchemaLifecycleAdapter(name string, client DynamicSchemaInterface, l DynamicSchemaLifecycle) DynamicSchemaHandlerFunc {
func NewDynamicSchemaLifecycleAdapter(name string, clusterScoped bool, client DynamicSchemaInterface, l DynamicSchemaLifecycle) DynamicSchemaHandlerFunc {
adapter := &dynamicSchemaLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *DynamicSchema) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type GlobalRoleBindingController interface {
Informer() cache.SharedIndexInformer
Lister() GlobalRoleBindingLister
AddHandler(name string, handler GlobalRoleBindingHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler GlobalRoleBindingHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type GlobalRoleBindingInterface interface {
Controller() GlobalRoleBindingController
AddHandler(name string, sync GlobalRoleBindingHandlerFunc)
AddLifecycle(name string, lifecycle GlobalRoleBindingLifecycle)
AddClusterScopedHandler(name, clusterName string, sync GlobalRoleBindingHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle GlobalRoleBindingLifecycle)
}
type globalRoleBindingLister struct {
@ -120,6 +123,24 @@ func (c *globalRoleBindingController) AddHandler(name string, handler GlobalRole
})
}
func (c *globalRoleBindingController) AddClusterScopedHandler(name, cluster string, handler GlobalRoleBindingHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*GlobalRoleBinding))
})
}
type globalRoleBindingFactory struct {
}
@ -216,6 +237,15 @@ func (s *globalRoleBindingClient) AddHandler(name string, sync GlobalRoleBinding
}
func (s *globalRoleBindingClient) AddLifecycle(name string, lifecycle GlobalRoleBindingLifecycle) {
sync := NewGlobalRoleBindingLifecycleAdapter(name, s, lifecycle)
sync := NewGlobalRoleBindingLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *globalRoleBindingClient) AddClusterScopedHandler(name, clusterName string, sync GlobalRoleBindingHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *globalRoleBindingClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle GlobalRoleBindingLifecycle) {
sync := NewGlobalRoleBindingLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *globalRoleBindingLifecycleAdapter) Updated(obj runtime.Object) (runtime
return o, err
}
func NewGlobalRoleBindingLifecycleAdapter(name string, client GlobalRoleBindingInterface, l GlobalRoleBindingLifecycle) GlobalRoleBindingHandlerFunc {
func NewGlobalRoleBindingLifecycleAdapter(name string, clusterScoped bool, client GlobalRoleBindingInterface, l GlobalRoleBindingLifecycle) GlobalRoleBindingHandlerFunc {
adapter := &globalRoleBindingLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *GlobalRoleBinding) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type GlobalRoleController interface {
Informer() cache.SharedIndexInformer
Lister() GlobalRoleLister
AddHandler(name string, handler GlobalRoleHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler GlobalRoleHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type GlobalRoleInterface interface {
Controller() GlobalRoleController
AddHandler(name string, sync GlobalRoleHandlerFunc)
AddLifecycle(name string, lifecycle GlobalRoleLifecycle)
AddClusterScopedHandler(name, clusterName string, sync GlobalRoleHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle GlobalRoleLifecycle)
}
type globalRoleLister struct {
@ -120,6 +123,24 @@ func (c *globalRoleController) AddHandler(name string, handler GlobalRoleHandler
})
}
func (c *globalRoleController) AddClusterScopedHandler(name, cluster string, handler GlobalRoleHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*GlobalRole))
})
}
type globalRoleFactory struct {
}
@ -216,6 +237,15 @@ func (s *globalRoleClient) AddHandler(name string, sync GlobalRoleHandlerFunc) {
}
func (s *globalRoleClient) AddLifecycle(name string, lifecycle GlobalRoleLifecycle) {
sync := NewGlobalRoleLifecycleAdapter(name, s, lifecycle)
sync := NewGlobalRoleLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *globalRoleClient) AddClusterScopedHandler(name, clusterName string, sync GlobalRoleHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *globalRoleClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle GlobalRoleLifecycle) {
sync := NewGlobalRoleLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *globalRoleLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object
return o, err
}
func NewGlobalRoleLifecycleAdapter(name string, client GlobalRoleInterface, l GlobalRoleLifecycle) GlobalRoleHandlerFunc {
func NewGlobalRoleLifecycleAdapter(name string, clusterScoped bool, client GlobalRoleInterface, l GlobalRoleLifecycle) GlobalRoleHandlerFunc {
adapter := &globalRoleLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *GlobalRole) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type GroupController interface {
Informer() cache.SharedIndexInformer
Lister() GroupLister
AddHandler(name string, handler GroupHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler GroupHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type GroupInterface interface {
Controller() GroupController
AddHandler(name string, sync GroupHandlerFunc)
AddLifecycle(name string, lifecycle GroupLifecycle)
AddClusterScopedHandler(name, clusterName string, sync GroupHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle GroupLifecycle)
}
type groupLister struct {
@ -120,6 +123,24 @@ func (c *groupController) AddHandler(name string, handler GroupHandlerFunc) {
})
}
func (c *groupController) AddClusterScopedHandler(name, cluster string, handler GroupHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*Group))
})
}
type groupFactory struct {
}
@ -216,6 +237,15 @@ func (s *groupClient) AddHandler(name string, sync GroupHandlerFunc) {
}
func (s *groupClient) AddLifecycle(name string, lifecycle GroupLifecycle) {
sync := NewGroupLifecycleAdapter(name, s, lifecycle)
sync := NewGroupLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *groupClient) AddClusterScopedHandler(name, clusterName string, sync GroupHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *groupClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle GroupLifecycle) {
sync := NewGroupLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *groupLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, err
return o, err
}
func NewGroupLifecycleAdapter(name string, client GroupInterface, l GroupLifecycle) GroupHandlerFunc {
func NewGroupLifecycleAdapter(name string, clusterScoped bool, client GroupInterface, l GroupLifecycle) GroupHandlerFunc {
adapter := &groupLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *Group) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type GroupMemberController interface {
Informer() cache.SharedIndexInformer
Lister() GroupMemberLister
AddHandler(name string, handler GroupMemberHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler GroupMemberHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type GroupMemberInterface interface {
Controller() GroupMemberController
AddHandler(name string, sync GroupMemberHandlerFunc)
AddLifecycle(name string, lifecycle GroupMemberLifecycle)
AddClusterScopedHandler(name, clusterName string, sync GroupMemberHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle GroupMemberLifecycle)
}
type groupMemberLister struct {
@ -120,6 +123,24 @@ func (c *groupMemberController) AddHandler(name string, handler GroupMemberHandl
})
}
func (c *groupMemberController) AddClusterScopedHandler(name, cluster string, handler GroupMemberHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*GroupMember))
})
}
type groupMemberFactory struct {
}
@ -216,6 +237,15 @@ func (s *groupMemberClient) AddHandler(name string, sync GroupMemberHandlerFunc)
}
func (s *groupMemberClient) AddLifecycle(name string, lifecycle GroupMemberLifecycle) {
sync := NewGroupMemberLifecycleAdapter(name, s, lifecycle)
sync := NewGroupMemberLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *groupMemberClient) AddClusterScopedHandler(name, clusterName string, sync GroupMemberHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *groupMemberClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle GroupMemberLifecycle) {
sync := NewGroupMemberLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *groupMemberLifecycleAdapter) Updated(obj runtime.Object) (runtime.Objec
return o, err
}
func NewGroupMemberLifecycleAdapter(name string, client GroupMemberInterface, l GroupMemberLifecycle) GroupMemberHandlerFunc {
func NewGroupMemberLifecycleAdapter(name string, clusterScoped bool, client GroupMemberInterface, l GroupMemberLifecycle) GroupMemberHandlerFunc {
adapter := &groupMemberLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *GroupMember) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type MachineController interface {
Informer() cache.SharedIndexInformer
Lister() MachineLister
AddHandler(name string, handler MachineHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler MachineHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type MachineInterface interface {
Controller() MachineController
AddHandler(name string, sync MachineHandlerFunc)
AddLifecycle(name string, lifecycle MachineLifecycle)
AddClusterScopedHandler(name, clusterName string, sync MachineHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle MachineLifecycle)
}
type machineLister struct {
@ -121,6 +124,24 @@ func (c *machineController) AddHandler(name string, handler MachineHandlerFunc)
})
}
func (c *machineController) AddClusterScopedHandler(name, cluster string, handler MachineHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*Machine))
})
}
type machineFactory struct {
}
@ -217,6 +238,15 @@ func (s *machineClient) AddHandler(name string, sync MachineHandlerFunc) {
}
func (s *machineClient) AddLifecycle(name string, lifecycle MachineLifecycle) {
sync := NewMachineLifecycleAdapter(name, s, lifecycle)
sync := NewMachineLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *machineClient) AddClusterScopedHandler(name, clusterName string, sync MachineHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *machineClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle MachineLifecycle) {
sync := NewMachineLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -45,6 +45,7 @@ type MachineDriverController interface {
Informer() cache.SharedIndexInformer
Lister() MachineDriverLister
AddHandler(name string, handler MachineDriverHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler MachineDriverHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type MachineDriverInterface interface {
Controller() MachineDriverController
AddHandler(name string, sync MachineDriverHandlerFunc)
AddLifecycle(name string, lifecycle MachineDriverLifecycle)
AddClusterScopedHandler(name, clusterName string, sync MachineDriverHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle MachineDriverLifecycle)
}
type machineDriverLister struct {
@ -120,6 +123,24 @@ func (c *machineDriverController) AddHandler(name string, handler MachineDriverH
})
}
func (c *machineDriverController) AddClusterScopedHandler(name, cluster string, handler MachineDriverHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*MachineDriver))
})
}
type machineDriverFactory struct {
}
@ -216,6 +237,15 @@ func (s *machineDriverClient) AddHandler(name string, sync MachineDriverHandlerF
}
func (s *machineDriverClient) AddLifecycle(name string, lifecycle MachineDriverLifecycle) {
sync := NewMachineDriverLifecycleAdapter(name, s, lifecycle)
sync := NewMachineDriverLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *machineDriverClient) AddClusterScopedHandler(name, clusterName string, sync MachineDriverHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *machineDriverClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle MachineDriverLifecycle) {
sync := NewMachineDriverLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *machineDriverLifecycleAdapter) Updated(obj runtime.Object) (runtime.Obj
return o, err
}
func NewMachineDriverLifecycleAdapter(name string, client MachineDriverInterface, l MachineDriverLifecycle) MachineDriverHandlerFunc {
func NewMachineDriverLifecycleAdapter(name string, clusterScoped bool, client MachineDriverInterface, l MachineDriverLifecycle) MachineDriverHandlerFunc {
adapter := &machineDriverLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *MachineDriver) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -39,9 +39,9 @@ func (w *machineLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, e
return o, err
}
func NewMachineLifecycleAdapter(name string, client MachineInterface, l MachineLifecycle) MachineHandlerFunc {
func NewMachineLifecycleAdapter(name string, clusterScoped bool, client MachineInterface, l MachineLifecycle) MachineHandlerFunc {
adapter := &machineLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *Machine) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type MachineTemplateController interface {
Informer() cache.SharedIndexInformer
Lister() MachineTemplateLister
AddHandler(name string, handler MachineTemplateHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler MachineTemplateHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type MachineTemplateInterface interface {
Controller() MachineTemplateController
AddHandler(name string, sync MachineTemplateHandlerFunc)
AddLifecycle(name string, lifecycle MachineTemplateLifecycle)
AddClusterScopedHandler(name, clusterName string, sync MachineTemplateHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle MachineTemplateLifecycle)
}
type machineTemplateLister struct {
@ -120,6 +123,24 @@ func (c *machineTemplateController) AddHandler(name string, handler MachineTempl
})
}
func (c *machineTemplateController) AddClusterScopedHandler(name, cluster string, handler MachineTemplateHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*MachineTemplate))
})
}
type machineTemplateFactory struct {
}
@ -216,6 +237,15 @@ func (s *machineTemplateClient) AddHandler(name string, sync MachineTemplateHand
}
func (s *machineTemplateClient) AddLifecycle(name string, lifecycle MachineTemplateLifecycle) {
sync := NewMachineTemplateLifecycleAdapter(name, s, lifecycle)
sync := NewMachineTemplateLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *machineTemplateClient) AddClusterScopedHandler(name, clusterName string, sync MachineTemplateHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *machineTemplateClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle MachineTemplateLifecycle) {
sync := NewMachineTemplateLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *machineTemplateLifecycleAdapter) Updated(obj runtime.Object) (runtime.O
return o, err
}
func NewMachineTemplateLifecycleAdapter(name string, client MachineTemplateInterface, l MachineTemplateLifecycle) MachineTemplateHandlerFunc {
func NewMachineTemplateLifecycleAdapter(name string, clusterScoped bool, client MachineTemplateInterface, l MachineTemplateLifecycle) MachineTemplateHandlerFunc {
adapter := &machineTemplateLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *MachineTemplate) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type PodSecurityPolicyTemplateController interface {
Informer() cache.SharedIndexInformer
Lister() PodSecurityPolicyTemplateLister
AddHandler(name string, handler PodSecurityPolicyTemplateHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler PodSecurityPolicyTemplateHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type PodSecurityPolicyTemplateInterface interface {
Controller() PodSecurityPolicyTemplateController
AddHandler(name string, sync PodSecurityPolicyTemplateHandlerFunc)
AddLifecycle(name string, lifecycle PodSecurityPolicyTemplateLifecycle)
AddClusterScopedHandler(name, clusterName string, sync PodSecurityPolicyTemplateHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle PodSecurityPolicyTemplateLifecycle)
}
type podSecurityPolicyTemplateLister struct {
@ -120,6 +123,24 @@ func (c *podSecurityPolicyTemplateController) AddHandler(name string, handler Po
})
}
func (c *podSecurityPolicyTemplateController) AddClusterScopedHandler(name, cluster string, handler PodSecurityPolicyTemplateHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*PodSecurityPolicyTemplate))
})
}
type podSecurityPolicyTemplateFactory struct {
}
@ -216,6 +237,15 @@ func (s *podSecurityPolicyTemplateClient) AddHandler(name string, sync PodSecuri
}
func (s *podSecurityPolicyTemplateClient) AddLifecycle(name string, lifecycle PodSecurityPolicyTemplateLifecycle) {
sync := NewPodSecurityPolicyTemplateLifecycleAdapter(name, s, lifecycle)
sync := NewPodSecurityPolicyTemplateLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *podSecurityPolicyTemplateClient) AddClusterScopedHandler(name, clusterName string, sync PodSecurityPolicyTemplateHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *podSecurityPolicyTemplateClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle PodSecurityPolicyTemplateLifecycle) {
sync := NewPodSecurityPolicyTemplateLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *podSecurityPolicyTemplateLifecycleAdapter) Updated(obj runtime.Object)
return o, err
}
func NewPodSecurityPolicyTemplateLifecycleAdapter(name string, client PodSecurityPolicyTemplateInterface, l PodSecurityPolicyTemplateLifecycle) PodSecurityPolicyTemplateHandlerFunc {
func NewPodSecurityPolicyTemplateLifecycleAdapter(name string, clusterScoped bool, client PodSecurityPolicyTemplateInterface, l PodSecurityPolicyTemplateLifecycle) PodSecurityPolicyTemplateHandlerFunc {
adapter := &podSecurityPolicyTemplateLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *PodSecurityPolicyTemplate) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type PrincipalController interface {
Informer() cache.SharedIndexInformer
Lister() PrincipalLister
AddHandler(name string, handler PrincipalHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler PrincipalHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type PrincipalInterface interface {
Controller() PrincipalController
AddHandler(name string, sync PrincipalHandlerFunc)
AddLifecycle(name string, lifecycle PrincipalLifecycle)
AddClusterScopedHandler(name, clusterName string, sync PrincipalHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle PrincipalLifecycle)
}
type principalLister struct {
@ -120,6 +123,24 @@ func (c *principalController) AddHandler(name string, handler PrincipalHandlerFu
})
}
func (c *principalController) AddClusterScopedHandler(name, cluster string, handler PrincipalHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*Principal))
})
}
type principalFactory struct {
}
@ -216,6 +237,15 @@ func (s *principalClient) AddHandler(name string, sync PrincipalHandlerFunc) {
}
func (s *principalClient) AddLifecycle(name string, lifecycle PrincipalLifecycle) {
sync := NewPrincipalLifecycleAdapter(name, s, lifecycle)
sync := NewPrincipalLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *principalClient) AddClusterScopedHandler(name, clusterName string, sync PrincipalHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *principalClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle PrincipalLifecycle) {
sync := NewPrincipalLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *principalLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object,
return o, err
}
func NewPrincipalLifecycleAdapter(name string, client PrincipalInterface, l PrincipalLifecycle) PrincipalHandlerFunc {
func NewPrincipalLifecycleAdapter(name string, clusterScoped bool, client PrincipalInterface, l PrincipalLifecycle) PrincipalHandlerFunc {
adapter := &principalLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *Principal) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type ProjectController interface {
Informer() cache.SharedIndexInformer
Lister() ProjectLister
AddHandler(name string, handler ProjectHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler ProjectHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type ProjectInterface interface {
Controller() ProjectController
AddHandler(name string, sync ProjectHandlerFunc)
AddLifecycle(name string, lifecycle ProjectLifecycle)
AddClusterScopedHandler(name, clusterName string, sync ProjectHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle ProjectLifecycle)
}
type projectLister struct {
@ -121,6 +124,24 @@ func (c *projectController) AddHandler(name string, handler ProjectHandlerFunc)
})
}
func (c *projectController) AddClusterScopedHandler(name, cluster string, handler ProjectHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*Project))
})
}
type projectFactory struct {
}
@ -217,6 +238,15 @@ func (s *projectClient) AddHandler(name string, sync ProjectHandlerFunc) {
}
func (s *projectClient) AddLifecycle(name string, lifecycle ProjectLifecycle) {
sync := NewProjectLifecycleAdapter(name, s, lifecycle)
sync := NewProjectLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *projectClient) AddClusterScopedHandler(name, clusterName string, sync ProjectHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *projectClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ProjectLifecycle) {
sync := NewProjectLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *projectLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, e
return o, err
}
func NewProjectLifecycleAdapter(name string, client ProjectInterface, l ProjectLifecycle) ProjectHandlerFunc {
func NewProjectLifecycleAdapter(name string, clusterScoped bool, client ProjectInterface, l ProjectLifecycle) ProjectHandlerFunc {
adapter := &projectLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *Project) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type ProjectRoleTemplateBindingController interface {
Informer() cache.SharedIndexInformer
Lister() ProjectRoleTemplateBindingLister
AddHandler(name string, handler ProjectRoleTemplateBindingHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler ProjectRoleTemplateBindingHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type ProjectRoleTemplateBindingInterface interface {
Controller() ProjectRoleTemplateBindingController
AddHandler(name string, sync ProjectRoleTemplateBindingHandlerFunc)
AddLifecycle(name string, lifecycle ProjectRoleTemplateBindingLifecycle)
AddClusterScopedHandler(name, clusterName string, sync ProjectRoleTemplateBindingHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle ProjectRoleTemplateBindingLifecycle)
}
type projectRoleTemplateBindingLister struct {
@ -121,6 +124,24 @@ func (c *projectRoleTemplateBindingController) AddHandler(name string, handler P
})
}
func (c *projectRoleTemplateBindingController) AddClusterScopedHandler(name, cluster string, handler ProjectRoleTemplateBindingHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*ProjectRoleTemplateBinding))
})
}
type projectRoleTemplateBindingFactory struct {
}
@ -217,6 +238,15 @@ func (s *projectRoleTemplateBindingClient) AddHandler(name string, sync ProjectR
}
func (s *projectRoleTemplateBindingClient) AddLifecycle(name string, lifecycle ProjectRoleTemplateBindingLifecycle) {
sync := NewProjectRoleTemplateBindingLifecycleAdapter(name, s, lifecycle)
sync := NewProjectRoleTemplateBindingLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *projectRoleTemplateBindingClient) AddClusterScopedHandler(name, clusterName string, sync ProjectRoleTemplateBindingHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *projectRoleTemplateBindingClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ProjectRoleTemplateBindingLifecycle) {
sync := NewProjectRoleTemplateBindingLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *projectRoleTemplateBindingLifecycleAdapter) Updated(obj runtime.Object)
return o, err
}
func NewProjectRoleTemplateBindingLifecycleAdapter(name string, client ProjectRoleTemplateBindingInterface, l ProjectRoleTemplateBindingLifecycle) ProjectRoleTemplateBindingHandlerFunc {
func NewProjectRoleTemplateBindingLifecycleAdapter(name string, clusterScoped bool, client ProjectRoleTemplateBindingInterface, l ProjectRoleTemplateBindingLifecycle) ProjectRoleTemplateBindingHandlerFunc {
adapter := &projectRoleTemplateBindingLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *ProjectRoleTemplateBinding) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type RoleTemplateController interface {
Informer() cache.SharedIndexInformer
Lister() RoleTemplateLister
AddHandler(name string, handler RoleTemplateHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler RoleTemplateHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type RoleTemplateInterface interface {
Controller() RoleTemplateController
AddHandler(name string, sync RoleTemplateHandlerFunc)
AddLifecycle(name string, lifecycle RoleTemplateLifecycle)
AddClusterScopedHandler(name, clusterName string, sync RoleTemplateHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle RoleTemplateLifecycle)
}
type roleTemplateLister struct {
@ -120,6 +123,24 @@ func (c *roleTemplateController) AddHandler(name string, handler RoleTemplateHan
})
}
func (c *roleTemplateController) AddClusterScopedHandler(name, cluster string, handler RoleTemplateHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*RoleTemplate))
})
}
type roleTemplateFactory struct {
}
@ -216,6 +237,15 @@ func (s *roleTemplateClient) AddHandler(name string, sync RoleTemplateHandlerFun
}
func (s *roleTemplateClient) AddLifecycle(name string, lifecycle RoleTemplateLifecycle) {
sync := NewRoleTemplateLifecycleAdapter(name, s, lifecycle)
sync := NewRoleTemplateLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *roleTemplateClient) AddClusterScopedHandler(name, clusterName string, sync RoleTemplateHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *roleTemplateClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle RoleTemplateLifecycle) {
sync := NewRoleTemplateLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *roleTemplateLifecycleAdapter) Updated(obj runtime.Object) (runtime.Obje
return o, err
}
func NewRoleTemplateLifecycleAdapter(name string, client RoleTemplateInterface, l RoleTemplateLifecycle) RoleTemplateHandlerFunc {
func NewRoleTemplateLifecycleAdapter(name string, clusterScoped bool, client RoleTemplateInterface, l RoleTemplateLifecycle) RoleTemplateHandlerFunc {
adapter := &roleTemplateLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *RoleTemplate) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type StackController interface {
Informer() cache.SharedIndexInformer
Lister() StackLister
AddHandler(name string, handler StackHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler StackHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type StackInterface interface {
Controller() StackController
AddHandler(name string, sync StackHandlerFunc)
AddLifecycle(name string, lifecycle StackLifecycle)
AddClusterScopedHandler(name, clusterName string, sync StackHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle StackLifecycle)
}
type stackLister struct {
@ -121,6 +124,24 @@ func (c *stackController) AddHandler(name string, handler StackHandlerFunc) {
})
}
func (c *stackController) AddClusterScopedHandler(name, cluster string, handler StackHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*Stack))
})
}
type stackFactory struct {
}
@ -217,6 +238,15 @@ func (s *stackClient) AddHandler(name string, sync StackHandlerFunc) {
}
func (s *stackClient) AddLifecycle(name string, lifecycle StackLifecycle) {
sync := NewStackLifecycleAdapter(name, s, lifecycle)
sync := NewStackLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *stackClient) AddClusterScopedHandler(name, clusterName string, sync StackHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *stackClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle StackLifecycle) {
sync := NewStackLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *stackLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, err
return o, err
}
func NewStackLifecycleAdapter(name string, client StackInterface, l StackLifecycle) StackHandlerFunc {
func NewStackLifecycleAdapter(name string, clusterScoped bool, client StackInterface, l StackLifecycle) StackHandlerFunc {
adapter := &stackLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *Stack) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type TemplateController interface {
Informer() cache.SharedIndexInformer
Lister() TemplateLister
AddHandler(name string, handler TemplateHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler TemplateHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type TemplateInterface interface {
Controller() TemplateController
AddHandler(name string, sync TemplateHandlerFunc)
AddLifecycle(name string, lifecycle TemplateLifecycle)
AddClusterScopedHandler(name, clusterName string, sync TemplateHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle TemplateLifecycle)
}
type templateLister struct {
@ -120,6 +123,24 @@ func (c *templateController) AddHandler(name string, handler TemplateHandlerFunc
})
}
func (c *templateController) AddClusterScopedHandler(name, cluster string, handler TemplateHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*Template))
})
}
type templateFactory struct {
}
@ -216,6 +237,15 @@ func (s *templateClient) AddHandler(name string, sync TemplateHandlerFunc) {
}
func (s *templateClient) AddLifecycle(name string, lifecycle TemplateLifecycle) {
sync := NewTemplateLifecycleAdapter(name, s, lifecycle)
sync := NewTemplateLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *templateClient) AddClusterScopedHandler(name, clusterName string, sync TemplateHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *templateClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle TemplateLifecycle) {
sync := NewTemplateLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *templateLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object,
return o, err
}
func NewTemplateLifecycleAdapter(name string, client TemplateInterface, l TemplateLifecycle) TemplateHandlerFunc {
func NewTemplateLifecycleAdapter(name string, clusterScoped bool, client TemplateInterface, l TemplateLifecycle) TemplateHandlerFunc {
adapter := &templateLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *Template) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type TemplateVersionController interface {
Informer() cache.SharedIndexInformer
Lister() TemplateVersionLister
AddHandler(name string, handler TemplateVersionHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler TemplateVersionHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type TemplateVersionInterface interface {
Controller() TemplateVersionController
AddHandler(name string, sync TemplateVersionHandlerFunc)
AddLifecycle(name string, lifecycle TemplateVersionLifecycle)
AddClusterScopedHandler(name, clusterName string, sync TemplateVersionHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle TemplateVersionLifecycle)
}
type templateVersionLister struct {
@ -120,6 +123,24 @@ func (c *templateVersionController) AddHandler(name string, handler TemplateVers
})
}
func (c *templateVersionController) AddClusterScopedHandler(name, cluster string, handler TemplateVersionHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*TemplateVersion))
})
}
type templateVersionFactory struct {
}
@ -216,6 +237,15 @@ func (s *templateVersionClient) AddHandler(name string, sync TemplateVersionHand
}
func (s *templateVersionClient) AddLifecycle(name string, lifecycle TemplateVersionLifecycle) {
sync := NewTemplateVersionLifecycleAdapter(name, s, lifecycle)
sync := NewTemplateVersionLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *templateVersionClient) AddClusterScopedHandler(name, clusterName string, sync TemplateVersionHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *templateVersionClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle TemplateVersionLifecycle) {
sync := NewTemplateVersionLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *templateVersionLifecycleAdapter) Updated(obj runtime.Object) (runtime.O
return o, err
}
func NewTemplateVersionLifecycleAdapter(name string, client TemplateVersionInterface, l TemplateVersionLifecycle) TemplateVersionHandlerFunc {
func NewTemplateVersionLifecycleAdapter(name string, clusterScoped bool, client TemplateVersionInterface, l TemplateVersionLifecycle) TemplateVersionHandlerFunc {
adapter := &templateVersionLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *TemplateVersion) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type TokenController interface {
Informer() cache.SharedIndexInformer
Lister() TokenLister
AddHandler(name string, handler TokenHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler TokenHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type TokenInterface interface {
Controller() TokenController
AddHandler(name string, sync TokenHandlerFunc)
AddLifecycle(name string, lifecycle TokenLifecycle)
AddClusterScopedHandler(name, clusterName string, sync TokenHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle TokenLifecycle)
}
type tokenLister struct {
@ -120,6 +123,24 @@ func (c *tokenController) AddHandler(name string, handler TokenHandlerFunc) {
})
}
func (c *tokenController) AddClusterScopedHandler(name, cluster string, handler TokenHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*Token))
})
}
type tokenFactory struct {
}
@ -216,6 +237,15 @@ func (s *tokenClient) AddHandler(name string, sync TokenHandlerFunc) {
}
func (s *tokenClient) AddLifecycle(name string, lifecycle TokenLifecycle) {
sync := NewTokenLifecycleAdapter(name, s, lifecycle)
sync := NewTokenLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *tokenClient) AddClusterScopedHandler(name, clusterName string, sync TokenHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *tokenClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle TokenLifecycle) {
sync := NewTokenLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *tokenLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, err
return o, err
}
func NewTokenLifecycleAdapter(name string, client TokenInterface, l TokenLifecycle) TokenHandlerFunc {
func NewTokenLifecycleAdapter(name string, clusterScoped bool, client TokenInterface, l TokenLifecycle) TokenHandlerFunc {
adapter := &tokenLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *Token) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -45,6 +45,7 @@ type UserController interface {
Informer() cache.SharedIndexInformer
Lister() UserLister
AddHandler(name string, handler UserHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler UserHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -64,6 +65,8 @@ type UserInterface interface {
Controller() UserController
AddHandler(name string, sync UserHandlerFunc)
AddLifecycle(name string, lifecycle UserLifecycle)
AddClusterScopedHandler(name, clusterName string, sync UserHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle UserLifecycle)
}
type userLister struct {
@ -120,6 +123,24 @@ func (c *userController) AddHandler(name string, handler UserHandlerFunc) {
})
}
func (c *userController) AddClusterScopedHandler(name, cluster string, handler UserHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*User))
})
}
type userFactory struct {
}
@ -216,6 +237,15 @@ func (s *userClient) AddHandler(name string, sync UserHandlerFunc) {
}
func (s *userClient) AddLifecycle(name string, lifecycle UserLifecycle) {
sync := NewUserLifecycleAdapter(name, s, lifecycle)
sync := NewUserLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *userClient) AddClusterScopedHandler(name, clusterName string, sync UserHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *userClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle UserLifecycle) {
sync := NewUserLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *userLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, erro
return o, err
}
func NewUserLifecycleAdapter(name string, client UserInterface, l UserLifecycle) UserHandlerFunc {
func NewUserLifecycleAdapter(name string, clusterScoped bool, client UserInterface, l UserLifecycle) UserHandlerFunc {
adapter := &userLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *User) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type BasicAuthController interface {
Informer() cache.SharedIndexInformer
Lister() BasicAuthLister
AddHandler(name string, handler BasicAuthHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler BasicAuthHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type BasicAuthInterface interface {
Controller() BasicAuthController
AddHandler(name string, sync BasicAuthHandlerFunc)
AddLifecycle(name string, lifecycle BasicAuthLifecycle)
AddClusterScopedHandler(name, clusterName string, sync BasicAuthHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle BasicAuthLifecycle)
}
type basicAuthLister struct {
@ -121,6 +124,24 @@ func (c *basicAuthController) AddHandler(name string, handler BasicAuthHandlerFu
})
}
func (c *basicAuthController) AddClusterScopedHandler(name, cluster string, handler BasicAuthHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*BasicAuth))
})
}
type basicAuthFactory struct {
}
@ -217,6 +238,15 @@ func (s *basicAuthClient) AddHandler(name string, sync BasicAuthHandlerFunc) {
}
func (s *basicAuthClient) AddLifecycle(name string, lifecycle BasicAuthLifecycle) {
sync := NewBasicAuthLifecycleAdapter(name, s, lifecycle)
sync := NewBasicAuthLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *basicAuthClient) AddClusterScopedHandler(name, clusterName string, sync BasicAuthHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *basicAuthClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle BasicAuthLifecycle) {
sync := NewBasicAuthLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *basicAuthLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object,
return o, err
}
func NewBasicAuthLifecycleAdapter(name string, client BasicAuthInterface, l BasicAuthLifecycle) BasicAuthHandlerFunc {
func NewBasicAuthLifecycleAdapter(name string, clusterScoped bool, client BasicAuthInterface, l BasicAuthLifecycle) BasicAuthHandlerFunc {
adapter := &basicAuthLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *BasicAuth) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type CertificateController interface {
Informer() cache.SharedIndexInformer
Lister() CertificateLister
AddHandler(name string, handler CertificateHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler CertificateHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type CertificateInterface interface {
Controller() CertificateController
AddHandler(name string, sync CertificateHandlerFunc)
AddLifecycle(name string, lifecycle CertificateLifecycle)
AddClusterScopedHandler(name, clusterName string, sync CertificateHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle CertificateLifecycle)
}
type certificateLister struct {
@ -121,6 +124,24 @@ func (c *certificateController) AddHandler(name string, handler CertificateHandl
})
}
func (c *certificateController) AddClusterScopedHandler(name, cluster string, handler CertificateHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*Certificate))
})
}
type certificateFactory struct {
}
@ -217,6 +238,15 @@ func (s *certificateClient) AddHandler(name string, sync CertificateHandlerFunc)
}
func (s *certificateClient) AddLifecycle(name string, lifecycle CertificateLifecycle) {
sync := NewCertificateLifecycleAdapter(name, s, lifecycle)
sync := NewCertificateLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *certificateClient) AddClusterScopedHandler(name, clusterName string, sync CertificateHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *certificateClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle CertificateLifecycle) {
sync := NewCertificateLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *certificateLifecycleAdapter) Updated(obj runtime.Object) (runtime.Objec
return o, err
}
func NewCertificateLifecycleAdapter(name string, client CertificateInterface, l CertificateLifecycle) CertificateHandlerFunc {
func NewCertificateLifecycleAdapter(name string, clusterScoped bool, client CertificateInterface, l CertificateLifecycle) CertificateHandlerFunc {
adapter := &certificateLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *Certificate) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type DockerCredentialController interface {
Informer() cache.SharedIndexInformer
Lister() DockerCredentialLister
AddHandler(name string, handler DockerCredentialHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler DockerCredentialHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type DockerCredentialInterface interface {
Controller() DockerCredentialController
AddHandler(name string, sync DockerCredentialHandlerFunc)
AddLifecycle(name string, lifecycle DockerCredentialLifecycle)
AddClusterScopedHandler(name, clusterName string, sync DockerCredentialHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle DockerCredentialLifecycle)
}
type dockerCredentialLister struct {
@ -121,6 +124,24 @@ func (c *dockerCredentialController) AddHandler(name string, handler DockerCrede
})
}
func (c *dockerCredentialController) AddClusterScopedHandler(name, cluster string, handler DockerCredentialHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*DockerCredential))
})
}
type dockerCredentialFactory struct {
}
@ -217,6 +238,15 @@ func (s *dockerCredentialClient) AddHandler(name string, sync DockerCredentialHa
}
func (s *dockerCredentialClient) AddLifecycle(name string, lifecycle DockerCredentialLifecycle) {
sync := NewDockerCredentialLifecycleAdapter(name, s, lifecycle)
sync := NewDockerCredentialLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *dockerCredentialClient) AddClusterScopedHandler(name, clusterName string, sync DockerCredentialHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *dockerCredentialClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle DockerCredentialLifecycle) {
sync := NewDockerCredentialLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *dockerCredentialLifecycleAdapter) Updated(obj runtime.Object) (runtime.
return o, err
}
func NewDockerCredentialLifecycleAdapter(name string, client DockerCredentialInterface, l DockerCredentialLifecycle) DockerCredentialHandlerFunc {
func NewDockerCredentialLifecycleAdapter(name string, clusterScoped bool, client DockerCredentialInterface, l DockerCredentialLifecycle) DockerCredentialHandlerFunc {
adapter := &dockerCredentialLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *DockerCredential) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type NamespacedBasicAuthController interface {
Informer() cache.SharedIndexInformer
Lister() NamespacedBasicAuthLister
AddHandler(name string, handler NamespacedBasicAuthHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler NamespacedBasicAuthHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type NamespacedBasicAuthInterface interface {
Controller() NamespacedBasicAuthController
AddHandler(name string, sync NamespacedBasicAuthHandlerFunc)
AddLifecycle(name string, lifecycle NamespacedBasicAuthLifecycle)
AddClusterScopedHandler(name, clusterName string, sync NamespacedBasicAuthHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle NamespacedBasicAuthLifecycle)
}
type namespacedBasicAuthLister struct {
@ -121,6 +124,24 @@ func (c *namespacedBasicAuthController) AddHandler(name string, handler Namespac
})
}
func (c *namespacedBasicAuthController) AddClusterScopedHandler(name, cluster string, handler NamespacedBasicAuthHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*NamespacedBasicAuth))
})
}
type namespacedBasicAuthFactory struct {
}
@ -217,6 +238,15 @@ func (s *namespacedBasicAuthClient) AddHandler(name string, sync NamespacedBasic
}
func (s *namespacedBasicAuthClient) AddLifecycle(name string, lifecycle NamespacedBasicAuthLifecycle) {
sync := NewNamespacedBasicAuthLifecycleAdapter(name, s, lifecycle)
sync := NewNamespacedBasicAuthLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *namespacedBasicAuthClient) AddClusterScopedHandler(name, clusterName string, sync NamespacedBasicAuthHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *namespacedBasicAuthClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle NamespacedBasicAuthLifecycle) {
sync := NewNamespacedBasicAuthLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *namespacedBasicAuthLifecycleAdapter) Updated(obj runtime.Object) (runti
return o, err
}
func NewNamespacedBasicAuthLifecycleAdapter(name string, client NamespacedBasicAuthInterface, l NamespacedBasicAuthLifecycle) NamespacedBasicAuthHandlerFunc {
func NewNamespacedBasicAuthLifecycleAdapter(name string, clusterScoped bool, client NamespacedBasicAuthInterface, l NamespacedBasicAuthLifecycle) NamespacedBasicAuthHandlerFunc {
adapter := &namespacedBasicAuthLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *NamespacedBasicAuth) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type NamespacedCertificateController interface {
Informer() cache.SharedIndexInformer
Lister() NamespacedCertificateLister
AddHandler(name string, handler NamespacedCertificateHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler NamespacedCertificateHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type NamespacedCertificateInterface interface {
Controller() NamespacedCertificateController
AddHandler(name string, sync NamespacedCertificateHandlerFunc)
AddLifecycle(name string, lifecycle NamespacedCertificateLifecycle)
AddClusterScopedHandler(name, clusterName string, sync NamespacedCertificateHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle NamespacedCertificateLifecycle)
}
type namespacedCertificateLister struct {
@ -121,6 +124,24 @@ func (c *namespacedCertificateController) AddHandler(name string, handler Namesp
})
}
func (c *namespacedCertificateController) AddClusterScopedHandler(name, cluster string, handler NamespacedCertificateHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*NamespacedCertificate))
})
}
type namespacedCertificateFactory struct {
}
@ -217,6 +238,15 @@ func (s *namespacedCertificateClient) AddHandler(name string, sync NamespacedCer
}
func (s *namespacedCertificateClient) AddLifecycle(name string, lifecycle NamespacedCertificateLifecycle) {
sync := NewNamespacedCertificateLifecycleAdapter(name, s, lifecycle)
sync := NewNamespacedCertificateLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *namespacedCertificateClient) AddClusterScopedHandler(name, clusterName string, sync NamespacedCertificateHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *namespacedCertificateClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle NamespacedCertificateLifecycle) {
sync := NewNamespacedCertificateLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *namespacedCertificateLifecycleAdapter) Updated(obj runtime.Object) (run
return o, err
}
func NewNamespacedCertificateLifecycleAdapter(name string, client NamespacedCertificateInterface, l NamespacedCertificateLifecycle) NamespacedCertificateHandlerFunc {
func NewNamespacedCertificateLifecycleAdapter(name string, clusterScoped bool, client NamespacedCertificateInterface, l NamespacedCertificateLifecycle) NamespacedCertificateHandlerFunc {
adapter := &namespacedCertificateLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *NamespacedCertificate) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type NamespacedDockerCredentialController interface {
Informer() cache.SharedIndexInformer
Lister() NamespacedDockerCredentialLister
AddHandler(name string, handler NamespacedDockerCredentialHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler NamespacedDockerCredentialHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type NamespacedDockerCredentialInterface interface {
Controller() NamespacedDockerCredentialController
AddHandler(name string, sync NamespacedDockerCredentialHandlerFunc)
AddLifecycle(name string, lifecycle NamespacedDockerCredentialLifecycle)
AddClusterScopedHandler(name, clusterName string, sync NamespacedDockerCredentialHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle NamespacedDockerCredentialLifecycle)
}
type namespacedDockerCredentialLister struct {
@ -121,6 +124,24 @@ func (c *namespacedDockerCredentialController) AddHandler(name string, handler N
})
}
func (c *namespacedDockerCredentialController) AddClusterScopedHandler(name, cluster string, handler NamespacedDockerCredentialHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*NamespacedDockerCredential))
})
}
type namespacedDockerCredentialFactory struct {
}
@ -217,6 +238,15 @@ func (s *namespacedDockerCredentialClient) AddHandler(name string, sync Namespac
}
func (s *namespacedDockerCredentialClient) AddLifecycle(name string, lifecycle NamespacedDockerCredentialLifecycle) {
sync := NewNamespacedDockerCredentialLifecycleAdapter(name, s, lifecycle)
sync := NewNamespacedDockerCredentialLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *namespacedDockerCredentialClient) AddClusterScopedHandler(name, clusterName string, sync NamespacedDockerCredentialHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *namespacedDockerCredentialClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle NamespacedDockerCredentialLifecycle) {
sync := NewNamespacedDockerCredentialLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *namespacedDockerCredentialLifecycleAdapter) Updated(obj runtime.Object)
return o, err
}
func NewNamespacedDockerCredentialLifecycleAdapter(name string, client NamespacedDockerCredentialInterface, l NamespacedDockerCredentialLifecycle) NamespacedDockerCredentialHandlerFunc {
func NewNamespacedDockerCredentialLifecycleAdapter(name string, clusterScoped bool, client NamespacedDockerCredentialInterface, l NamespacedDockerCredentialLifecycle) NamespacedDockerCredentialHandlerFunc {
adapter := &namespacedDockerCredentialLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *NamespacedDockerCredential) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type NamespacedServiceAccountTokenController interface {
Informer() cache.SharedIndexInformer
Lister() NamespacedServiceAccountTokenLister
AddHandler(name string, handler NamespacedServiceAccountTokenHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler NamespacedServiceAccountTokenHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type NamespacedServiceAccountTokenInterface interface {
Controller() NamespacedServiceAccountTokenController
AddHandler(name string, sync NamespacedServiceAccountTokenHandlerFunc)
AddLifecycle(name string, lifecycle NamespacedServiceAccountTokenLifecycle)
AddClusterScopedHandler(name, clusterName string, sync NamespacedServiceAccountTokenHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle NamespacedServiceAccountTokenLifecycle)
}
type namespacedServiceAccountTokenLister struct {
@ -121,6 +124,24 @@ func (c *namespacedServiceAccountTokenController) AddHandler(name string, handle
})
}
func (c *namespacedServiceAccountTokenController) AddClusterScopedHandler(name, cluster string, handler NamespacedServiceAccountTokenHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*NamespacedServiceAccountToken))
})
}
type namespacedServiceAccountTokenFactory struct {
}
@ -217,6 +238,15 @@ func (s *namespacedServiceAccountTokenClient) AddHandler(name string, sync Names
}
func (s *namespacedServiceAccountTokenClient) AddLifecycle(name string, lifecycle NamespacedServiceAccountTokenLifecycle) {
sync := NewNamespacedServiceAccountTokenLifecycleAdapter(name, s, lifecycle)
sync := NewNamespacedServiceAccountTokenLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *namespacedServiceAccountTokenClient) AddClusterScopedHandler(name, clusterName string, sync NamespacedServiceAccountTokenHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *namespacedServiceAccountTokenClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle NamespacedServiceAccountTokenLifecycle) {
sync := NewNamespacedServiceAccountTokenLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *namespacedServiceAccountTokenLifecycleAdapter) Updated(obj runtime.Obje
return o, err
}
func NewNamespacedServiceAccountTokenLifecycleAdapter(name string, client NamespacedServiceAccountTokenInterface, l NamespacedServiceAccountTokenLifecycle) NamespacedServiceAccountTokenHandlerFunc {
func NewNamespacedServiceAccountTokenLifecycleAdapter(name string, clusterScoped bool, client NamespacedServiceAccountTokenInterface, l NamespacedServiceAccountTokenLifecycle) NamespacedServiceAccountTokenHandlerFunc {
adapter := &namespacedServiceAccountTokenLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *NamespacedServiceAccountToken) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type NamespacedSSHAuthController interface {
Informer() cache.SharedIndexInformer
Lister() NamespacedSSHAuthLister
AddHandler(name string, handler NamespacedSSHAuthHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler NamespacedSSHAuthHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type NamespacedSSHAuthInterface interface {
Controller() NamespacedSSHAuthController
AddHandler(name string, sync NamespacedSSHAuthHandlerFunc)
AddLifecycle(name string, lifecycle NamespacedSSHAuthLifecycle)
AddClusterScopedHandler(name, clusterName string, sync NamespacedSSHAuthHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle NamespacedSSHAuthLifecycle)
}
type namespacedSshAuthLister struct {
@ -121,6 +124,24 @@ func (c *namespacedSshAuthController) AddHandler(name string, handler Namespaced
})
}
func (c *namespacedSshAuthController) AddClusterScopedHandler(name, cluster string, handler NamespacedSSHAuthHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*NamespacedSSHAuth))
})
}
type namespacedSshAuthFactory struct {
}
@ -217,6 +238,15 @@ func (s *namespacedSshAuthClient) AddHandler(name string, sync NamespacedSSHAuth
}
func (s *namespacedSshAuthClient) AddLifecycle(name string, lifecycle NamespacedSSHAuthLifecycle) {
sync := NewNamespacedSSHAuthLifecycleAdapter(name, s, lifecycle)
sync := NewNamespacedSSHAuthLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *namespacedSshAuthClient) AddClusterScopedHandler(name, clusterName string, sync NamespacedSSHAuthHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *namespacedSshAuthClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle NamespacedSSHAuthLifecycle) {
sync := NewNamespacedSSHAuthLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *namespacedSshAuthLifecycleAdapter) Updated(obj runtime.Object) (runtime
return o, err
}
func NewNamespacedSSHAuthLifecycleAdapter(name string, client NamespacedSSHAuthInterface, l NamespacedSSHAuthLifecycle) NamespacedSSHAuthHandlerFunc {
func NewNamespacedSSHAuthLifecycleAdapter(name string, clusterScoped bool, client NamespacedSSHAuthInterface, l NamespacedSSHAuthLifecycle) NamespacedSSHAuthHandlerFunc {
adapter := &namespacedSshAuthLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *NamespacedSSHAuth) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type ServiceAccountTokenController interface {
Informer() cache.SharedIndexInformer
Lister() ServiceAccountTokenLister
AddHandler(name string, handler ServiceAccountTokenHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler ServiceAccountTokenHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type ServiceAccountTokenInterface interface {
Controller() ServiceAccountTokenController
AddHandler(name string, sync ServiceAccountTokenHandlerFunc)
AddLifecycle(name string, lifecycle ServiceAccountTokenLifecycle)
AddClusterScopedHandler(name, clusterName string, sync ServiceAccountTokenHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle ServiceAccountTokenLifecycle)
}
type serviceAccountTokenLister struct {
@ -121,6 +124,24 @@ func (c *serviceAccountTokenController) AddHandler(name string, handler ServiceA
})
}
func (c *serviceAccountTokenController) AddClusterScopedHandler(name, cluster string, handler ServiceAccountTokenHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*ServiceAccountToken))
})
}
type serviceAccountTokenFactory struct {
}
@ -217,6 +238,15 @@ func (s *serviceAccountTokenClient) AddHandler(name string, sync ServiceAccountT
}
func (s *serviceAccountTokenClient) AddLifecycle(name string, lifecycle ServiceAccountTokenLifecycle) {
sync := NewServiceAccountTokenLifecycleAdapter(name, s, lifecycle)
sync := NewServiceAccountTokenLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *serviceAccountTokenClient) AddClusterScopedHandler(name, clusterName string, sync ServiceAccountTokenHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *serviceAccountTokenClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ServiceAccountTokenLifecycle) {
sync := NewServiceAccountTokenLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *serviceAccountTokenLifecycleAdapter) Updated(obj runtime.Object) (runti
return o, err
}
func NewServiceAccountTokenLifecycleAdapter(name string, client ServiceAccountTokenInterface, l ServiceAccountTokenLifecycle) ServiceAccountTokenHandlerFunc {
func NewServiceAccountTokenLifecycleAdapter(name string, clusterScoped bool, client ServiceAccountTokenInterface, l ServiceAccountTokenLifecycle) ServiceAccountTokenHandlerFunc {
adapter := &serviceAccountTokenLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *ServiceAccountToken) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type SSHAuthController interface {
Informer() cache.SharedIndexInformer
Lister() SSHAuthLister
AddHandler(name string, handler SSHAuthHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler SSHAuthHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type SSHAuthInterface interface {
Controller() SSHAuthController
AddHandler(name string, sync SSHAuthHandlerFunc)
AddLifecycle(name string, lifecycle SSHAuthLifecycle)
AddClusterScopedHandler(name, clusterName string, sync SSHAuthHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle SSHAuthLifecycle)
}
type sshAuthLister struct {
@ -121,6 +124,24 @@ func (c *sshAuthController) AddHandler(name string, handler SSHAuthHandlerFunc)
})
}
func (c *sshAuthController) AddClusterScopedHandler(name, cluster string, handler SSHAuthHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*SSHAuth))
})
}
type sshAuthFactory struct {
}
@ -217,6 +238,15 @@ func (s *sshAuthClient) AddHandler(name string, sync SSHAuthHandlerFunc) {
}
func (s *sshAuthClient) AddLifecycle(name string, lifecycle SSHAuthLifecycle) {
sync := NewSSHAuthLifecycleAdapter(name, s, lifecycle)
sync := NewSSHAuthLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *sshAuthClient) AddClusterScopedHandler(name, clusterName string, sync SSHAuthHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *sshAuthClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle SSHAuthLifecycle) {
sync := NewSSHAuthLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *sshAuthLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, e
return o, err
}
func NewSSHAuthLifecycleAdapter(name string, client SSHAuthInterface, l SSHAuthLifecycle) SSHAuthHandlerFunc {
func NewSSHAuthLifecycleAdapter(name string, clusterScoped bool, client SSHAuthInterface, l SSHAuthLifecycle) SSHAuthHandlerFunc {
adapter := &sshAuthLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *SSHAuth) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type WorkloadController interface {
Informer() cache.SharedIndexInformer
Lister() WorkloadLister
AddHandler(name string, handler WorkloadHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler WorkloadHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type WorkloadInterface interface {
Controller() WorkloadController
AddHandler(name string, sync WorkloadHandlerFunc)
AddLifecycle(name string, lifecycle WorkloadLifecycle)
AddClusterScopedHandler(name, clusterName string, sync WorkloadHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle WorkloadLifecycle)
}
type workloadLister struct {
@ -121,6 +124,24 @@ func (c *workloadController) AddHandler(name string, handler WorkloadHandlerFunc
})
}
func (c *workloadController) AddClusterScopedHandler(name, cluster string, handler WorkloadHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*Workload))
})
}
type workloadFactory struct {
}
@ -217,6 +238,15 @@ func (s *workloadClient) AddHandler(name string, sync WorkloadHandlerFunc) {
}
func (s *workloadClient) AddLifecycle(name string, lifecycle WorkloadLifecycle) {
sync := NewWorkloadLifecycleAdapter(name, s, lifecycle)
sync := NewWorkloadLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *workloadClient) AddClusterScopedHandler(name, clusterName string, sync WorkloadHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *workloadClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle WorkloadLifecycle) {
sync := NewWorkloadLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -39,9 +39,9 @@ func (w *workloadLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object,
return o, err
}
func NewWorkloadLifecycleAdapter(name string, client WorkloadInterface, l WorkloadLifecycle) WorkloadHandlerFunc {
func NewWorkloadLifecycleAdapter(name string, clusterScoped bool, client WorkloadInterface, l WorkloadLifecycle) WorkloadHandlerFunc {
adapter := &workloadLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *Workload) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type ClusterRoleBindingController interface {
Informer() cache.SharedIndexInformer
Lister() ClusterRoleBindingLister
AddHandler(name string, handler ClusterRoleBindingHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler ClusterRoleBindingHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type ClusterRoleBindingInterface interface {
Controller() ClusterRoleBindingController
AddHandler(name string, sync ClusterRoleBindingHandlerFunc)
AddLifecycle(name string, lifecycle ClusterRoleBindingLifecycle)
AddClusterScopedHandler(name, clusterName string, sync ClusterRoleBindingHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterRoleBindingLifecycle)
}
type clusterRoleBindingLister struct {
@ -121,6 +124,24 @@ func (c *clusterRoleBindingController) AddHandler(name string, handler ClusterRo
})
}
func (c *clusterRoleBindingController) AddClusterScopedHandler(name, cluster string, handler ClusterRoleBindingHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1.ClusterRoleBinding))
})
}
type clusterRoleBindingFactory struct {
}
@ -217,6 +238,15 @@ func (s *clusterRoleBindingClient) AddHandler(name string, sync ClusterRoleBindi
}
func (s *clusterRoleBindingClient) AddLifecycle(name string, lifecycle ClusterRoleBindingLifecycle) {
sync := NewClusterRoleBindingLifecycleAdapter(name, s, lifecycle)
sync := NewClusterRoleBindingLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *clusterRoleBindingClient) AddClusterScopedHandler(name, clusterName string, sync ClusterRoleBindingHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *clusterRoleBindingClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterRoleBindingLifecycle) {
sync := NewClusterRoleBindingLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -40,9 +40,9 @@ func (w *clusterRoleBindingLifecycleAdapter) Updated(obj runtime.Object) (runtim
return o, err
}
func NewClusterRoleBindingLifecycleAdapter(name string, client ClusterRoleBindingInterface, l ClusterRoleBindingLifecycle) ClusterRoleBindingHandlerFunc {
func NewClusterRoleBindingLifecycleAdapter(name string, clusterScoped bool, client ClusterRoleBindingInterface, l ClusterRoleBindingLifecycle) ClusterRoleBindingHandlerFunc {
adapter := &clusterRoleBindingLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.ClusterRoleBinding) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -46,6 +46,7 @@ type ClusterRoleController interface {
Informer() cache.SharedIndexInformer
Lister() ClusterRoleLister
AddHandler(name string, handler ClusterRoleHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler ClusterRoleHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -65,6 +66,8 @@ type ClusterRoleInterface interface {
Controller() ClusterRoleController
AddHandler(name string, sync ClusterRoleHandlerFunc)
AddLifecycle(name string, lifecycle ClusterRoleLifecycle)
AddClusterScopedHandler(name, clusterName string, sync ClusterRoleHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterRoleLifecycle)
}
type clusterRoleLister struct {
@ -121,6 +124,24 @@ func (c *clusterRoleController) AddHandler(name string, handler ClusterRoleHandl
})
}
func (c *clusterRoleController) AddClusterScopedHandler(name, cluster string, handler ClusterRoleHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1.ClusterRole))
})
}
type clusterRoleFactory struct {
}
@ -217,6 +238,15 @@ func (s *clusterRoleClient) AddHandler(name string, sync ClusterRoleHandlerFunc)
}
func (s *clusterRoleClient) AddLifecycle(name string, lifecycle ClusterRoleLifecycle) {
sync := NewClusterRoleLifecycleAdapter(name, s, lifecycle)
sync := NewClusterRoleLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *clusterRoleClient) AddClusterScopedHandler(name, clusterName string, sync ClusterRoleHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *clusterRoleClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterRoleLifecycle) {
sync := NewClusterRoleLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -40,9 +40,9 @@ func (w *clusterRoleLifecycleAdapter) Updated(obj runtime.Object) (runtime.Objec
return o, err
}
func NewClusterRoleLifecycleAdapter(name string, client ClusterRoleInterface, l ClusterRoleLifecycle) ClusterRoleHandlerFunc {
func NewClusterRoleLifecycleAdapter(name string, clusterScoped bool, client ClusterRoleInterface, l ClusterRoleLifecycle) ClusterRoleHandlerFunc {
adapter := &clusterRoleLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.ClusterRole) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -47,6 +47,7 @@ type RoleBindingController interface {
Informer() cache.SharedIndexInformer
Lister() RoleBindingLister
AddHandler(name string, handler RoleBindingHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler RoleBindingHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -66,6 +67,8 @@ type RoleBindingInterface interface {
Controller() RoleBindingController
AddHandler(name string, sync RoleBindingHandlerFunc)
AddLifecycle(name string, lifecycle RoleBindingLifecycle)
AddClusterScopedHandler(name, clusterName string, sync RoleBindingHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle RoleBindingLifecycle)
}
type roleBindingLister struct {
@ -122,6 +125,24 @@ func (c *roleBindingController) AddHandler(name string, handler RoleBindingHandl
})
}
func (c *roleBindingController) AddClusterScopedHandler(name, cluster string, handler RoleBindingHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1.RoleBinding))
})
}
type roleBindingFactory struct {
}
@ -218,6 +239,15 @@ func (s *roleBindingClient) AddHandler(name string, sync RoleBindingHandlerFunc)
}
func (s *roleBindingClient) AddLifecycle(name string, lifecycle RoleBindingLifecycle) {
sync := NewRoleBindingLifecycleAdapter(name, s, lifecycle)
sync := NewRoleBindingLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *roleBindingClient) AddClusterScopedHandler(name, clusterName string, sync RoleBindingHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *roleBindingClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle RoleBindingLifecycle) {
sync := NewRoleBindingLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -40,9 +40,9 @@ func (w *roleBindingLifecycleAdapter) Updated(obj runtime.Object) (runtime.Objec
return o, err
}
func NewRoleBindingLifecycleAdapter(name string, client RoleBindingInterface, l RoleBindingLifecycle) RoleBindingHandlerFunc {
func NewRoleBindingLifecycleAdapter(name string, clusterScoped bool, client RoleBindingInterface, l RoleBindingLifecycle) RoleBindingHandlerFunc {
adapter := &roleBindingLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.RoleBinding) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -47,6 +47,7 @@ type RoleController interface {
Informer() cache.SharedIndexInformer
Lister() RoleLister
AddHandler(name string, handler RoleHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler RoleHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -66,6 +67,8 @@ type RoleInterface interface {
Controller() RoleController
AddHandler(name string, sync RoleHandlerFunc)
AddLifecycle(name string, lifecycle RoleLifecycle)
AddClusterScopedHandler(name, clusterName string, sync RoleHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle RoleLifecycle)
}
type roleLister struct {
@ -122,6 +125,24 @@ func (c *roleController) AddHandler(name string, handler RoleHandlerFunc) {
})
}
func (c *roleController) AddClusterScopedHandler(name, cluster string, handler RoleHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1.Role))
})
}
type roleFactory struct {
}
@ -218,6 +239,15 @@ func (s *roleClient) AddHandler(name string, sync RoleHandlerFunc) {
}
func (s *roleClient) AddLifecycle(name string, lifecycle RoleLifecycle) {
sync := NewRoleLifecycleAdapter(name, s, lifecycle)
sync := NewRoleLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *roleClient) AddClusterScopedHandler(name, clusterName string, sync RoleHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *roleClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle RoleLifecycle) {
sync := NewRoleLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -40,9 +40,9 @@ func (w *roleLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, erro
return o, err
}
func NewRoleLifecycleAdapter(name string, client RoleInterface, l RoleLifecycle) RoleHandlerFunc {
func NewRoleLifecycleAdapter(name string, clusterScoped bool, client RoleInterface, l RoleLifecycle) RoleHandlerFunc {
adapter := &roleLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Role) error {
if obj == nil {
return syncFn(key, nil)

View File

@ -3,5 +3,5 @@ github.com/rancher/types
k8s.io/kubernetes v1.8.3 transitive=true,staging=true
bitbucket.org/ww/goautoneg a547fc61f48d567d5b4ec6f8aee5573d8efce11d https://github.com/rancher/goautoneg.git
github.com/rancher/norman af105c2bc779eba3d3fc15a5cfa7bd5ad140a41e
github.com/rancher/norman 905797b50f5617765df971412c22fdc5cb84d847
golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5

View File

@ -0,0 +1,59 @@
package controller
import (
"reflect"
"strings"
)
func ObjectInCluster(cluster string, obj interface{}) bool {
var clusterName string
if c := getValue(obj, "ClusterName"); c.IsValid() {
clusterName = c.String()
}
if clusterName == "" {
if c := getValue(obj, "Spec", "ClusterName"); c.IsValid() {
clusterName = c.String()
}
}
if clusterName == "" {
if c := getValue(obj, "ProjectName"); c.IsValid() {
if parts := strings.SplitN(c.String(), ":", 2); len(parts) == 2 {
clusterName = parts[0]
}
}
}
if clusterName == "" {
if c := getValue(obj, "Spec", "ProjectName"); c.IsValid() {
if parts := strings.SplitN(c.String(), ":", 2); len(parts) == 2 {
clusterName = parts[0]
}
}
}
return clusterName == cluster
}
func getValue(obj interface{}, name ...string) reflect.Value {
v := reflect.ValueOf(obj)
t := v.Type()
if t.Kind() == reflect.Ptr {
v = v.Elem()
t = v.Type()
}
field := v.FieldByName(name[0])
if !field.IsValid() || len(name) == 1 {
return field
}
return getFieldValue(field, name[1:]...)
}
func getFieldValue(v reflect.Value, name ...string) reflect.Value {
field := v.FieldByName(name[0])
if len(name) == 1 {
return field
}
return getFieldValue(field, name[1:]...)
}

View File

@ -52,6 +52,7 @@ type {{.schema.CodeName}}Controller interface {
Informer() cache.SharedIndexInformer
Lister() {{.schema.CodeName}}Lister
AddHandler(name string, handler {{.schema.CodeName}}HandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler {{.schema.CodeName}}HandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@ -71,6 +72,8 @@ type {{.schema.CodeName}}Interface interface {
Controller() {{.schema.CodeName}}Controller
AddHandler(name string, sync {{.schema.CodeName}}HandlerFunc)
AddLifecycle(name string, lifecycle {{.schema.CodeName}}Lifecycle)
AddClusterScopedHandler(name, clusterName string, sync {{.schema.CodeName}}HandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle {{.schema.CodeName}}Lifecycle)
}
type {{.schema.ID}}Lister struct {
@ -128,6 +131,24 @@ func (c *{{.schema.ID}}Controller) AddHandler(name string, handler {{.schema.Cod
})
}
func (c *{{.schema.ID}}Controller) AddClusterScopedHandler(name, cluster string, handler {{.schema.CodeName}}HandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*{{.prefix}}{{.schema.CodeName}}))
})
}
type {{.schema.ID}}Factory struct {
}
@ -224,7 +245,16 @@ func (s *{{.schema.ID}}Client) AddHandler(name string, sync {{.schema.CodeName}}
}
func (s *{{.schema.ID}}Client) AddLifecycle(name string, lifecycle {{.schema.CodeName}}Lifecycle) {
sync := New{{.schema.CodeName}}LifecycleAdapter(name, s, lifecycle)
sync := New{{.schema.CodeName}}LifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *{{.schema.ID}}Client) AddClusterScopedHandler(name, clusterName string, sync {{.schema.CodeName}}HandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *{{.schema.ID}}Client) AddClusterScopedLifecycle(name, clusterName string, lifecycle {{.schema.CodeName}}Lifecycle) {
sync := New{{.schema.CodeName}}LifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}
`

View File

@ -42,9 +42,9 @@ func (w *{{.schema.ID}}LifecycleAdapter) Updated(obj runtime.Object) (runtime.Ob
return o, err
}
func New{{.schema.CodeName}}LifecycleAdapter(name string, client {{.schema.CodeName}}Interface, l {{.schema.CodeName}}Lifecycle) {{.schema.CodeName}}HandlerFunc {
func New{{.schema.CodeName}}LifecycleAdapter(name string, clusterScoped bool, client {{.schema.CodeName}}Interface, l {{.schema.CodeName}}Lifecycle) {{.schema.CodeName}}HandlerFunc {
adapter := &{{.schema.ID}}LifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *{{.prefix}}{{.schema.CodeName}}) error {
if obj == nil {
return syncFn(key, nil)

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