INNER CODE UNIT · Go

main

airwallex/k8s-pod-restart-info-collector · main.go:16

func main() {
	var kubeconfig *string
	if home := homedir.HomeDir(); home != "" {
		kubeconfig = flag.String("kubeconfig", filepath.Join(home, ".kube", "config"), "(optional) absolute path to the kubeconfig file")
	} else {
		kubeconfig = flag.String("kubeconfig", "", "absolute path to the kubeconfig file")
	}
	flag.Parse()

	// use the current context in kubeconfig
	config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)
	if err != nil {
		// use InClusterConfig
		config, err = rest.InClusterConfig()
		if err != nil {
			klog.Fatal(err)
		}
	}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…