Skip to content

Commit 09904c3

Browse files
committed
Fix up comments and errors around CRD issues
1 parent 25a8c37 commit 09904c3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/backend/k8s/k8s.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,20 @@ func NewKubeClient(kc *capi.KubeConfig) (*KubeClient, error) {
142142
return kubeClient, nil
143143
}
144144

145+
// EnsureInitialized checks that the necessary custom resource definitions
146+
// exist in the backend. This usually passes when using etcd
147+
// as a backend but can often fail when using KDD as it relies
148+
// on various custom resources existing.
149+
// To ensure the datastore is initialized, this function checks that a
150+
// known custom resource is defined: GlobalFelixConfig. It accomplishes this
151+
// by trying to set the ClusterType (an instance of GlobalFelixConfig).
145152
func (c *KubeClient) EnsureInitialized() error {
146-
// Ensure ClusterType is set.
147-
log.Info("Ensuring ClusterType is set")
153+
log.Info("Ensuring datastore has been initialized.")
148154
err := c.waitForClusterType()
149155
if err != nil {
150-
return fmt.Errorf("Failed to ensure ClusterType is set: %s", err)
156+
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)
151157
}
152-
log.Info("ClusterType is set")
158+
log.Info("Confirmed datastore has been initialized.")
153159
return nil
154160
}
155161

0 commit comments

Comments
 (0)