Documentation
¶
Overview ¶
Package compose provides Docker Compose project processing functionality
Package compose provides Docker Compose file parsing and handling
Index ¶
- func FindEnvFiles(serviceName, workingDir string) []string
- func HasNamingConflict(repo Repository, unitName, unitType string) bool
- func IsExternal(external interface{}) bool
- func LabelConverter(labels types.Labels) []string
- func NameResolver(definedName, keyName string) string
- func OptionsConverter(opts map[string]string) []string
- func ParseComposeFile(path string) (*types.Project, error)
- func ParseComposeFileWithLogger(path string, logger log.Logger) (*types.Project, error)
- func Prefix(projectName, resourceName string) string
- func ReadProjects(path string) ([]*types.Project, error)
- func ReadProjectsWithLogger(path string, logger log.Logger) ([]*types.Project, error)
- type FileSystem
- type FileSystemAdapter
- type Processor
- type Repository
- type RepositoryAdapter
- type SystemdAdapter
- type SystemdManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindEnvFiles ¶ added in v0.21.0
FindEnvFiles discovers environment files for a service in a working directory.
func HasNamingConflict ¶ added in v0.21.0
func HasNamingConflict(repo Repository, unitName, unitType string) bool
HasNamingConflict checks for potential naming conflicts with existing units.
func IsExternal ¶ added in v0.21.0
func IsExternal(external interface{}) bool
IsExternal checks if a resource configuration indicates it's externally managed.
func LabelConverter ¶ added in v0.9.0
LabelConverter converts compose-style labels to unit labels.
func NameResolver ¶ added in v0.9.0
NameResolver resolves resource names from compose configs.
func OptionsConverter ¶ added in v0.9.0
OptionsConverter converts driver options to unit options.
func ParseComposeFile ¶
ParseComposeFile parses a Docker Compose file at the specified path.
func ParseComposeFileWithLogger ¶ added in v0.21.0
ParseComposeFileWithLogger parses a Docker Compose file at the specified path with a provided logger.
func Prefix ¶ added in v0.21.0
Prefix creates a prefixed resource name using project name for consistency.
func ReadProjects ¶
ReadProjects reads all Docker Compose projects from a directory path.
Types ¶
type FileSystem ¶ added in v0.21.0
type FileSystem interface {
GetUnitFilePath(name, unitType string) string
HasUnitChanged(unitPath, content string) bool
WriteUnitFile(unitPath, content string) error
GetContentHash(content string) string
}
FileSystem defines the interface for file system operations.
func NewFileSystemAdapter ¶ added in v0.21.0
func NewFileSystemAdapter(configProvider config.Provider) FileSystem
NewFileSystemAdapter creates a new filesystem adapter with config provider.
func NewFileSystemAdapterWithConfig ¶ added in v0.21.0
func NewFileSystemAdapterWithConfig(configProvider config.Provider) FileSystem
NewFileSystemAdapterWithConfig creates a new filesystem adapter with config provider. This is an alias for NewFileSystemAdapter to maintain backward compatibility.
type FileSystemAdapter ¶ added in v0.21.0
type FileSystemAdapter struct {
// contains filtered or unexported fields
}
FileSystemAdapter adapts fs operations to our interface.
func (*FileSystemAdapter) GetContentHash ¶ added in v0.21.0
func (f *FileSystemAdapter) GetContentHash(content string) string
GetContentHash returns a hash of the content.
func (*FileSystemAdapter) GetUnitFilePath ¶ added in v0.21.0
func (f *FileSystemAdapter) GetUnitFilePath(name, unitType string) string
GetUnitFilePath returns the file path for a unit.
func (*FileSystemAdapter) HasUnitChanged ¶ added in v0.21.0
func (f *FileSystemAdapter) HasUnitChanged(unitPath, content string) bool
HasUnitChanged checks if a unit file has changed.
func (*FileSystemAdapter) WriteUnitFile ¶ added in v0.21.0
func (f *FileSystemAdapter) WriteUnitFile(unitPath, content string) error
WriteUnitFile writes a unit file to disk.
type Processor ¶ added in v0.21.0
type Processor struct {
// contains filtered or unexported fields
}
Processor handles the conversion of Docker Compose projects to Podman systemd units.
func NewDefaultProcessor ¶ added in v0.21.0
NewDefaultProcessor creates a new Processor with default real dependencies.
func NewProcessor ¶ added in v0.21.0
func NewProcessor(repo Repository, systemd SystemdManager, fs FileSystem, logger log.Logger, force bool) *Processor
NewProcessor creates a new Processor with the given dependencies.
func (*Processor) GetProcessedUnits ¶ added in v0.21.0
GetProcessedUnits returns the map of processed units.
func (*Processor) ProcessProjects ¶ added in v0.21.0
ProcessProjects processes Docker Compose projects and converts them to Podman systemd units.
type Repository ¶ added in v0.21.0
type Repository interface {
FindAll() ([]repository.Unit, error)
Create(unit *repository.Unit) (*repository.Unit, error)
Delete(id string) error
}
Repository defines the interface for unit repository operations.
func NewRepositoryAdapter ¶ added in v0.21.0
func NewRepositoryAdapter(repo repository.Repository) Repository
NewRepositoryAdapter creates a new repository adapter.
type RepositoryAdapter ¶ added in v0.21.0
type RepositoryAdapter struct {
// contains filtered or unexported fields
}
RepositoryAdapter adapts repository.Repository to our interface.
func (*RepositoryAdapter) Create ¶ added in v0.21.0
func (r *RepositoryAdapter) Create(unit *repository.Unit) (*repository.Unit, error)
Create creates a new unit in the repository.
func (*RepositoryAdapter) Delete ¶ added in v0.21.0
func (r *RepositoryAdapter) Delete(_ string) error
Delete removes a unit from the repository.
func (*RepositoryAdapter) FindAll ¶ added in v0.21.0
func (r *RepositoryAdapter) FindAll() ([]repository.Unit, error)
FindAll retrieves all units from the repository.
type SystemdAdapter ¶ added in v0.21.0
type SystemdAdapter struct {
// contains filtered or unexported fields
}
SystemdAdapter adapts systemd operations to our interface.
func (*SystemdAdapter) ReloadSystemd ¶ added in v0.21.0
func (s *SystemdAdapter) ReloadSystemd() error
ReloadSystemd reloads the systemd configuration.
func (*SystemdAdapter) RestartChangedUnits ¶ added in v0.21.0
func (s *SystemdAdapter) RestartChangedUnits(units []systemd.UnitChange, projectDependencyGraphs map[string]*dependency.ServiceDependencyGraph) error
RestartChangedUnits restarts units that have changed.
func (*SystemdAdapter) StopUnit ¶ added in v0.21.0
func (s *SystemdAdapter) StopUnit(name, unitType string) error
StopUnit stops a systemd unit.
type SystemdManager ¶ added in v0.21.0
type SystemdManager interface {
RestartChangedUnits(units []systemd.UnitChange, projectDependencyGraphs map[string]*dependency.ServiceDependencyGraph) error
ReloadSystemd() error
StopUnit(name, unitType string) error
}
SystemdManager defines the interface for systemd operations.
func NewSystemdAdapter ¶ added in v0.21.0
func NewSystemdAdapter(unitManager systemd.UnitManager, orchestrator systemd.Orchestrator) SystemdManager
NewSystemdAdapter creates a new systemd adapter with dependency injection.