1
0
mirror of https://github.com/rancher/types.git synced 2025-09-01 05:09:10 +00:00

Update vendor

This commit is contained in:
Dax McDonald
2019-08-21 17:11:16 -07:00
committed by Craig Jellick
parent b4a31197d6
commit b61d0733a3
5 changed files with 8 additions and 6 deletions

View File

@@ -177,7 +177,6 @@ func (c *{{.schema.ID}}Controller) AddFeatureHandler(ctx context.Context, enable
}
func (c *{{.schema.ID}}Controller) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler {{.schema.CodeName}}HandlerFunc) {
resource.PutClusterScoped({{.schema.CodeName}}GroupVersionResource)
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
@@ -190,7 +189,6 @@ func (c *{{.schema.ID}}Controller) AddClusterScopedHandler(ctx context.Context,
}
func (c *{{.schema.ID}}Controller) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, cluster string, handler {{.schema.CodeName}}HandlerFunc) {
resource.PutClusterScoped({{.schema.CodeName}}GroupVersionResource)
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if !enabled() {
return nil, nil

View File

@@ -7,6 +7,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/lifecycle"
"github.com/rancher/norman/resource"
)
type {{.schema.CodeName}}Lifecycle interface {
@@ -54,6 +55,9 @@ func (w *{{.schema.ID}}LifecycleAdapter) Updated(obj runtime.Object) (runtime.Ob
}
func New{{.schema.CodeName}}LifecycleAdapter(name string, clusterScoped bool, client {{.schema.CodeName}}Interface, l {{.schema.CodeName}}Lifecycle) {{.schema.CodeName}}HandlerFunc {
if clusterScoped {
resource.PutClusterScoped({{.schema.CodeName}}GroupVersionResource)
}
adapter := &{{.schema.ID}}LifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *{{.prefix}}{{.schema.CodeName}}) (runtime.Object, error) {