From 8c0db38421642c46e96253646e1e215ffa27b89f Mon Sep 17 00:00:00 2001 From: Hongchao Deng Date: Mon, 3 Oct 2016 14:47:19 -0700 Subject: [PATCH] disaster recovery: return error if no backup policy --- pkg/cluster/reconcile.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/cluster/reconcile.go b/pkg/cluster/reconcile.go index f8a4a47..13b74ae 100644 --- a/pkg/cluster/reconcile.go +++ b/pkg/cluster/reconcile.go @@ -162,6 +162,10 @@ func (c *Cluster) removeMember(toRemove *etcdutil.Member) error { } func (c *Cluster) disasterRecovery(left etcdutil.MemberSet) error { + if c.spec.Backup == nil { + return fmt.Errorf("fail to do disaster recovery for cluster (%s): no backup policy has been defined."+ + " (TODO: Mark cluster as dead)", c.name) + } httpClient := c.kclient.RESTClient.Client resp, err := httpClient.Get(fmt.Sprintf("http://%s/backupnow", k8sutil.MakeBackupHostPort(c.name))) if err != nil {