Documentation ¶
Index ¶
- Constants
- func ExecContainer(ctx context.Context, opts ExecOptions, ...) (int, error)
- func SyncExec(ctx context.Context, coreClient corev1client.CoreV1Interface, ...) (int, string, string, error)
- type ExecOptions
- type JSONPatchOperation
- type StreamOptions
- type SyncExecutor
- type SyncExecutorInterface
Constants ¶
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 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.