Reuse helper filter in generic secret gen controller

Signed-off-by: Andrew Keesler <akeesler@vmware.com>
This commit is contained in:
Andrew Keesler 2020-12-14 10:37:27 -05:00
parent b043dae149
commit e3ea141bf3
No known key found for this signature in database
GPG Key ID: 27CE0444346F9413
1 changed files with 9 additions and 16 deletions

View File

@ -70,8 +70,7 @@ func NewOIDCProviderSecretsController(
// TODO: de-dup me (jwks_writer.go).
withInformer(
secretInformer,
controllerlib.FilterFuncs{
ParentFunc: func(obj metav1.Object) controllerlib.Key {
pinnipedcontroller.SimpleFilter(isOPCControllee, func(obj metav1.Object) controllerlib.Key {
if isOPCControllee(obj) {
controller := metav1.GetControllerOf(obj)
return controllerlib.Key{
@ -80,13 +79,7 @@ func NewOIDCProviderSecretsController(
}
}
return controllerlib.Key{}
},
AddFunc: isOPCControllee,
UpdateFunc: func(oldObj, newObj metav1.Object) bool {
return isOPCControllee(oldObj) || isOPCControllee(newObj)
},
DeleteFunc: isOPCControllee,
},
}),
controllerlib.InformerOption{},
),
// We want to be notified when anything happens to an OPC.