Pull controller-go back into this repository as internal/controllerlib.

Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
Matt Moyer
2020-08-28 10:59:09 -05:00
parent 371b172616
commit a503fa8673
35 changed files with 1700 additions and 147 deletions

View File

@@ -8,14 +8,14 @@ package controller
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/suzerain-io/controller-go"
"github.com/suzerain-io/pinniped/internal/controllerlib"
)
func NameAndNamespaceExactMatchFilterFactory(name, namespace string) controller.FilterFuncs {
func NameAndNamespaceExactMatchFilterFactory(name, namespace string) controllerlib.FilterFuncs {
objMatchesFunc := func(obj metav1.Object) bool {
return obj.GetName() == name && obj.GetNamespace() == namespace
}
return controller.FilterFuncs{
return controllerlib.FilterFuncs{
AddFunc: objMatchesFunc,
UpdateFunc: func(oldObj, newObj metav1.Object) bool {
return objMatchesFunc(oldObj) || objMatchesFunc(newObj)
@@ -24,11 +24,11 @@ func NameAndNamespaceExactMatchFilterFactory(name, namespace string) controller.
}
}
// Same signature as controller.WithInformer().
// Same signature as controllerlib.WithInformer().
type WithInformerOptionFunc func(
getter controller.InformerGetter,
filter controller.Filter,
opt controller.InformerOption) controller.Option
getter controllerlib.InformerGetter,
filter controllerlib.Filter,
opt controllerlib.InformerOption) controllerlib.Option
// Same signature as controller.WithInitialEvent().
type WithInitialEventOptionFunc func(key controller.Key) controller.Option
// Same signature as controllerlib.WithInitialEvent().
type WithInitialEventOptionFunc func(key controllerlib.Key) controllerlib.Option