import ( "github.com/openshift/origin/pkg/cmd/util/clientcmd" "k8s.io/client-go/tools/clientcmd/api" ) // create factory object factory := clientcmd.NewFactory() // get the current context's configuration config, err := factory.ClientConfig() if err != nil { panic(err) } // create a kubernetes config object kubernetesConfig := api.NewConfig() kubernetesConfig.Clusters["my-cluster"] = &api.Cluster{ Server: config.Host, CertificateAuthorityData: config.TLSClientConfig.CAData, } kubernetesConfig.AuthInfos["my-user"] = &api.AuthInfo{ Token: config.BearerToken, } kubernetesConfig.Contexts["my-context"] = &api.Context{ Cluster: "my-cluster", AuthInfo: "my-user", Namespace: "default", } // use the kubernetes config object to create a clientset object clientset, err := kubernetes.NewForConfig(kubernetesConfig) if err != nil { panic(err) } // use the clientset object to execute kubernetes commands pods, err := clientset.CoreV1().Pods("default").List(context.Background(), metav1.ListOptions{}) if err != nil { panic(err) } // do something with the pod list fmt.Printf("Found %d pods\n", len(pods.Items))In this example, we create a factory object and use it to get the current cluster and user information. We then use this information to create a `kubernetes.Config` object and a `kubernetes.Clientset` object, which we can use to execute kubernetes commands. Overall, the `github.com.openshift.origin.pkg.cmd.util.clientcmd` package library provides utilities for creating and configuring client objects used by the OpenShift CLI.