internal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidParams     = errors.New("[err] invalid params")
	ErrInvalidFileFormat = errors.New("[err] invalid file format")
	ErrNotFoundPath      = errors.New("[err] not found path")
	ErrUnknownValue      = errors.New("[err] unknown value")
	ErrNotFoundContext   = errors.New("[err] not found context")
)

Functions

func InterfaceToMap added in v0.1.9

func InterfaceToMap(m interface{}) (map[string]string, error)

InterfaceToMap converts interface{} type to map[string]string

func InterfaceToString

func InterfaceToString(i interface{}) (string, error)

InterfaceToString converts a value having interface type to string

func KubeConfigPath

func KubeConfigPath() (string, error)

KubeConfigPath returns a config path for kubernetes.

func PanicWithRed

func PanicWithRed(err error)

PanicWithRed is to print error message with red color and to exit process.

Types

type KubeClient

type KubeClient struct {
	*kubernetes.Clientset
}

func NewKubeClient

func NewKubeClient(kubecfg *KubeConfig) (*KubeClient, error)

NewKubeClient(

type KubeConfig

type KubeConfig struct {
	// contains filtered or unexported fields
}

KubeConfig is a struct for kubernetes config file.

func NewKubeConfig

func NewKubeConfig(path string) (*KubeConfig, error)

NewKubeConfig returns struct for kubernetes config file.

func (*KubeConfig) ChangeContextName

func (k *KubeConfig) ChangeContextName(ctxName, changedCtxName string) error

ChangeContextName changes context name in context section.

func (*KubeConfig) DeleteContext added in v0.2.0

func (k *KubeConfig) DeleteContext(ctxName string) error

DeleteContext deletes context.

func (*KubeConfig) GetContexts

func (k *KubeConfig) GetContexts() ([]*KubeContext, error)

GetContexts returns kubernetes context list.

func (*KubeConfig) GetCurrentContext

func (k *KubeConfig) GetCurrentContext() (*KubeContext, error)

GetCurrentContext returns current context.

func (*KubeConfig) RawBytes

func (k *KubeConfig) RawBytes() ([]byte, error)

RawBytes returns kubernetes config raw bytes.

func (*KubeConfig) SetCurrentContext

func (k *KubeConfig) SetCurrentContext(ctxName string) error

SetCurrentContext sets current context by passing param.

func (*KubeConfig) SetNamespace

func (k *KubeConfig) SetNamespace(ctxName, namespace string) error

SetNamespace sets namespace in context.

func (*KubeConfig) Sync

func (k *KubeConfig) Sync() error

Sync syncs rootNode to file.

type KubeContext

type KubeContext struct {
	Name      string
	User      string
	Cluster   string
	Namespace string
	Server    string
}

KubeContext is a struct for kubernetes context.

func (*KubeContext) GetNamespace

func (k *KubeContext) GetNamespace() string

GetNamespace returns namespace

Jump to

Keyboard shortcuts

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