client

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

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"
)

Variables

This section is empty.

Functions

func GetConfig

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

GetConfig returns Kubernetes config instance from the provided client

Types

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

NOTE:

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL