use new cohabitatingResources map for each backup

Signed-off-by: Steve Kriss <steve@heptio.com>
pull/485/head
Steve Kriss 2018-05-11 16:29:15 -07:00
parent 5bfd4f64db
commit ed7fbc9178
2 changed files with 10 additions and 8 deletions

View File

@ -73,12 +73,14 @@ func (i *itemKey) String() string {
return fmt.Sprintf("resource=%s,namespace=%s,name=%s", i.resource, i.namespace, i.name)
}
var cohabitatingResources = map[string]*cohabitatingResource{
"deployments": newCohabitatingResource("deployments", "extensions", "apps"),
"daemonsets": newCohabitatingResource("daemonsets", "extensions", "apps"),
"replicasets": newCohabitatingResource("replicasets", "extensions", "apps"),
"networkpolicies": newCohabitatingResource("networkpolicies", "extensions", "networking.k8s.io"),
"events": newCohabitatingResource("events", "", "events.k8s.io"),
func cohabitatingResources() map[string]*cohabitatingResource {
return map[string]*cohabitatingResource{
"deployments": newCohabitatingResource("deployments", "extensions", "apps"),
"daemonsets": newCohabitatingResource("daemonsets", "extensions", "apps"),
"replicasets": newCohabitatingResource("replicasets", "extensions", "apps"),
"networkpolicies": newCohabitatingResource("networkpolicies", "extensions", "networking.k8s.io"),
"events": newCohabitatingResource("events", "", "events.k8s.io"),
}
}
// NewKubernetesBackupper creates a new kubernetesBackupper.
@ -252,7 +254,7 @@ func (kb *kubernetesBackupper) Backup(backup *api.Backup, backupFile, logFile io
kb.dynamicFactory,
kb.discoveryHelper,
backedUpItems,
cohabitatingResources,
cohabitatingResources(),
resolvedActions,
kb.podCommandExecutor,
tw,

View File

@ -533,7 +533,7 @@ func TestBackup(t *testing.T) {
dynamicFactory,
discoveryHelper,
map[itemKey]struct{}{}, // backedUpItems
cohabitatingResources,
cohabitatingResources(),
mock.Anything,
kb.podCommandExecutor,
mock.Anything, // tarWriter