From 09904c3edaef8e571a38cba4195d555537b8fcc2 Mon Sep 17 00:00:00 2001 From: Dan Osborne Date: Mon, 21 Aug 2017 18:22:53 -0700 Subject: [PATCH] Fix up comments and errors around CRD issues --- lib/backend/k8s/k8s.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/backend/k8s/k8s.go b/lib/backend/k8s/k8s.go index ced79b22f..d2b45dc1f 100644 --- a/lib/backend/k8s/k8s.go +++ b/lib/backend/k8s/k8s.go @@ -142,14 +142,20 @@ func NewKubeClient(kc *capi.KubeConfig) (*KubeClient, error) { return kubeClient, nil } +// EnsureInitialized checks that the necessary custom resource definitions +// exist in the backend. This usually passes when using etcd +// as a backend but can often fail when using KDD as it relies +// on various custom resources existing. +// To ensure the datastore is initialized, this function checks that a +// known custom resource is defined: GlobalFelixConfig. It accomplishes this +// by trying to set the ClusterType (an instance of GlobalFelixConfig). func (c *KubeClient) EnsureInitialized() error { - // Ensure ClusterType is set. - log.Info("Ensuring ClusterType is set") + log.Info("Ensuring datastore has been initialized.") err := c.waitForClusterType() if err != nil { - return fmt.Errorf("Failed to ensure ClusterType is set: %s", err) + return fmt.Errorf("Failed to ensure datastore has been initialized: \"%s\". Make sure the Custom Resource Definitions have been created and Calico has been authorized to access them.", err) } - log.Info("ClusterType is set") + log.Info("Confirmed datastore has been initialized.") return nil }