Version: v1.12.1 Latest Latest

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

Go to latest
Published: Aug 13, 2020 License: Apache-2.0 Imports: 7 Imported by: 0




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

	// KubeConfigEnvironmentKey is the environment variable key used to
	// determine the kubernetes config
	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


This is an implementation of GetConfigFunc


type Client

type Client struct {
	IsInCluster    bool   // flag to let client point to its own cluster
	KubeConfigPath string // kubeconfig path to get kubernetes clientset
	// contains filtered or unexported fields

Client provides common kuberenetes client operations

func New

func New(opts ...OptionFunc) *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 the kubernetes config instance based on available criteria

func (*Client) ConfigForPath

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

ConfigForPath returns the kuberentes 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)

type GetConfigFunc

type GetConfigFunc func(*Client) (*rest.Config, error)

GetConfigFunc provides the abstraction to get kubernetes config from provided client instance


typed function makes it simple to mock

type OptionFunc

type OptionFunc func(*Client)

OptionFunc is a typed function that abstracts any kind of operation against the provided client instance

This is the basic building block to create functional operations against the client instance

func InCluster

func InCluster() OptionFunc

InCluster enables IsInCluster flag

func WithKubeConfigPath

func WithKubeConfigPath(kubeConfigPath string) OptionFunc

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