k8s

package
v0.28.6 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// JSONPatchOpAdd constant op "add"
	JSONPatchOpAdd = "add"
	// JSONPatchOpRemove constant op "remove"
	JSONPatchOpRemove = "remove"
	// JSONPatchOpReplace constant op "replace"
	JSONPatchOpReplace = "replace"
)

Variables

This section is empty.

Functions

func ExecContainer

func ExecContainer(ctx context.Context, opts ExecOptions, terminalSizeQueue remotecommand.TerminalSizeQueue) (int, error)

ExecContainer executes a remote execution against a pod. Returns exit code and error. The error will be non-nil if exit code is not 0.

func SyncExec

func SyncExec(ctx context.Context, coreClient corev1client.CoreV1Interface, clientConfig *restclient.Config, ns, pod, container string, command ...string) (int, string, string, error)

SyncExec returns exitcode, stdout, stderr. A non-zero exit code from the command is not considered an error.

Types

type ExecOptions

type ExecOptions struct {
	StreamOptions

	Command []string

	CoreClient corev1client.CoreV1Interface
	Config     *restclient.Config
}

type JSONPatchOperation added in v0.26.0

type JSONPatchOperation struct {
	Op    string      `json:"op"`
	Path  string      `json:"path"`
	Value interface{} `json:"value,omitempty"`
}

JSONPatchOperation specifies a single JSON patch operation.

type StreamOptions

type StreamOptions struct {
	Namespace     string
	PodName       string
	ContainerName string
	TTY           bool
	In            io.Reader
	Out           io.Writer
	Err           io.Writer
}

type SyncExecutor added in v0.26.0

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

SyncExecutor is a wrapper around k8s.io/client-go/util/exec that provides an interface for executing synchronous commands in a container.

func NewSyncExecutor added in v0.26.0

func NewSyncExecutor(coreClient corev1client.CoreV1Interface, restConfig *restclient.Config) *SyncExecutor

NewSyncExecutor returns a new SyncExecutor for executing commands in a container.

func (*SyncExecutor) ExecContainer added in v0.26.0

func (e *SyncExecutor) ExecContainer(ctx context.Context, namespace, pod, container string, command ...string) (exitCode int, stdout string, stderr string, err error)

ExecContainer executes a remote execution against a pod. Returns exit code, standard out and standard error strings and an error. A non-zero exit code from the command is not considered an error.

type SyncExecutorInterface added in v0.26.0

type SyncExecutorInterface interface {
	ExecContainer(ctx context.Context, namespace, pod, container string, command ...string) (exitCode int, stdout string, stderr string, err error)
}

SyncExecutorInterface is an interface for executing synchronous commands in a container.

Directories

Path Synopsis
Package mock_k8s is a generated GoMock package.
Package mock_k8s is a generated GoMock package.

Jump to

Keyboard shortcuts

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