Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerManager ¶
type ContainerManager interface { CreateContainer(ctx context.Context, cmd []string, wfID string, action *proto.WorkflowAction, captureLogs, privileged bool) (string, error) StartContainer(ctx context.Context, id string) error WaitForContainer(ctx context.Context, id string) (proto.State, error) WaitForFailedContainer(ctx context.Context, id string, failedActionStatus chan proto.State) RemoveContainer(ctx context.Context, id string) error PullImage(ctx context.Context, image string) error }
ContainerManager manages linux containers for Tinkerbell workers.
func NewContainerManager ¶
func NewContainerManager(logger logr.Logger, cli DockerClient, registryDetails RegistryConnDetails) ContainerManager
NewContainerManager returns a new container manager.
type DockerClient ¶
type DockerClient interface { client.ImageAPIClient client.ContainerAPIClient }
DockerClient is a subset of the interfaces implemented by docker's client.Client.
type DockerLogCapturer ¶
type DockerLogCapturer struct {
// contains filtered or unexported fields
}
DockerLogCapturer is a LogCapturer that can stream docker container logs to an io.Writer.
func NewDockerLogCapturer ¶
func NewDockerLogCapturer(cli client.ContainerAPIClient, logger logr.Logger, writer io.Writer) *DockerLogCapturer
NewDockerLogCapturer returns a LogCapturer that can stream container logs to a given writer.
func (*DockerLogCapturer) CaptureLogs ¶
func (l *DockerLogCapturer) CaptureLogs(ctx context.Context, id string)
CaptureLogs streams container logs to the capturer's writer.
type ImagePullStatus ¶
type ImagePullStatus struct { Status string `json:"status"` Error string `json:"error"` Progress string `json:"progress"` ProgressDetail struct { Current int `json:"current"` Total int `json:"total"` } `json:"progressDetail"` }
ImagePullStatus is the status of the downloaded Image chunk.
type LogCapturer ¶
LogCapturer emits container logs.
type Option ¶
type Option func(*Worker)
Option is a type for modifying a worker.
func WithDataDir ¶
WithDataDir changes the default directory for a worker.
func WithLogCapture ¶
WithLogCapture enables capture of container logs.
func WithMaxFileSize ¶
WithMaxFileSize changes the max file size for a worker.
func WithPrivileged ¶
WithPrivileged enables containers to be privileged.
type RegistryConnDetails ¶
RegistryConnDetails are the connection details for accessing a Docker registry.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker details provide all the context needed to run workflows.
func NewWorker ¶
func NewWorker( workerID string, tinkClient proto.WorkflowServiceClient, containerManager ContainerManager, logCapturer LogCapturer, logger logr.Logger, opts ...Option, ) *Worker
NewWorker creates a new Worker, creating a new Docker registry client.