mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-27 10:24:57 +00:00
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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user