func (o OpenshiftClient) GetNetNamespace(nsName string) (*networkoapi.NetNamespace, error) {
	return o.networkClient.NetNamespaces().Get(nsName, metav1.GetOptions{})
}
GetNetNamespace - Get Net Namespace.
package clients
import (
	"errors"
	"fmt"
	authoapi "github.com/openshift/api/authorization/v1"
	"github.com/openshift/api/image/v1"
	networkoapi "github.com/openshift/api/network/v1"
	authv1 "github.com/openshift/client-go/authorization/clientset/versioned/typed/authorization/v1"
	imagev1 "github.com/openshift/client-go/image/clientset/versioned/typed/image/v1"
	networkv1 "github.com/openshift/client-go/network/clientset/versioned/typed/network/v1"
	routev1 "github.com/openshift/client-go/route/clientset/versioned/typed/route/v1"
	log "github.com/sirupsen/logrus"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/rest"
	"k8s.io/client-go/util/homedir"
)
const (
	ChangePodNetworkAnnotation = "pod.network.openshift.io/multitenant.change-network"
)
type OpenshiftClient struct {
	authClient    authv1.AuthorizationV1Interface
	imageClient   imagev1.ImageV1Interface
	networkClient networkv1.NetworkV1Interface
	routeClient   routev1.RouteV1Interface
}
func Openshift() (*OpenshiftClient, error) {
	errMsg := "Something went wrong while initializing openshift client!\n"
	once.Openshift.Do(func() {
		client, err := newOpenshift()
		if err != nil {
			log.Error(errMsg)
			panic(err.Error())
		}
		instances.Openshift = client
	})
	if instances.Openshift == nil {
		return nil, errors.New("OpenShift client instance is nil")
	}
	return instances.Openshift, nil
}
func newOpenshift() (*OpenshiftClient, error) {
	clientConfig, err := rest.InClusterConfig()
	if err != nil {
		log.Debug("Checking for a local Cluster Config")
		clientConfig, err = createClientConfigFromFile(homedir.HomeDir() + "/.kube/config")
		if err != nil {
			log.Error("Failed to create LocalClientSet")
			return nil, err
		}
	}
	clientset, err := newForConfig(clientConfig)
	if err != nil {
		log.Error("Failed to create LocalClientSet")
		return nil, err
	}
	return clientset, err
}
func newForConfig(c *rest.Config) (*OpenshiftClient, error) {
	authClient, err := authv1.NewForConfig(c)
	if err != nil {
		return nil, err
	}
	imageClient, err := imagev1.NewForConfig(c)
	if err != nil {
		return nil, err
	}
	networkClient, err := networkv1.NewForConfig(c)
	if err != nil {
		return nil, err
	}
	routeClient, err := routev1.NewForConfig(c)
	if err != nil {
		return nil, err
	}
	return &OpenshiftClient{authClient: authClient, imageClient: imageClient, networkClient: networkClient, routeClient: routeClient}, nil
}
func (o OpenshiftClient) SubjectRulesReview(user string, groups []string,
	scopes []string, namespace string) (result []authoapi.PolicyRule, err error) {
	body := authoapi.SubjectRulesReview{
		Spec: authoapi.SubjectRulesReviewSpec{
			User:   user,
			Groups: groups,
			Scopes: scopes,
		},
	}
	r, err := o.authClient.SubjectRulesReviews(namespace).Create(&body)
	if err != nil {
		return nil, err
	}
	return r.Status.Rules, nil
}
func (o OpenshiftClient) ListRegistryImages() (*v1.ImageList, error) {
	return o.imageClient.Images().List(metav1.ListOptions{})
}
func (o OpenshiftClient) GetClusterNetworkPlugin() (string, error) {
	net, err := o.networkClient.ClusterNetworks().Get(networkoapi.ClusterNetworkDefault, metav1.GetOptions{})
	if err != nil {
		return "", err
	}
	return net.PluginName, nil
}