kubectl

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Credentials for creating an ImagePullSecret
	EnvDockerUsername = "M_DOCKER_USERNAME"
	EnvDockerPassword = "M_DOCKER_PASSWORD"
	EnvDockerServer   = "M_DOCKER_SERVER"
)

Variables

This section is empty.

Functions

func DockerCredentialsDefined

func DockerCredentialsDefined() bool

func DumpClusterInfo added in v1.10.3

func DumpClusterInfo(path string, namespace string)

DumpClusterInfo Executes `kubectl cluster-info dump -o yaml` on each cluster. The output is stored under <project-root>/build/test.

func GetKubeconfig

func GetKubeconfig(createDefault bool) string

func WaitForOutput

func WaitForOutput(k KCmd, expected string, seconds int) error

func WaitForOutputContains

func WaitForOutputContains(k KCmd, expected string, seconds int) error

func WaitForOutputPattern

func WaitForOutputPattern(k KCmd, pattern string, seconds int) error

func WatchPods

func WatchPods()

func WatchPodsInNs

func WatchPodsInNs(namespace string)

Types

type KCmd

type KCmd struct {
	Command string
	Args    []string
	Flags   map[string]string
}

============================================== KCmd represents an executable kubectl command ==============================================

func Annotate

func Annotate(resource string, name string, key string, value string) KCmd

func ApplyFiles

func ApplyFiles(paths ...string) KCmd

func ClusterInfoForContext

func ClusterInfoForContext(ctxt string) KCmd

func CreateFromFiles

func CreateFromFiles(paths ...string) KCmd

func CreateNamespace

func CreateNamespace(namespace string) KCmd

func CreateSecretLiteral

func CreateSecretLiteral(name string, user string, pw string) KCmd

func Delete

func Delete(args ...string) KCmd

func DeleteByTypeAndName

func DeleteByTypeAndName(resourceType string, names ...string) KCmd

func DeleteFromFiles

func DeleteFromFiles(paths ...string) KCmd

func DeleteNamespace

func DeleteNamespace(namespace string) KCmd

func Describe added in v1.17.0

func Describe(args ...string) KCmd

func DumpAllLogs

func DumpAllLogs(path string) KCmd

func DumpLogs

func DumpLogs(path string, namespace string) KCmd

func ExecOnPod

func ExecOnPod(podName string, args ...string) KCmd

func Get

func Get(args ...string) KCmd

func GetByFiles

func GetByFiles(paths ...string) KCmd

func GetByTypeAndName

func GetByTypeAndName(resourceType string, names ...string) KCmd

func GetNodeNameForPod

func GetNodeNameForPod(podName string) KCmd

func GetNodes

func GetNodes() KCmd

func Label

func Label(nodes string, key string, value string) KCmd

func Logs

func Logs(args ...string) KCmd

func Patch added in v1.9.0

func Patch(resource string, data string) KCmd

func PatchJson

func PatchJson(resource string, data string) KCmd

func PatchMerge

func PatchMerge(resource string, data string) KCmd

func Taint

func Taint(node string, key string, value string, effect string) KCmd

func (KCmd) ExecV

func (k KCmd) ExecV() error

ExecV runs KCmd via `kubectl`, where KCmd is a struct holding the kubectl command to run (not including `kubectl` itself), the args, and any flags. Returns error only (no capture of results) and also logs logs output.

func (KCmd) ExecVCapture

func (k KCmd) ExecVCapture() (string, string, error)

ExecV runs KCmd via `kubectl`, where KCmd is a struct holding the kubectl command to run (not including `kubectl` itself), the args, and any flags. Returns (stdout, stderr, error) and also logs logs output.

func (KCmd) ExecVPanic

func (k KCmd) ExecVPanic()

func (KCmd) FormatOutput

func (k KCmd) FormatOutput(outputType string) KCmd

func (KCmd) InNamespace

func (k KCmd) InNamespace(namespace string) KCmd

============================================== Helper functions to build up a KCmd object for common actions ==============================================

func (KCmd) Output

func (k KCmd) Output() (string, error)

func (KCmd) OutputPanic

func (k KCmd) OutputPanic() string

func (KCmd) ToCliArgs

func (k KCmd) ToCliArgs() []string

============================================== Execute KCmd by running kubectl ==============================================

func (KCmd) WithFlag

func (k KCmd) WithFlag(name string, value string) KCmd

func (KCmd) WithLabel

func (k KCmd) WithLabel(label string) KCmd

Jump to

Keyboard shortcuts

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