containers

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoMappedPort = errors.New("no mapped port found")
)

Functions

This section is empty.

Types

type BuildRContainerSpec

type BuildRContainerSpec struct {
	Content       map[string]string
	ID            string
	ModuleName    string
	RepoRoot      string
	BinariesDir   string
	Image         string
	User          string
	Capabilities  Capabilities
	ExtraBinaries []string
	Mounts        []mount.Mount
	Privileged    bool
}

type Capabilities

type Capabilities struct {
	Add  []string
	Drop []string
}

type Client

type Client interface {
	Inspector
	ContainerFileCopier
}

type Container

type Container interface {
	ID() string
	NetworkID() string
	MappedPort(ctx context.Context, port nat.Port) (hostIP, hostPort string, err error)
	CopyFileFromContainer(ctx context.Context, path string, f CopyContainerFileHandler) error
	Shutdown(ctx context.Context) error
}

type ContainerFileCopier

type ContainerFileCopier interface {
	CopyFromContainer(ctx context.Context, containerID, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
}

type ContainerProber

type ContainerProber struct {
	// contains filtered or unexported fields
}

func NewContainerProbe

func NewContainerProbe(logger *slog.Logger, containerID string, probe Probe, inspector Inspector) *ContainerProber

func (*ContainerProber) WaitReady

func (p *ContainerProber) WaitReady(ctx context.Context) error

type ContainerSpec

type ContainerSpec struct {
	Env          map[string]string
	Image        string
	User         string
	WorkingDir   string
	Capabilities Capabilities
	ExposedPorts []string
	Entrypoint   []string
	Cmd          []string
	Mounts       []mount.Mount
	Privileged   bool
	AutoRemove   bool
}

func (*ContainerSpec) WorkDir

func (s *ContainerSpec) WorkDir() string

type CopyContainerFileHandler

type CopyContainerFileHandler func(header *tar.Header, reader io.Reader) error

type GrpcHealthProbe

type GrpcHealthProbe struct {
	// contains filtered or unexported fields
}

func NewGRPCHealthProbe

func NewGRPCHealthProbe(baseUrl string) GrpcHealthProbe

func (GrpcHealthProbe) Execute

func (g GrpcHealthProbe) Execute(ctx context.Context) (ready chan bool, errs chan error)

type Inspector

type Inspector interface {
	ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
}

type Orchestrator

type Orchestrator struct {
	// contains filtered or unexported fields
}

func NewOrchestrator

func NewOrchestrator(ctx context.Context, cli *client.Client, ignorer *ignore.Ignorer) (*Orchestrator, error)

func (*Orchestrator) BuildRContainer

func (o *Orchestrator) BuildRContainer(ctx context.Context, spec *BuildRContainerSpec) (con Container, baseUrl string, err error)

func (*Orchestrator) ShutdownContainer

func (o *Orchestrator) ShutdownContainer(ctx context.Context, con Container) error

type Probe

type Probe interface {
	Execute(ctx context.Context) (ready chan bool, errs chan error)
}

type Shutdowner

type Shutdowner interface {
	ShutdownContainer(ctx context.Context, container Container) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL