common

package
v0.0.0-...-297e449 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigToString

func ConfigToString(conf *k8s.Config) (string, error)

func CopyFile

func CopyFile(src, target string) error

CopyFile copies a file

func FileExists

func FileExists(name string) bool

FileExists reports whether the named file or directory exists.

func GetClusterByName

func GetClusterByName(config *k8s.Config, clusterName *string) (*k8s.NamedCluster, error)

GetClusterByName returns the cluster with the given name or an error

func GetContextByName

func GetContextByName(config *k8s.Config, contextName *string) (*k8s.NamedContext, error)

GetContextByName returns the first context with the given name

func GetDefaultKubeconfig

func GetDefaultKubeconfig() (*k8s.Config, error)

GetDefaultKubeconfig returns the default user kubeconfig (e.g. ~/.kube/config)

func GetDefaultKubeconfigPath

func GetDefaultKubeconfigPath() (path string, err error)

GetDefaultKubeconfigPath returns the path to the default user kubeconfig (e.g. ~/.kube/config)

func GetUserByName

func GetUserByName(config *k8s.Config, userName *string) (*k8s.NamedAuthInfo, error)

GetUserByName returns the user with the given name or an error

func IsRegularFile

func IsRegularFile(path string) bool

IsRegularFile checks whether the path is a regular file or not.

func ReadKubeConfigYaml

func ReadKubeConfigYaml(filePath string) (*k8s.Config, error)

ReadKubeConfigYaml deserializes a kubeconfig yaml file into a KubeConfig object.

func WriteKubeConfigYaml

func WriteKubeConfigYaml(target string, conf *k8s.Config)

WriteKubeConfigYaml writes a KubeConfig into a file

Types

type ContextNameProvider

type ContextNameProvider interface {
	GetName() string
}

ContextNameProvider provides a name for a context.

type RandomNameProvider

type RandomNameProvider struct{}

RandomNameProvider creates a random name with the following pattern: <adjective>-<noun> (e.g. adorable-pizza)

func (*RandomNameProvider) GetName

func (*RandomNameProvider) GetName() string

GetName method for RandomNameProvider. Creates a random name with the following pattern: <adjective>-<noun> (e.g. adorable-pizza).

type SeedNameProvider

type SeedNameProvider struct {
	//Seed - first name that will returned by GetName
	Seed string
	// contains filtered or unexported fields
}

SeedNameProvider will return the seed on first "GetName". Afterwards a suffix will be attached.

func (*SeedNameProvider) GetName

func (p *SeedNameProvider) GetName() string

GetName will return the seed on first call. Afterwards a suffix will be attached.

Jump to

Keyboard shortcuts

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