Excluding nodes and endpoints from restoration

- Introduced a blacklist of resources that are non-restorable.  The
goal being that the backup can still include these resources for
logging/auditing purposes but they are explicitly added to
ExcludedResources in the RestorController's "defaulting" logic
to ensure that if someone were to explicitly ask for nodes
that they would be expressly denied.

Signed-off-by: Justin Nauman <justin.r.nauman@gmail.com>
This commit is contained in:
Justin Nauman
2017-10-05 22:37:29 -05:00
parent 87f60ed853
commit 1fd1e8deaa
2 changed files with 35 additions and 0 deletions
+16
View File
@@ -259,6 +259,18 @@ func TestProcessRestore(t *testing.T) {
Restore,
},
},
{
name: "restoration of nodes is not supported",
restore: NewRestore("foo", "bar", "backup-1", "ns-1", "nodes", api.RestorePhaseNew).Restore,
backup: NewTestBackup().WithName("backup-1").Backup,
expectedErr: false,
expectedRestoreUpdates: []*api.Restore{
NewRestore("foo", "bar", "backup-1", "ns-1", "nodes", api.RestorePhaseFailedValidation).
WithValidationError("nodes are a non-restorable resource").
WithValidationError("Invalid included/excluded resource lists: excludes list cannot contain an item in the includes list: nodes").
Restore,
},
},
}
for _, test := range tests {
@@ -382,6 +394,10 @@ func NewRestore(ns, name, backup, includeNS, includeResource string, phase api.R
restore = restore.WithIncludedResource(includeResource)
}
for _, n := range nonRestorableResources {
restore.WithExcludedResource(n)
}
return restore
}