Merge pull request #343 from skriss/gc-bug
add an AddFunc to handle finalizers in GC for initial lists/resyncspull/360/head
commit
7328fd0e10
|
@ -99,7 +99,10 @@ func NewGCController(
|
|||
|
||||
backupInformer.Informer().AddEventHandler(
|
||||
cache.ResourceEventHandlerFuncs{
|
||||
UpdateFunc: c.handleFinalizer,
|
||||
AddFunc: c.handleFinalizer,
|
||||
UpdateFunc: func(_, upd interface{}) {
|
||||
c.handleFinalizer(upd)
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
|
@ -108,9 +111,9 @@ func NewGCController(
|
|||
|
||||
// handleFinalizer runs garbage-collection on a backup that has the Ark GC
|
||||
// finalizer and a deletionTimestamp.
|
||||
func (c *gcController) handleFinalizer(_, newObj interface{}) {
|
||||
func (c *gcController) handleFinalizer(obj interface{}) {
|
||||
var (
|
||||
backup = newObj.(*api.Backup)
|
||||
backup = obj.(*api.Backup)
|
||||
log = c.logger.WithField("backup", kube.NamespaceAndName(backup))
|
||||
)
|
||||
|
||||
|
|
|
@ -348,7 +348,7 @@ func TestHandleFinalizer(t *testing.T) {
|
|||
}
|
||||
|
||||
// METHOD UNDER TEST
|
||||
controller.handleFinalizer(nil, test.backup)
|
||||
controller.handleFinalizer(test.backup)
|
||||
|
||||
// VERIFY
|
||||
backupService.AssertExpectations(t)
|
||||
|
|
Loading…
Reference in New Issue