INNER CODE UNIT · Go

FetchAndPrint

robscott/kube-capacity · pkg/capacity/capacity.go:33

func FetchAndPrint(opts Options) {
	clientset, err := kube.NewClientSet(opts.KubeContext, opts.KubeConfig, opts.InsecureSkipTLSVerify, opts.ImpersonateUser, opts.ImpersonateGroup)
	if err != nil {
		fmt.Printf("Error connecting to Kubernetes: %v\n", err)
		os.Exit(1)
	}

	podList, nodeList := getPodsAndNodes(clientset, opts.ExcludeTainted, opts.PodLabels, opts.NodeLabels, opts.NodeTaints, opts.NamespaceLabels, opts.Namespace)
	var pmList *v1beta1.PodMetricsList
	var nmList *v1beta1.NodeMetricsList

	if opts.ShowUtil {
		mClientset, err := kube.NewMetricsClientSet(opts.KubeContext, opts.KubeConfig, opts.InsecureSkipTLSVerify)
		if err != nil {
			fmt.Printf("Error connecting to Metrics API: %v\n", err)
			os.Exit(4)
		}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…