Skip to content

Commit

Permalink
Fix up comments and errors around CRD issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ozdanborne committed Aug 22, 2017
1 parent 25a8c37 commit 09904c3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/backend/k8s/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 09904c3

Please sign in to comment.