Documentation
¶
Overview ¶
Package drivers provides resource driver implementations for the Docker Compose provider. Each driver handles the CRUD lifecycle for a specific Docker Compose resource type.
Index ¶
- type ComposeExecutor
- type NetworkDriver
- func (d *NetworkDriver) Create(_ context.Context, name string, properties map[string]any) (*platform.ResourceOutput, error)
- func (d *NetworkDriver) Delete(_ context.Context, _ string) error
- func (d *NetworkDriver) Diff(ctx context.Context, name string, desired map[string]any) ([]platform.DiffEntry, error)
- func (d *NetworkDriver) HealthCheck(_ context.Context, name string) (*platform.HealthStatus, error)
- func (d *NetworkDriver) Read(_ context.Context, name string) (*platform.ResourceOutput, error)
- func (d *NetworkDriver) ResourceType() string
- func (d *NetworkDriver) Scale(_ context.Context, _ string, _ map[string]any) (*platform.ResourceOutput, error)
- func (d *NetworkDriver) Update(_ context.Context, name string, _, desired map[string]any) (*platform.ResourceOutput, error)
- type ServiceDriver
- func (d *ServiceDriver) Create(_ context.Context, name string, properties map[string]any) (*platform.ResourceOutput, error)
- func (d *ServiceDriver) Delete(_ context.Context, _ string) error
- func (d *ServiceDriver) Diff(ctx context.Context, name string, desired map[string]any) ([]platform.DiffEntry, error)
- func (d *ServiceDriver) HealthCheck(ctx context.Context, name string) (*platform.HealthStatus, error)
- func (d *ServiceDriver) Read(_ context.Context, name string) (*platform.ResourceOutput, error)
- func (d *ServiceDriver) ResourceType() string
- func (d *ServiceDriver) Scale(_ context.Context, name string, scaleParams map[string]any) (*platform.ResourceOutput, error)
- func (d *ServiceDriver) Update(_ context.Context, name string, _, desired map[string]any) (*platform.ResourceOutput, error)
- type StubDriver
- func (d *StubDriver) Create(_ context.Context, name string, properties map[string]any) (*platform.ResourceOutput, error)
- func (d *StubDriver) Delete(_ context.Context, name string) error
- func (d *StubDriver) Diff(_ context.Context, _ string, _ map[string]any) ([]platform.DiffEntry, error)
- func (d *StubDriver) HealthCheck(_ context.Context, name string) (*platform.HealthStatus, error)
- func (d *StubDriver) Read(_ context.Context, name string) (*platform.ResourceOutput, error)
- func (d *StubDriver) ResourceType() string
- func (d *StubDriver) Scale(_ context.Context, _ string, _ map[string]any) (*platform.ResourceOutput, error)
- func (d *StubDriver) Update(_ context.Context, name string, _, desired map[string]any) (*platform.ResourceOutput, error)
- type VolumeDriver
- func (d *VolumeDriver) Create(_ context.Context, name string, properties map[string]any) (*platform.ResourceOutput, error)
- func (d *VolumeDriver) Delete(_ context.Context, _ string) error
- func (d *VolumeDriver) Diff(ctx context.Context, name string, desired map[string]any) ([]platform.DiffEntry, error)
- func (d *VolumeDriver) HealthCheck(_ context.Context, name string) (*platform.HealthStatus, error)
- func (d *VolumeDriver) Read(_ context.Context, name string) (*platform.ResourceOutput, error)
- func (d *VolumeDriver) ResourceType() string
- func (d *VolumeDriver) Scale(_ context.Context, _ string, _ map[string]any) (*platform.ResourceOutput, error)
- func (d *VolumeDriver) Update(_ context.Context, name string, _, desired map[string]any) (*platform.ResourceOutput, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComposeExecutor ¶
type ComposeExecutor interface {
Ps(ctx context.Context, projectDir string, files ...string) (string, error)
}
ComposeExecutor is a minimal interface matching the executor methods needed by drivers.
type NetworkDriver ¶
type NetworkDriver struct {
// contains filtered or unexported fields
}
NetworkDriver handles CRUD operations for Docker Compose networks. It implements platform.ResourceDriver for the "docker-compose.network" type.
func NewNetworkDriver ¶
func NewNetworkDriver(executor ComposeExecutor, projectDir string) *NetworkDriver
NewNetworkDriver creates a NetworkDriver.
func (*NetworkDriver) Create ¶
func (d *NetworkDriver) Create(_ context.Context, name string, properties map[string]any) (*platform.ResourceOutput, error)
Create provisions a new compose network.
func (*NetworkDriver) Delete ¶
func (d *NetworkDriver) Delete(_ context.Context, _ string) error
Delete removes a network from the compose definition.
func (*NetworkDriver) Diff ¶
func (d *NetworkDriver) Diff(ctx context.Context, name string, desired map[string]any) ([]platform.DiffEntry, error)
Diff compares desired properties with current state.
func (*NetworkDriver) HealthCheck ¶
func (d *NetworkDriver) HealthCheck(_ context.Context, name string) (*platform.HealthStatus, error)
HealthCheck returns the health status of a compose network.
func (*NetworkDriver) Read ¶
func (d *NetworkDriver) Read(_ context.Context, name string) (*platform.ResourceOutput, error)
Read fetches the current state of a compose network.
func (*NetworkDriver) ResourceType ¶
func (d *NetworkDriver) ResourceType() string
ResourceType returns "docker-compose.network".
type ServiceDriver ¶
type ServiceDriver struct {
// contains filtered or unexported fields
}
ServiceDriver handles CRUD operations for Docker Compose services. It implements platform.ResourceDriver for the "docker-compose.service" type.
func NewServiceDriver ¶
func NewServiceDriver(executor ComposeExecutor, projectDir string) *ServiceDriver
NewServiceDriver creates a ServiceDriver.
func (*ServiceDriver) Create ¶
func (d *ServiceDriver) Create(_ context.Context, name string, properties map[string]any) (*platform.ResourceOutput, error)
Create provisions a new compose service. In Docker Compose, creation happens when docker compose up is run with the updated compose file. This driver records the desired state and returns a pending resource output.
func (*ServiceDriver) Delete ¶
func (d *ServiceDriver) Delete(_ context.Context, _ string) error
Delete marks a service for removal. The actual removal happens when docker compose up --remove-orphans is run.
func (*ServiceDriver) Diff ¶
func (d *ServiceDriver) Diff(ctx context.Context, name string, desired map[string]any) ([]platform.DiffEntry, error)
Diff compares desired properties with current state and returns differences.
func (*ServiceDriver) HealthCheck ¶
func (d *ServiceDriver) HealthCheck(ctx context.Context, name string) (*platform.HealthStatus, error)
HealthCheck returns the health status of a compose service.
func (*ServiceDriver) Read ¶
func (d *ServiceDriver) Read(_ context.Context, name string) (*platform.ResourceOutput, error)
Read fetches the current state of a compose service.
func (*ServiceDriver) ResourceType ¶
func (d *ServiceDriver) ResourceType() string
ResourceType returns "docker-compose.service".
type StubDriver ¶
type StubDriver struct{}
StubDriver handles capabilities that Docker Compose cannot faithfully implement (e.g., Kubernetes clusters, IAM roles). It returns resource outputs with stub status and logs warnings to alert users of fidelity gaps.
func NewStubDriver ¶
func NewStubDriver() *StubDriver
NewStubDriver creates a StubDriver for unsupported capabilities.
func (*StubDriver) Create ¶
func (d *StubDriver) Create(_ context.Context, name string, properties map[string]any) (*platform.ResourceOutput, error)
Create logs a warning and returns a stub resource output.
func (*StubDriver) Delete ¶
func (d *StubDriver) Delete(_ context.Context, name string) error
Delete is a no-op for stub resources.
func (*StubDriver) Diff ¶
func (d *StubDriver) Diff(_ context.Context, _ string, _ map[string]any) ([]platform.DiffEntry, error)
Diff always returns no differences for stub resources.
func (*StubDriver) HealthCheck ¶
func (d *StubDriver) HealthCheck(_ context.Context, name string) (*platform.HealthStatus, error)
HealthCheck always returns healthy for stubs since they are no-ops.
func (*StubDriver) Read ¶
func (d *StubDriver) Read(_ context.Context, name string) (*platform.ResourceOutput, error)
Read returns the stub resource state.
func (*StubDriver) ResourceType ¶
func (d *StubDriver) ResourceType() string
ResourceType returns "docker-compose.stub".
type VolumeDriver ¶
type VolumeDriver struct {
// contains filtered or unexported fields
}
VolumeDriver handles CRUD operations for Docker Compose volumes. It implements platform.ResourceDriver for the "docker-compose.volume" type.
func NewVolumeDriver ¶
func NewVolumeDriver(executor ComposeExecutor, projectDir string) *VolumeDriver
NewVolumeDriver creates a VolumeDriver.
func (*VolumeDriver) Create ¶
func (d *VolumeDriver) Create(_ context.Context, name string, properties map[string]any) (*platform.ResourceOutput, error)
Create provisions a new compose volume.
func (*VolumeDriver) Delete ¶
func (d *VolumeDriver) Delete(_ context.Context, _ string) error
Delete removes a volume from the compose definition.
func (*VolumeDriver) Diff ¶
func (d *VolumeDriver) Diff(ctx context.Context, name string, desired map[string]any) ([]platform.DiffEntry, error)
Diff compares desired properties with current state.
func (*VolumeDriver) HealthCheck ¶
func (d *VolumeDriver) HealthCheck(_ context.Context, name string) (*platform.HealthStatus, error)
HealthCheck returns the health status of a compose volume.
func (*VolumeDriver) Read ¶
func (d *VolumeDriver) Read(_ context.Context, name string) (*platform.ResourceOutput, error)
Read fetches the current state of a compose volume.
func (*VolumeDriver) ResourceType ¶
func (d *VolumeDriver) ResourceType() string
ResourceType returns "docker-compose.volume".