Documentation
¶
Overview ¶
Package docker implements a Docker-based infrastructure provider for the ctrlplane.
Index ¶
- Variables
- type Config
- type Option
- type Provider
- func (p *Provider) Capabilities() []provider.Capability
- func (p *Provider) Deploy(_ context.Context, req provider.DeployRequest) (*provider.DeployResult, error)
- func (p *Provider) Deprovision(_ context.Context, _ id.ID) error
- func (p *Provider) Exec(_ context.Context, _ id.ID, _ provider.ExecRequest) (*provider.ExecResult, error)
- func (p *Provider) Info() provider.ProviderInfo
- func (p *Provider) Logs(_ context.Context, _ id.ID, _ provider.LogOptions) (io.ReadCloser, error)
- func (p *Provider) Provision(_ context.Context, req provider.ProvisionRequest) (*provider.ProvisionResult, error)
- func (p *Provider) Resources(_ context.Context, _ id.ID) (*provider.ResourceUsage, error)
- func (p *Provider) Restart(_ context.Context, _ id.ID) error
- func (p *Provider) Rollback(_ context.Context, _ id.ID, _ id.ID) error
- func (p *Provider) Scale(_ context.Context, _ id.ID, _ provider.ResourceSpec) error
- func (p *Provider) Start(_ context.Context, _ id.ID) error
- func (p *Provider) Status(_ context.Context, _ id.ID) (*provider.InstanceStatus, error)
- func (p *Provider) Stop(_ context.Context, _ id.ID) error
Constants ¶
This section is empty.
Variables ¶
var ErrLogsNotImplemented = errors.New("docker: logs not implemented")
ErrLogsNotImplemented is returned when logs are not yet available.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Host is the Docker daemon address (e.g., unix:///var/run/docker.sock).
Host string `env:"CP_DOCKER_HOST" json:"host"`
// Network is the Docker network to attach containers to.
Network string `default:"bridge" env:"CP_DOCKER_NETWORK" json:"network"`
// Registry is the default image registry prefix.
Registry string `env:"CP_DOCKER_REGISTRY" json:"registry,omitempty"`
}
Config holds configuration for the Docker provider.
type Option ¶ added in v1.3.0
Option configures a Docker provider.
func WithConfig ¶ added in v1.3.0
WithConfig applies all non-zero fields from a Config struct. This is useful when loading configuration from files or environment variables.
func WithHost ¶ added in v1.3.0
WithHost sets the Docker daemon address (e.g., "unix:///var/run/docker.sock").
func WithNetwork ¶ added in v1.3.0
WithNetwork sets the Docker network to attach containers to.
func WithRegistry ¶ added in v1.3.0
WithRegistry sets the default image registry prefix.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is a Docker-based infrastructure provider.
func New ¶
New creates a new Docker provider with the given options. Without any options, sane defaults are used (network: "bridge").
func (*Provider) Capabilities ¶
func (p *Provider) Capabilities() []provider.Capability
Capabilities returns the set of features this provider supports.
func (*Provider) Deploy ¶
func (p *Provider) Deploy(_ context.Context, req provider.DeployRequest) (*provider.DeployResult, error)
Deploy pushes a new release to the instance.
func (*Provider) Deprovision ¶
Deprovision tears down all resources for an instance.
func (*Provider) Exec ¶
func (p *Provider) Exec(_ context.Context, _ id.ID, _ provider.ExecRequest) (*provider.ExecResult, error)
Exec runs a command inside the instance.
func (*Provider) Info ¶
func (p *Provider) Info() provider.ProviderInfo
Info returns metadata about this provider.
func (*Provider) Logs ¶
func (p *Provider) Logs(_ context.Context, _ id.ID, _ provider.LogOptions) (io.ReadCloser, error)
Logs streams logs for the instance.
func (*Provider) Provision ¶
func (p *Provider) Provision(_ context.Context, req provider.ProvisionRequest) (*provider.ProvisionResult, error)
Provision creates infrastructure resources for an instance.