Documentation
¶
Index ¶
- func NewCommandExecutor(cli client.Client, clientSet kubernetes.Interface, ...) *defaultCommandExecutor
- func NewExecPod(client client.Client, executor commandExecutor, factoryMode PodVolumeMode, ...) (*execPod, error)
- func NewExecPodFactory(client client.Client, config *rest.Config, executor commandExecutor) *defaultExecPodFactory
- func NewPodFileExtractor(k8sClient client.Client, restConfig *rest.Config, ...) *podFileExtractor
- type CommandExecutor
- type ExecPod
- type ExecPodMock
- type PodStatus
- type PodVolumeMode
- type ShellCommand
- type SuffixGenerator
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, factoryMode PodVolumeMode, doguResource *k8sv1.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.
Types ¶
type CommandExecutor ¶
CommandExecutor is an autogenerated mock type for the CommandExecutor type
func NewCommandExecutorMock ¶
func NewCommandExecutorMock(t mockConstructorTestingTNewCommandExecutor) *CommandExecutor
NewCommandExecutor creates a new instance of CommandExecutor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*CommandExecutor) ExecCommandForDogu ¶
func (_m *CommandExecutor) ExecCommandForDogu(ctx context.Context, resource *v1.Dogu, command *ShellCommand, expectedStatus PodStatus) (*bytes.Buffer, error)
ExecCommandForDogu provides a mock function with given fields: ctx, resource, command, expectedStatus
func (*CommandExecutor) ExecCommandForPod ¶
func (_m *CommandExecutor) ExecCommandForPod(ctx context.Context, pod *corev1.Pod, command *ShellCommand, expectedStatus PodStatus) (*bytes.Buffer, error)
ExecCommandForPod provides a mock function with given fields: ctx, pod, command, expectedStatus
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 string, err error)
}
ExecPod provides methods for instantiating and removing an intermediate pod based on a Dogu container image.
type ExecPodMock ¶
ExecPodMock is an autogenerated mock type for the ExecPod type
func NewExecPodMock ¶
func NewExecPodMock(t mockConstructorTestingTNewExecPod) *ExecPodMock
NewExecPod creates a new instance of ExecPod. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*ExecPodMock) Create ¶
func (_m *ExecPodMock) Create(ctx context.Context) error
Create provides a mock function with given fields: ctx
func (*ExecPodMock) Delete ¶
func (_m *ExecPodMock) Delete(ctx context.Context) error
Delete provides a mock function with given fields: ctx
func (*ExecPodMock) Exec ¶
func (_m *ExecPodMock) Exec(ctx context.Context, cmd *ShellCommand) (string, error)
Exec provides a mock function with given fields: ctx, cmd
func (*ExecPodMock) ObjectKey ¶
func (_m *ExecPodMock) ObjectKey() *types.NamespacedName
ObjectKey provides a mock function with given fields:
func (*ExecPodMock) PodName ¶
func (_m *ExecPodMock) PodName() string
PodName provides a mock function with given fields:
type PodVolumeMode ¶
type PodVolumeMode int
PodVolumeMode indicates whether to mount a dogu's PVC (which only makes sense when the dogu was already installed).
const ( // PodVolumeModeInstall indicates to not mount a dogu's PVC. PodVolumeModeInstall PodVolumeMode = iota // PodVolumeModeUpgrade indicates to mount a dogu's PVC. PodVolumeModeUpgrade )
type ShellCommand ¶
type ShellCommand struct {
// Command states the actual executable that is supposed to be executed in the container.
Command string
// Args contains any parameters, switches etc. that the command needs to run properly.
Args []string
}
ShellCommand represents all necessary arguments to execute a command inside a container.
func NewShellCommand ¶
func NewShellCommand(command string, args ...string) *ShellCommand
NewShellCommand creates a new ShellCommand. While the command is mandatory, there can be zero to n command arguments.
func (*ShellCommand) String ¶
func (sc *ShellCommand) String() string
type SuffixGenerator ¶
SuffixGenerator is an autogenerated mock type for the SuffixGenerator type
func NewSuffixGeneratorMock ¶
func NewSuffixGeneratorMock(t mockConstructorTestingTNewSuffixGenerator) *SuffixGenerator
NewSuffixGenerator creates a new instance of SuffixGenerator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*SuffixGenerator) String ¶
func (_m *SuffixGenerator) String(length int) string
String provides a mock function with given fields: length