drivers

package
v0.0.0-...-9dee9fb Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 5 Imported by: 0

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

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

Read fetches the current state of a compose network.

func (*NetworkDriver) ResourceType

func (d *NetworkDriver) ResourceType() string

ResourceType returns "docker-compose.network".

func (*NetworkDriver) Scale

Scale is not supported for networks.

func (*NetworkDriver) Update

func (d *NetworkDriver) Update(_ context.Context, name string, _, desired map[string]any) (*platform.ResourceOutput, error)

Update modifies a compose network definition.

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

Read fetches the current state of a compose service.

func (*ServiceDriver) ResourceType

func (d *ServiceDriver) ResourceType() string

ResourceType returns "docker-compose.service".

func (*ServiceDriver) Scale

func (d *ServiceDriver) Scale(_ context.Context, name string, scaleParams map[string]any) (*platform.ResourceOutput, error)

Scale adjusts the replica count for a compose service.

func (*ServiceDriver) Update

func (d *ServiceDriver) Update(_ context.Context, name string, _, desired map[string]any) (*platform.ResourceOutput, error)

Update modifies a compose service by generating a new desired state.

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

Read returns the stub resource state.

func (*StubDriver) ResourceType

func (d *StubDriver) ResourceType() string

ResourceType returns "docker-compose.stub".

func (*StubDriver) Scale

Scale is not supported for stub resources.

func (*StubDriver) Update

func (d *StubDriver) Update(_ context.Context, name string, _, desired map[string]any) (*platform.ResourceOutput, error)

Update logs a warning and returns the stub output unchanged.

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

Read fetches the current state of a compose volume.

func (*VolumeDriver) ResourceType

func (d *VolumeDriver) ResourceType() string

ResourceType returns "docker-compose.volume".

func (*VolumeDriver) Scale

Scale is not supported for volumes.

func (*VolumeDriver) Update

func (d *VolumeDriver) Update(_ context.Context, name string, _, desired map[string]any) (*platform.ResourceOutput, error)

Update modifies a compose volume definition.

Jump to

Keyboard shortcuts

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