client

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 8 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfig

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

GetConfig returns kubernetes config instance

NOTE:

This is an implementation of GetConfigFunc

Types

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 Instance

func Instance(opts ...OptionFunc) *Client

Instance returns a singleton instance of this client

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 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 the kubernetes config instance based on direct KubeConfig

type GetConfigFunc

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

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

NOTE:

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

Jump to

Keyboard shortcuts

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