Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InjectSharedNetwork ¶
InjectSharedNetwork rewrites a compose YAML to declare the given shared external network and attach every service that has endpoint labels to it. Returns new bytes, whether any change was made, and an error.
func ValidateComposeSecurity ¶
ValidateComposeSecurity checks a parsed compose project for dangerous directives. Returns a list of violations. Empty list means safe.
Types ¶
type AppConfig ¶
type AppConfig struct {
Name string
ComposePath string
Endpoints []EndpointConfig
BackupStrategy string
BackupSchedule string
BackupTarget string
BackupRetention string
AlertCPU string
AlertMemory string
Registries string
AccessAllow string
RateLimit RateLimitLabels
Services []ServiceConfig
Project *types.Project
}
AppConfig holds the parsed compose file config plus extracted simpledeploy labels.
func ParseFile ¶
ParseFile parses the compose file at path and returns an AppConfig with appName as the name. simpledeploy.* labels are collected across all services; the first value found wins.
func (*AppConfig) PrimaryDomain ¶
PrimaryDomain returns the domain of the first endpoint, or empty string.
type EndpointConfig ¶
type EndpointConfig struct {
Domain string `json:"domain"`
Port string `json:"port"`
TLS string `json:"tls"`
Service string `json:"service"`
}
EndpointConfig holds config for a single endpoint (domain/port/tls bound to a service).
type LabelConfig ¶
type LabelConfig struct {
BackupStrategy string
BackupSchedule string
BackupTarget string
BackupRetention string
AlertCPU string
AlertMemory string
Registries string
AccessAllow string
RateLimit RateLimitLabels
}
LabelConfig holds all extracted simpledeploy.* labels (non-endpoint labels).
func ExtractLabels ¶
func ExtractLabels(labels map[string]string) LabelConfig
ExtractLabels extracts non-endpoint simpledeploy.* labels from the provided map.
type PortMapping ¶
type PortMapping struct {
Host, Container, Protocol string
}
PortMapping represents a host:container port binding.
type RateLimitLabels ¶
type RateLimitLabels struct {
Requests, Window, By, Burst string
}
RateLimitLabels holds simpledeploy.ratelimit.* label values.
type ServiceConfig ¶
type ServiceConfig struct {
Name string
Image string
Ports []PortMapping
Environment map[string]string
Volumes []VolumeMount
Restart string
Labels map[string]string
DependsOn []string
DeployMode string
}
ServiceConfig is a simplified representation of a compose service.
func (*ServiceConfig) ScaleEligibility ¶
func (s *ServiceConfig) ScaleEligibility() (bool, string)
ScaleEligibility reports whether the service can safely run with N>1 replicas. Returns (true, "") when scalable, (false, reason) otherwise.
Detection rules (in order):
- simpledeploy.scalable=false label forces non-scalable.
- simpledeploy.scalable=true label forces scalable (override).
- deploy.mode: global (one container per node).
- Any host-published port (would clash on the same host).
- Named volumes (typically stateful).
- Known stateful image (database, broker, etc.).
type VolumeMount ¶
type VolumeMount struct {
Source, Target, Type string
}
VolumeMount represents a service volume mount.