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(
|
backupInformer.Informer().AddEventHandler(
|
||||||
cache.ResourceEventHandlerFuncs{
|
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
|
// handleFinalizer runs garbage-collection on a backup that has the Ark GC
|
||||||
// finalizer and a deletionTimestamp.
|
// finalizer and a deletionTimestamp.
|
||||||
func (c *gcController) handleFinalizer(_, newObj interface{}) {
|
func (c *gcController) handleFinalizer(obj interface{}) {
|
||||||
var (
|
var (
|
||||||
backup = newObj.(*api.Backup)
|
backup = obj.(*api.Backup)
|
||||||
log = c.logger.WithField("backup", kube.NamespaceAndName(backup))
|
log = c.logger.WithField("backup", kube.NamespaceAndName(backup))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -348,7 +348,7 @@ func TestHandleFinalizer(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// METHOD UNDER TEST
|
// METHOD UNDER TEST
|
||||||
controller.handleFinalizer(nil, test.backup)
|
controller.handleFinalizer(test.backup)
|
||||||
|
|
||||||
// VERIFY
|
// VERIFY
|
||||||
backupService.AssertExpectations(t)
|
backupService.AssertExpectations(t)
|
||||||
|
|
Loading…
Reference in New Issue