From de06486124d1449c82bd681509a18df27cb23f54 Mon Sep 17 00:00:00 2001 From: Lan Liang Date: Tue, 4 Oct 2022 11:01:00 +0800 Subject: [PATCH] Use error message of failed to find a healthy node for karmada-etcd for can not found note to scheduled etcd Signed-off-by: Lan Liang --- pkg/karmadactl/cmdinit/kubernetes/node.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/karmadactl/cmdinit/kubernetes/node.go b/pkg/karmadactl/cmdinit/kubernetes/node.go index ccfa4fd39..c91dca043 100644 --- a/pkg/karmadactl/cmdinit/kubernetes/node.go +++ b/pkg/karmadactl/cmdinit/kubernetes/node.go @@ -3,6 +3,7 @@ package kubernetes import ( "context" "encoding/json" + "errors" "fmt" "strings" @@ -108,6 +109,10 @@ func (i *CommandInitOption) AddNodeSelectorLabels() error { } } + if etcdSelectorLabels == nil { + return errors.New("failed to find a healthy node for karmada-etcd") + } + etcdSelectorLabels["karmada.io/etcd"] = "" patchData := map[string]interface{}{"metadata": map[string]map[string]string{"labels": etcdSelectorLabels}} playLoadBytes, _ := json.Marshal(patchData)