add replicasets and daemonsets to cohabitating resources

Signed-off-by: Steve Kriss <steve@heptio.com>
pull/482/head
Steve Kriss 2018-05-10 14:12:24 -07:00
parent 9fc1711d45
commit fbb5ead4e9
2 changed files with 8 additions and 12 deletions

View File

@ -73,6 +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"),
}
// NewKubernetesBackupper creates a new kubernetesBackupper.
func NewKubernetesBackupper(
discoveryHelper discovery.Helper,
@ -230,12 +238,6 @@ func (kb *kubernetesBackupper) Backup(backup *api.Backup, backupFile, logFile io
backedUpItems := make(map[itemKey]struct{})
var errs []error
cohabitatingResources := map[string]*cohabitatingResource{
"deployments": newCohabitatingResource("deployments", "extensions", "apps"),
"networkpolicies": newCohabitatingResource("networkpolicies", "extensions", "networking.k8s.io"),
"events": newCohabitatingResource("events", "", "events.k8s.io"),
}
resolvedActions, err := resolveActions(actions, kb.discoveryHelper)
if err != nil {
return err

View File

@ -524,12 +524,6 @@ func TestBackup(t *testing.T) {
groupBackupper := &mockGroupBackupper{}
defer groupBackupper.AssertExpectations(t)
cohabitatingResources := map[string]*cohabitatingResource{
"deployments": newCohabitatingResource("deployments", "extensions", "apps"),
"networkpolicies": newCohabitatingResource("networkpolicies", "extensions", "networking.k8s.io"),
"events": newCohabitatingResource("events", "", "events.k8s.io"),
}
groupBackupperFactory.On("newGroupBackupper",
mock.Anything, // log
test.backup,