util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CfgFile string
	WorkDir string
)

Functions

func CheckDockerDaemon

func CheckDockerDaemon() error

CheckDockerDaemon checks if docker daemon is running.

func ExecuteCommand

func ExecuteCommand(cmd string) (stdout, stderr string, err error)

ExecuteCommand executes the given command and returns the result.

func ExpandFilePath

func ExpandFilePath(path string) string

ExpandFilePath expands the leading `~` to absolute path

func GetManifests

func GetManifests(manifests string) (files []string, err error)

GetManifests recursively gets all yml and yaml files from manifests string.

func OperateManifest

func OperateManifest(c *kubernetes.Clientset, dc dynamic.Interface, manifest string, operation apiv1.Operation) error

OperateManifest operates manifest in k8s cluster which kind created.

func PathExist

func PathExist(_path string) bool

PathExist checks if a file/directory is exist.

func ReadFileContent

func ReadFileContent(filename string) (string, error)

ReadFileContent reads the file content.

func ResolveAbs

func ResolveAbs(p string) string

ResolveAbs resolves the relative path (relative to CfgFile) to an absolute file path.

func UserHomeDir

func UserHomeDir() string

UserHomeDir returns the current user's home directory absolute path, which is usually represented as `~` in most shells

Types

type HookScriptTemplate

type HookScriptTemplate struct {
	EnvFile string
}

type K8sClusterInfo

type K8sClusterInfo struct {
	Client    *kubernetes.Clientset
	Interface dynamic.Interface
}

K8sClusterInfo created when connect to cluster

func ConnectToK8sCluster

func ConnectToK8sCluster(kubeConfigPath string) (info *K8sClusterInfo, err error)

ConnectToK8sCluster gets clientSet and dynamic client from k8s config file.

type SimpleRESTClientGetter

type SimpleRESTClientGetter struct {
	Namespace  string
	KubeConfig string
}

SimpleRESTClientGetter implements genericclioptions.RESTClientGetter, so that we can use kubectl's functions just by passing kubeConfig and namespace.

func NewSimpleRESTClientGetter

func NewSimpleRESTClientGetter(namespace, kubeConfig string) *SimpleRESTClientGetter

func (*SimpleRESTClientGetter) ToDiscoveryClient

func (*SimpleRESTClientGetter) ToRESTConfig

func (c *SimpleRESTClientGetter) ToRESTConfig() (*rest.Config, error)

func (*SimpleRESTClientGetter) ToRESTMapper

func (c *SimpleRESTClientGetter) ToRESTMapper() (meta.RESTMapper, error)

func (*SimpleRESTClientGetter) ToRawKubeConfigLoader

func (c *SimpleRESTClientGetter) ToRawKubeConfigLoader() clientcmd.ClientConfig

type WaitSet

type WaitSet struct {
	WaitGroup  sync.WaitGroup
	ErrChan    chan error
	FinishChan chan bool
	Timeout    time.Duration
}

func NewWaitSet

func NewWaitSet(timeout time.Duration) *WaitSet

Jump to

Keyboard shortcuts

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