import ( "github.com/openshift/origin/pkg/client" ) ... func main() { config, err := client.ConfigFromKubeconfig() if err != nil { panic(err) } c, err := client.New(config) if err != nil { panic(err) } ... }
import ( "github.com/openshift/origin/pkg/client" "github.com/openshift/origin/pkg/client/projectclient" ) ... func main() { config, err := client.ConfigFromKubeconfig() if err != nil { panic(err) } c, err := client.New(config) if err != nil { panic(err) } p, err := projectclient.New(c) if err != nil { panic(err) } projects, err := p.List() if err != nil { panic(err) } for _, project := range projects.Items { fmt.Printf("%s\n", project.ObjectMeta.Name) } }In both examples, we can see that the package being used is `github.com.openshift.origin.pkg.client`. The Interface package within this library provides an abstraction layer for interacting with different OpenShift resources such as projects, pods, services, etc. By using this interface, developers can avoid having to directly interact with the Kubernetes API and can focus on writing code that is specific to OpenShift.