From 59b99dde22337e69900539da0fe6d96edc33685b Mon Sep 17 00:00:00 2001 From: Steve Kriss Date: Thu, 28 Jun 2018 13:40:02 -0700 Subject: [PATCH 1/2] add FAQ about using a bucket per cluster Signed-off-by: Steve Kriss --- docs/faq.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/faq.md b/docs/faq.md index b946652f8..508dd2092 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -23,3 +23,16 @@ Examples of cases where Ark is useful: Yes, with some exceptions. For example, when Ark restores pods it deletes the `nodeName` from the pod so that it can be scheduled onto a new node. You can see some more examples of the differences in [pod_action.go](https://github.com/heptio/ark/blob/master/pkg/restore/pod_action.go) + +## I'm using Ark in multiple clusters. Should I use the same bucket to store all of my backups? + +We **strongly** recommend that you use a separate bucket per cluster to store backups. Sharing a bucket +across multiple Ark instances can lead to numerous problems - failed backups, overwritten backups, +inadvertently deleted backups, etc., all of which can be avoided by using a separate bucket per Ark +instance. + +Related to this, if you need to restore a backup from cluster A into cluster B, please use [restore-only][1] +mode in cluster B's Ark instance while it's configured to use cluster A's bucket. This will ensure no +new backups are created, and no existing backups are deleted or overwritten. + +[1]: config-definition.md#main-config-parameters \ No newline at end of file From a311ebdec5b8089944d99b948427c1aecf5f52a6 Mon Sep 17 00:00:00 2001 From: Andy Goldstein Date: Thu, 28 Jun 2018 16:56:39 -0400 Subject: [PATCH 2/2] Don't restore backups or restores Add backups and restores the list of non restorable resources. Backups, if applicable, are synced from object storage by the backup sync controller. Restores are specific to a cluster and don't have value moving across clusters. Signed-off-by: Andy Goldstein --- pkg/controller/restore_controller.go | 14 +++++++++++++- pkg/controller/restore_controller_test.go | 22 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/pkg/controller/restore_controller.go b/pkg/controller/restore_controller.go index f7bd3f54b..53566990e 100644 --- a/pkg/controller/restore_controller.go +++ b/pkg/controller/restore_controller.go @@ -51,7 +51,19 @@ import ( // nonRestorableResources is a blacklist for the restoration process. Any resources // included here are explicitly excluded from the restoration process. -var nonRestorableResources = []string{"nodes", "events", "events.events.k8s.io"} +var nonRestorableResources = []string{ + "nodes", + "events", + "events.events.k8s.io", + + // Don't ever restore backups - if appropriate, they'll be synced in from object storage. + // https://github.com/heptio/ark/issues/622 + "backups.ark.heptio.com", + + // Restores are cluster-specific, and don't have value moving across clusters. + // https://github.com/heptio/ark/issues/622 + "restores.ark.heptio.com", +} type restoreController struct { namespace string diff --git a/pkg/controller/restore_controller_test.go b/pkg/controller/restore_controller_test.go index 97c253c56..fd6c0923a 100644 --- a/pkg/controller/restore_controller_test.go +++ b/pkg/controller/restore_controller_test.go @@ -255,6 +255,28 @@ func TestProcessRestore(t *testing.T) { "Invalid included/excluded resource lists: excludes list cannot contain an item in the includes list: events.events.k8s.io", }, }, + { + name: "restoration of backups.ark.heptio.com is not supported", + restore: NewRestore("foo", "bar", "backup-1", "ns-1", "backups.ark.heptio.com", api.RestorePhaseNew).Restore, + backup: arktest.NewTestBackup().WithName("backup-1").Backup, + expectedErr: false, + expectedPhase: string(api.RestorePhaseFailedValidation), + expectedValidationErrors: []string{ + "backups.ark.heptio.com are non-restorable resources", + "Invalid included/excluded resource lists: excludes list cannot contain an item in the includes list: backups.ark.heptio.com", + }, + }, + { + name: "restoration of restores.ark.heptio.com is not supported", + restore: NewRestore("foo", "bar", "backup-1", "ns-1", "restores.ark.heptio.com", api.RestorePhaseNew).Restore, + backup: arktest.NewTestBackup().WithName("backup-1").Backup, + expectedErr: false, + expectedPhase: string(api.RestorePhaseFailedValidation), + expectedValidationErrors: []string{ + "restores.ark.heptio.com are non-restorable resources", + "Invalid included/excluded resource lists: excludes list cannot contain an item in the includes list: restores.ark.heptio.com", + }, + }, } for _, test := range tests {