code: func WaitForCluster(ctx context.Context, n *Node) (cluster *api.Cluster, err error) {
  	watch, cancel := state.Watch(n.MemoryStore().WatchQueue(), api.EventCreateCluster{})
  	defer cancel()
  
  	var clusters []*api.Cluster
  	n.MemoryStore().View(func(readTx store.ReadTx) {
  		clusters, err = store.FindClusters(readTx, store.ByName(store.DefaultClusterName))
  	})
  
  	if err != nil {
  		return nil, err
  	}
  
  	if len(clusters) == 1 {
  		cluster = clusters[0]
  	} else {
  		select {
  		case e := <-watch:
  			cluster = e.(api.EventCreateCluster).Cluster
  		case <-ctx.Done():
  			return nil, ctx.Err()
  		}
  	}
  
  	return cluster, nil
  }
docs: // WaitForCluster waits until node observes that the cluster wide config is
  // committed to raft. This ensures that we can see and serve informations
  // related to the cluster.