Documentation
¶
Index ¶
- type ContainerImpl
- type ContainerOpts
- type DockerClient
- type DockerOpts
- type DockerWrapper
- func (d *DockerWrapper) Pull(ctx context.Context, image string, opts types.ImagePullOptions) error
- func (d *DockerWrapper) Run(ctx context.Context, opts ContainerOpts) (stdout io.Reader, stderr io.Reader, err error)
- func (d *DockerWrapper) RunContainer(ctx context.Context, opts DockerOpts) (stdout io.Reader, stderr io.Reader, err error)
- type K8sOpts
- type K8sWrapper
- type KubernetesClient
- type MockDockerClient
- func (m *MockDockerClient) ContainerAttach(ctx context.Context, containerID string, options container.AttachOptions) (types.HijackedResponse, error)
- func (m *MockDockerClient) ContainerCreate(ctx context.Context, config *container.Config, ...) (container.CreateResponse, error)
- func (m *MockDockerClient) ContainerKill(ctx context.Context, containerID, signal string) error
- func (m *MockDockerClient) ContainerStart(ctx context.Context, containerID string, options container.StartOptions) error
- func (m *MockDockerClient) ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
- func (m *MockDockerClient) ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
- func (m *MockDockerClient) ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
- func (m *MockDockerClient) Ping(ctx context.Context) (types.Ping, error)
- type MockKubernetesClient
- func (m *MockKubernetesClient) CreatePod(ctx context.Context, namespace string, pod *corev1.Pod) (*corev1.Pod, error)
- func (m *MockKubernetesClient) DeletePod(ctx context.Context, namespace, podName string, opts *metav1.DeleteOptions) error
- func (m *MockKubernetesClient) GetPod(ctx context.Context, namespace, podName string) (*corev1.Pod, error)
- func (m *MockKubernetesClient) GetPodLogs(ctx context.Context, namespace, podName, containerName string, ...) (io.ReadCloser, error)
- type Volume
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerImpl ¶
type ContainerImpl interface {
Run(context.Context, ContainerOpts) (io.Reader, io.Reader, error)
Pull(context.Context, string, types.ImagePullOptions) error
}
func NewContainerImpl ¶
func NewContainerImpl(l log.Logger) (ContainerImpl, error)
type ContainerOpts ¶
type ContainerOpts struct {
Env map[string]string
LogOptions map[string]string
Namespace string
RestartPolicy corev1.RestartPolicy
PodName string
Image string
LogDriver string
Network string
ContainerName string
Volumes []Volume
Command []string
Args []string
Timeout time.Duration
AttachStdout bool
AttachStderr bool
AutoRemove bool
}
func (*ContainerOpts) String ¶
func (c *ContainerOpts) String() string
func (*ContainerOpts) ToDockerOpts ¶
func (c *ContainerOpts) ToDockerOpts() DockerOpts
func (*ContainerOpts) ToK8sOpts ¶
func (c *ContainerOpts) ToK8sOpts() K8sOpts
type DockerClient ¶
type DockerClient interface {
ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig,
networkingConfig *network.NetworkingConfig, platform *v1.Platform, containerName string) (container.CreateResponse, error)
ContainerStart(ctx context.Context, containerID string, options container.StartOptions) error
ContainerAttach(ctx context.Context, containerID string, options container.AttachOptions) (types.HijackedResponse, error)
ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
Ping(ctx context.Context) (types.Ping, error)
ContainerKill(ctx context.Context, containerID, signal string) error
}
type DockerOpts ¶
type DockerOpts struct {
RestartPolicy container.RestartPolicy
Mounts []mount.Mount
LogDriver string
LogOptions map[string]string
Image string
Network string
ContainerName string
Command []string
Env []string
Timeout time.Duration
AutoRemove bool
AttachStdout bool
AttachStderr bool
}
func (DockerOpts) String ¶
func (o DockerOpts) String() string
type DockerWrapper ¶
type DockerWrapper struct {
// contains filtered or unexported fields
}
func NewDockerWrapper ¶
func NewDockerWrapper(logger log.Logger) (*DockerWrapper, error)
func (*DockerWrapper) Pull ¶
func (d *DockerWrapper) Pull(ctx context.Context, image string, opts types.ImagePullOptions) error
func (*DockerWrapper) Run ¶
func (d *DockerWrapper) Run(ctx context.Context, opts ContainerOpts) (stdout io.Reader, stderr io.Reader, err error)
func (*DockerWrapper) RunContainer ¶
func (d *DockerWrapper) RunContainer(ctx context.Context, opts DockerOpts) (stdout io.Reader, stderr io.Reader, err error)
type K8sOpts ¶
type K8sWrapper ¶
type K8sWrapper struct {
// contains filtered or unexported fields
}
func NewK8sWrapper ¶
func NewK8sWrapper() (*K8sWrapper, error)
func NewK8sWrapperFromKubeconfig ¶
func NewK8sWrapperFromKubeconfig(kubeconfigPath string) (*K8sWrapper, error)
func (*K8sWrapper) Pull ¶
func (w *K8sWrapper) Pull(_ context.Context, _ string, _ types.ImagePullOptions) error
type KubernetesClient ¶
type KubernetesClient interface {
CreatePod(ctx context.Context, namespace string, pod *corev1.Pod) (*corev1.Pod, error)
GetPodLogs(ctx context.Context, namespace, podName, containerName string, opts *corev1.PodLogOptions) (io.ReadCloser, error)
GetPod(ctx context.Context, namespace, podName string) (*corev1.Pod, error)
DeletePod(ctx context.Context, namespace, podName string, opts *metav1.DeleteOptions) error
}
type MockDockerClient ¶
func (*MockDockerClient) ContainerAttach ¶
func (m *MockDockerClient) ContainerAttach(ctx context.Context, containerID string, options container.AttachOptions) (types.HijackedResponse, error)
func (*MockDockerClient) ContainerCreate ¶
func (m *MockDockerClient) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *v1.Platform, containerName string, ) (container.CreateResponse, error)
func (*MockDockerClient) ContainerKill ¶
func (m *MockDockerClient) ContainerKill(ctx context.Context, containerID, signal string) error
func (*MockDockerClient) ContainerStart ¶
func (m *MockDockerClient) ContainerStart(ctx context.Context, containerID string, options container.StartOptions) error
func (*MockDockerClient) ContainerWait ¶
func (m *MockDockerClient) ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
func (*MockDockerClient) ImageInspectWithRaw ¶
func (m *MockDockerClient) ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
func (*MockDockerClient) ImagePull ¶
func (m *MockDockerClient) ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
type MockKubernetesClient ¶
func (*MockKubernetesClient) DeletePod ¶
func (m *MockKubernetesClient) DeletePod(ctx context.Context, namespace, podName string, opts *metav1.DeleteOptions) error
func (*MockKubernetesClient) GetPodLogs ¶
func (m *MockKubernetesClient) GetPodLogs(ctx context.Context, namespace, podName, containerName string, opts *corev1.PodLogOptions) (io.ReadCloser, error)
Click to show internal directories.
Click to hide internal directories.