Version: v1.12.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 8 Imported by: 3




View Source
const (
	// K8sMasterIPEnvironmentKey is the environment variable
	// key to provide kubernetes master IP address
	K8sMasterIPEnvironmentKey env.ENVKey = "OPENEBS_IO_K8S_MASTER"

	// KubeConfigEnvironmentKey is the environment variable
	// key to provide kubeconfig path
	KubeConfigEnvironmentKey env.ENVKey = "OPENEBS_IO_KUBE_CONFIG"


This section is empty.


func GetConfig

func GetConfig(c *Client) (*rest.Config, error)

GetConfig returns Kubernetes config instance from the provided client


type Client

type Client struct {
	// IsInCluster flags if this client points
	// to its own cluster
	IsInCluster bool

	// KubeConfigPath to get kubernetes clientset
	KubeConfigPath string
	// contains filtered or unexported fields

Client provides Kubernetes client operations

func Instance

func Instance(opts ...OptionFn) *Client

Instance returns a singleton instance of this client

func New

func New(opts ...OptionFn) *Client

New returns a new instance of client

func (*Client) Clientset

func (c *Client) Clientset() (*kubernetes.Clientset, error)

Clientset returns a new instance of Kubernetes clientset

func (*Client) Config

func (c *Client) Config() (config *rest.Config, err error)

Config returns Kubernetes config instance based on set criteria

func (*Client) ConfigForPath

func (c *Client) ConfigForPath(kubeConfigPath string) (config *rest.Config, err error)

ConfigForPath returns Kubernetes config instance based on KubeConfig path

func (*Client) Dynamic

func (c *Client) Dynamic() (dynamic.Interface, error)

Dynamic returns a kubernetes dynamic client capable of invoking operations against kubernetes resources

func (*Client) GetConfigForPathOrDirect

func (c *Client) GetConfigForPathOrDirect() (config *rest.Config, err error)

GetConfigForPathOrDirect returns Kubernetes config instance from kubeconfig path or without it

type OptionFn

type OptionFn func(*Client)

OptionFn is a typed function to abstract any operation against the provided client instance


This is the basic building block to create

functional operations against the client instance

func InCluster

func InCluster() OptionFn

InCluster enables IsInCluster flag

func WithKubeConfigPath

func WithKubeConfigPath(kubeConfigPath string) OptionFn

WithKubeConfigPath sets kubeconfig path against this client instance

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL