func nodesOverview(cfg api.Config, context string) (string, error) {
	cs, err := csForContext(cfg, context)
	if err != nil {
		return "", errors.Wrap(err, "Can't create a clientset based on config provided")
	}
	nodes, err := cs.CoreV1().Nodes().List(metav1.ListOptions{})
	nodeCount := len(nodes.Items)
	readyCount := 0
	for _, node := range nodes.Items {
		for _, nodeCondition := range node.Status.Conditions {
			if nodeCondition.Type == "Ready" {
				if nodeCondition.Status == "True" {
					readyCount++
				}
				break
			}
		}
	}
	if err != nil {
		return "", errors.Wrap(err, "Can't get nodes in cluster")
	}
	noverview := fmt.Sprintf("%v/%v", readyCount, nodeCount)
	return noverview, nil
}
nodesOverview returns the cluster's worker nodes overview in given context
package fleet
import (
	"fmt"
	"os"
	"strings"
	"text/tabwriter"
	"github.com/pkg/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/cli-runtime/pkg/genericclioptions"
	"k8s.io/client-go/tools/clientcmd/api"
)
func Overview(configFlags *genericclioptions.ConfigFlags) error {
	clientcfg := configFlags.ToRawKubeConfigLoader()
	cfg, err := clientcfg.RawConfig()
	if err != nil {
		return errors.Wrap(err, "Can't assemble raw config")
	}
	w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)
	fmt.Fprintln(w, "CLUSTER\tVERSION\tNODES\tNAMESPACES\tPROVIDER\tAPI")
	for name, context := range cfg.Contexts {
		cluster := cfg.Clusters[context.Cluster]
		clusterVersion, err := clusterVersion(cfg, name)
		if err != nil {
			clusterVersion = "?"
		}
		noinfo, err := nodesOverview(cfg, name)
		if err != nil {
			noinfo = "?"
		}
		nsinfo, err := nsOverview(cfg, name)
		if err != nil {
			nsinfo = "?"
		}
		apiServerEndpoint := "?"
		if cluster != nil {
			apiServerEndpoint = cluster.Server
		}
		provider := getProvider(cfg, name)
		fmt.Fprintln(w, fmt.Sprintf("%v\t%v\t%v\t%v\t%v\t%v", context.Cluster, clusterVersion, noinfo, nsinfo, provider, apiServerEndpoint))
	}
	w.Flush()
	return nil
}
func clusterVersion(cfg api.Config, context string) (string, error) {
	cs, err := csForContext(cfg, context)
	if err != nil {
		return "", errors.Wrap(err, "Can't create a clientset based on config provided")
	}
	cversion, err := cs.Discovery().ServerVersion()
	if err != nil {
		return "", errors.Wrap(err, "Can't get cluster server version")
	}
	return fmt.Sprintf("%s", cversion), nil
}