Documentation ¶
Index ¶
- func NewCommandExecutor(cli client.Client, clientSet kubernetes.Interface, ...) *defaultCommandExecutor
- func NewExecPod(client client.Client, executor CommandExecutor, doguResource *k8sv2.Dogu, ...) (*execPod, error)
- func NewExecPodFactory(client client.Client, config *rest.Config, executor CommandExecutor) *defaultExecPodFactory
- func NewPodFileExtractor(k8sClient client.Client, restConfig *rest.Config, ...) *podFileExtractor
- func NewShellCommand(command string, args ...string) *shellCommand
- func NewShellCommandWithStdin(stdin io.Reader, command string, args ...string) *shellCommand
- type CommandExecutor
- type ExecPod
- type ExecPodFactory
- type FileExtractor
- type PodStatusForExec
- type ShellCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCommandExecutor ¶
func NewCommandExecutor(cli client.Client, clientSet kubernetes.Interface, coreV1RestClient rest.Interface) *defaultCommandExecutor
NewCommandExecutor creates a new instance of NewCommandExecutor
func NewExecPod ¶
func NewExecPod( client client.Client, executor CommandExecutor, doguResource *k8sv2.Dogu, dogu *core.Dogu, podName string, ) (*execPod, error)
NewExecPod creates a new ExecPod that enables command execution towards a pod.
func NewExecPodFactory ¶
func NewExecPodFactory(client client.Client, config *rest.Config, executor CommandExecutor) *defaultExecPodFactory
NewExecPodFactory creates a new ExecPodFactory.
func NewPodFileExtractor ¶
func NewPodFileExtractor(k8sClient client.Client, restConfig *rest.Config, clientSet kubernetes.Interface) *podFileExtractor
NewPodFileExtractor creates a new pod file extractor that fetches files from a pod's container.
func NewShellCommand ¶
NewShellCommand creates a new ShellCommand. While the command is mandatory, there can be zero to n command arguments.
Types ¶
type CommandExecutor ¶
type CommandExecutor interface { // ExecCommandForDogu executes a command in a dogu. ExecCommandForDogu(ctx context.Context, resource *k8sv2.Dogu, command ShellCommand, expected PodStatusForExec) (*bytes.Buffer, error) // ExecCommandForPod executes a command in a pod that must not necessarily be a dogu. ExecCommandForPod(ctx context.Context, pod *corev1.Pod, command ShellCommand, expected PodStatusForExec) (*bytes.Buffer, error) }
CommandExecutor is used to execute commands in pods and dogus
type ExecPod ¶
type ExecPod interface { // Create adds a new exec pod to the cluster. Create(ctx context.Context) error // Delete deletes the exec pod from the cluster. Delete(ctx context.Context) error // PodName returns the name of the pod. PodName() string // ObjectKey returns the ExecPod's K8s object key. ObjectKey() *client.ObjectKey // Exec runs the provided command in this execPod Exec(ctx context.Context, cmd ShellCommand) (out *bytes.Buffer, err error) }
ExecPod provides methods for instantiating and removing an intermediate pod based on a Dogu container image.
type ExecPodFactory ¶
type ExecPodFactory interface { // NewExecPod creates a new ExecPod. NewExecPod(doguResource *k8sv2.Dogu, dogu *core.Dogu) (ExecPod, error) }
ExecPodFactory provides functionality to create ExecPods.
type FileExtractor ¶
type FileExtractor interface { // ExtractK8sResourcesFromContainer copies a file from stdout into map of strings. ExtractK8sResourcesFromContainer(ctx context.Context, k8sExecPod ExecPod) (map[string]string, error) }
FileExtractor provides functionality to get the contents of files from a container.
type PodStatusForExec ¶
type PodStatusForExec string
PodStatusForExec describes a state in the lifecycle of a pod.
const ( // ContainersStarted means that all containers of a pod were started. ContainersStarted PodStatusForExec = "started" // PodReady means that the readiness probe of the pod has succeeded. PodReady PodStatusForExec = "ready" )
type ShellCommand ¶
type ShellCommand interface { // CommandWithArgs returns the commands and its arguments in a way suitable for execution. CommandWithArgs() []string // Stdin returns the appropriate reader for standard input. Stdin() io.Reader }
ShellCommand represents a command that can be executed in the shell of a container.