Cleanup no-longer used storage cleanup method
Kubernetes-commit: 2dd44d6226efc6b72ae56b5fb81b5b2921cf3e16
This commit is contained in:
parent
cc42d28f06
commit
d0a6d0fb72
|
|
@ -78,11 +78,6 @@ func StorageWithCacher() generic.StorageDecorator {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : Remove RegisterStorageCleanup below when PR
|
|
||||||
// https://github.com/kubernetes/kubernetes/pull/50690
|
|
||||||
// merges as that shuts down storage properly
|
|
||||||
RegisterStorageCleanup(destroyFunc)
|
|
||||||
|
|
||||||
return cacher, destroyFunc, nil
|
return cacher, destroyFunc, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -98,45 +93,3 @@ func objectTypeToArgs(obj runtime.Object) []interface{} {
|
||||||
// otherwise just return the type
|
// otherwise just return the type
|
||||||
return []interface{}{"type", fmt.Sprintf("%T", obj)}
|
return []interface{}{"type", fmt.Sprintf("%T", obj)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : Remove all the code below when PR
|
|
||||||
// https://github.com/kubernetes/kubernetes/pull/50690
|
|
||||||
// merges as that shuts down storage properly
|
|
||||||
// HACK ALERT : Track the destroy methods to call them
|
|
||||||
// from the test harness. TrackStorageCleanup will be called
|
|
||||||
// only from the test harness, so Register/Cleanup will be
|
|
||||||
// no-op at runtime.
|
|
||||||
|
|
||||||
var cleanupLock sync.Mutex
|
|
||||||
var cleanup []func() = nil
|
|
||||||
|
|
||||||
func TrackStorageCleanup() {
|
|
||||||
cleanupLock.Lock()
|
|
||||||
defer cleanupLock.Unlock()
|
|
||||||
|
|
||||||
if cleanup != nil {
|
|
||||||
panic("Conflicting storage tracking")
|
|
||||||
}
|
|
||||||
cleanup = make([]func(), 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterStorageCleanup(fn func()) {
|
|
||||||
cleanupLock.Lock()
|
|
||||||
defer cleanupLock.Unlock()
|
|
||||||
|
|
||||||
if cleanup == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
cleanup = append(cleanup, fn)
|
|
||||||
}
|
|
||||||
|
|
||||||
func CleanupStorage() {
|
|
||||||
cleanupLock.Lock()
|
|
||||||
old := cleanup
|
|
||||||
cleanup = nil
|
|
||||||
cleanupLock.Unlock()
|
|
||||||
|
|
||||||
for _, d := range old {
|
|
||||||
d()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue