Documentation
¶
Overview ¶
Package compose provides Docker Compose project processing functionality
Package compose provides Docker Compose file parsing and handling ¶
Package compose provides Docker Compose project processing functionality
Index ¶
- func FindEnvFiles(serviceName, workingDir string) []string
- func HasNamingConflict(repo Repository, unitName, unitType string) bool
- func IsExternal(external interface{}) bool
- func NameResolver(explicitName, defaultName 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)
- func SanitizeProjectName(name string) string
- type FileSystem
- type Repository
- type SpecConverter
- type SpecProcessor
- 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 NameResolver ¶ added in v0.9.0
NameResolver returns the explicit name if provided, otherwise returns the default name.
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 and resource name. No sanitization is performed; the projectName must already be valid according to the service name regex: ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$.
func ReadProjects ¶
ReadProjects reads all Docker Compose projects from a directory path.
func ReadProjectsWithLogger ¶ added in v0.21.0
ReadProjectsWithLogger reads all Docker Compose projects from a directory path with a provided logger.
func SanitizeProjectName ¶ added in v0.24.7
SanitizeProjectName sanitizes a project name to make it safe for use in resource names. Project names come from compose files and may contain spaces and other invalid characters. This replaces invalid characters (spaces) with hyphens, while preserving underscores which are valid.
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.
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.
type SpecConverter ¶ added in v0.22.0
type SpecConverter struct {
// contains filtered or unexported fields
}
SpecConverter converts Docker Compose projects to service.Spec models.
func NewSpecConverter ¶ added in v0.22.0
func NewSpecConverter(workingDir string) *SpecConverter
NewSpecConverter creates a new SpecConverter.
func (*SpecConverter) ConvertProject ¶ added in v0.22.0
ConvertProject converts a Docker Compose project to a list of service specs. It normalizes multi-container setups into multiple Spec instances, handling services, volumes, networks, and build configurations.
type SpecProcessor ¶ added in v0.22.0
type SpecProcessor struct {
// contains filtered or unexported fields
}
SpecProcessor processes Docker Compose projects into service specs. It wraps SpecConverter to provide the standard Process interface.
func NewSpecProcessor ¶ added in v0.22.0
func NewSpecProcessor(workingDir string) *SpecProcessor
NewSpecProcessor creates a new SpecProcessor with the given working directory.
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.