Documentation ¶
Index ¶
- func ConvertServices(v1Services map[string]*ServiceConfigV1) (map[string]*ServiceConfig, error)
- func GetServiceHash(name string, config *ServiceConfig) string
- func Interpolate(environmentLookup EnvironmentLookup, config *RawServiceMap) error
- func IsValidRemote(remote string) bool
- func Merge(existingServices *ServiceConfigs, environmentLookup EnvironmentLookup, ...) (map[string]*ServiceConfig, map[string]*VolumeConfig, map[string]*NetworkConfig, ...)
- func MergeServicesV1(existingServices *ServiceConfigs, environmentLookup EnvironmentLookup, ...) (map[string]*ServiceConfigV1, error)
- func MergeServicesV2(existingServices *ServiceConfigs, environmentLookup EnvironmentLookup, ...) (map[string]*ServiceConfig, error)
- func ParseNetworks(bytes []byte) (map[string]*NetworkConfig, error)
- func ParseVolumes(bytes []byte) (map[string]*VolumeConfig, error)
- type Build
- type Config
- type EnvironmentLookup
- type Ipam
- type Log
- type NetworkConfig
- type ParseOptions
- type RawService
- type RawServiceMap
- type ResourceLookup
- type ServiceConfig
- type ServiceConfigV1
- type ServiceConfigs
- type VolumeConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertServices ¶
func ConvertServices(v1Services map[string]*ServiceConfigV1) (map[string]*ServiceConfig, error)
ConvertServices converts a set of v1 service configs to v2 service configs
func GetServiceHash ¶
func GetServiceHash(name string, config *ServiceConfig) string
GetServiceHash computes and returns a hash that will identify a service. This hash will be then used to detect if the service definition/configuration have changed and needs to be recreated.
func Interpolate ¶
func Interpolate(environmentLookup EnvironmentLookup, config *RawServiceMap) error
Interpolate replaces variables in the raw map representation of the project file
func IsValidRemote ¶
IsValidRemote checks if the specified string is a valid remote (for builds)
func Merge ¶
func Merge(existingServices *ServiceConfigs, environmentLookup EnvironmentLookup, resourceLookup ResourceLookup, file string, bytes []byte, options *ParseOptions) (map[string]*ServiceConfig, map[string]*VolumeConfig, map[string]*NetworkConfig, error)
Merge merges a compose file into an existing set of service configs
func MergeServicesV1 ¶
func MergeServicesV1(existingServices *ServiceConfigs, environmentLookup EnvironmentLookup, resourceLookup ResourceLookup, file string, bytes []byte, options *ParseOptions) (map[string]*ServiceConfigV1, error)
MergeServicesV1 merges a v1 compose file into an existing set of service configs
func MergeServicesV2 ¶
func MergeServicesV2(existingServices *ServiceConfigs, environmentLookup EnvironmentLookup, resourceLookup ResourceLookup, file string, bytes []byte, options *ParseOptions) (map[string]*ServiceConfig, error)
MergeServicesV2 merges a v2 compose file into an existing set of service configs
func ParseNetworks ¶
func ParseNetworks(bytes []byte) (map[string]*NetworkConfig, error)
ParseNetworks parses networks in a compose file
func ParseVolumes ¶
func ParseVolumes(bytes []byte) (map[string]*VolumeConfig, error)
ParseVolumes parses volumes in a compose file
Types ¶
type Build ¶
type Build struct { Context string `yaml:"context,omitempty"` Dockerfile string `yaml:"dockerfile,omitempty"` Args yaml.MaporEqualSlice `yaml:"args,omitempty"` }
Build holds v2 build information
type Config ¶
type Config struct { Version string `yaml:"version,omitempty"` Services RawServiceMap `yaml:"services,omitempty"` Volumes map[string]*VolumeConfig `yaml:"volumes,omitempty"` Networks map[string]*NetworkConfig `yaml:"networks,omitempty"` }
Config holds libcompose top level configuration
type EnvironmentLookup ¶
type EnvironmentLookup interface {
Lookup(key, serviceName string, config *ServiceConfig) []string
}
EnvironmentLookup defines methods to provides environment variable loading.
type Ipam ¶
type Ipam struct { Driver string `yaml:"driver,omitempty"` Config []string `yaml:"config,omitempty"` }
Ipam holds v2 network IPAM information
type Log ¶
type Log struct { Driver string `yaml:"driver,omitempty"` Options map[string]string `yaml:"options,omitempty"` }
Log holds v2 logging information
type NetworkConfig ¶
type NetworkConfig struct { Driver string `yaml:"driver,omitempty"` DriverOpts map[string]string `yaml:"driver_opts,omitempty"` External bool `yaml:"external,omitempty"` Ipam Ipam `yaml:"ipam,omitempty"` }
NetworkConfig holds v2 network configuration
type ParseOptions ¶
type ParseOptions struct { Interpolate bool Validate bool Preprocess func(RawServiceMap) (RawServiceMap, error) Postprocess func(map[string]*ServiceConfig) (map[string]*ServiceConfig, error) }
ParseOptions are a set of options to customize the parsing process
type RawService ¶
type RawService map[string]interface{}
RawService is represent a Service in map form unparsed
type RawServiceMap ¶
type RawServiceMap map[string]RawService
RawServiceMap is a collection of RawServices
type ResourceLookup ¶
type ResourceLookup interface { Lookup(file, relativeTo string) ([]byte, string, error) ResolvePath(path, inFile string) string }
ResourceLookup defines methods to provides file loading.
type ServiceConfig ¶
type ServiceConfig struct { Build Build `yaml:"build,omitempty"` CapAdd []string `yaml:"cap_add,omitempty"` CapDrop []string `yaml:"cap_drop,omitempty"` CPUSet string `yaml:"cpuset,omitempty"` CPUQuota int64 `yaml:"cpu_quota,omitempty"` Command yaml.Command `yaml:"command,flow,omitempty"` CgroupParent string `yaml:"cgroup_parrent,omitempty"` ContainerName string `yaml:"container_name,omitempty"` Devices []string `yaml:"devices,omitempty"` DependsOn []string `yaml:"depends_on,omitempty"` DNS yaml.Stringorslice `yaml:"dns,omitempty"` DNSSearch yaml.Stringorslice `yaml:"dns_search,omitempty"` DomainName string `yaml:"domain_name,omitempty"` Entrypoint yaml.Command `yaml:"entrypoint,flow,omitempty"` EnvFile yaml.Stringorslice `yaml:"env_file,omitempty"` Environment yaml.MaporEqualSlice `yaml:"environment,omitempty"` Expose []string `yaml:"expose,omitempty"` Extends yaml.MaporEqualSlice `yaml:"extends,omitempty"` ExternalLinks []string `yaml:"external_links,omitempty"` ExtraHosts []string `yaml:"extra_hosts,omitempty"` Image string `yaml:"image,omitempty"` Hostname string `yaml:"hostname,omitempty"` Ipc string `yaml:"ipc,omitempty"` Labels yaml.SliceorMap `yaml:"labels,omitempty"` Links yaml.MaporColonSlice `yaml:"links,omitempty"` Logging Log `yaml:"logging,omitempty"` MacAddress string `yaml:"mac_address,omitempty"` MemLimit int64 `yaml:"mem_limit,omitempty"` MemSwapLimit int64 `yaml:"memswap_limit,omitempty"` NetworkMode string `yaml:"network_mode,omitempty"` Networks []string `yaml:"networks,omitempty"` Pid string `yaml:"pid,omitempty"` Ports []string `yaml:"ports,omitempty"` Privileged bool `yaml:"privileged,omitempty"` SecurityOpt []string `yaml:"security_opt,omitempty"` StopSignal string `yaml:"stop_signal,omitempty"` VolumeDriver string `yaml:"volume_driver,omitempty"` Volumes []string `yaml:"volumes,omitempty"` VolumesFrom []string `yaml:"volumes_from,omitempty"` Uts string `yaml:"uts,omitempty"` Restart string `yaml:"restart,omitempty"` ReadOnly bool `yaml:"read_only,omitempty"` StdinOpen bool `yaml:"stdin_open,omitempty"` Tty bool `yaml:"tty,omitempty"` User string `yaml:"user,omitempty"` WorkingDir string `yaml:"working_dir,omitempty"` Ulimits yaml.Ulimits `yaml:"ulimits,omitempty"` }
ServiceConfig holds version 2 of libcompose service configuration
type ServiceConfigV1 ¶
type ServiceConfigV1 struct { Build string `yaml:"build,omitempty"` CapAdd []string `yaml:"cap_add,omitempty"` CapDrop []string `yaml:"cap_drop,omitempty"` CgroupParent string `yaml:"cgroup_parent,omitempty"` CPUQuota int64 `yaml:"cpu_quota,omitempty"` CPUSet string `yaml:"cpuset,omitempty"` Command yaml.Command `yaml:"command,flow,omitempty"` ContainerName string `yaml:"container_name,omitempty"` Devices []string `yaml:"devices,omitempty"` DNS yaml.Stringorslice `yaml:"dns,omitempty"` DNSSearch yaml.Stringorslice `yaml:"dns_search,omitempty"` Dockerfile string `yaml:"dockerfile,omitempty"` DomainName string `yaml:"domainname,omitempty"` Entrypoint yaml.Command `yaml:"entrypoint,flow,omitempty"` EnvFile yaml.Stringorslice `yaml:"env_file,omitempty"` Environment yaml.MaporEqualSlice `yaml:"environment,omitempty"` Hostname string `yaml:"hostname,omitempty"` Image string `yaml:"image,omitempty"` Labels yaml.SliceorMap `yaml:"labels,omitempty"` Links yaml.MaporColonSlice `yaml:"links,omitempty"` LogDriver string `yaml:"log_driver,omitempty"` MacAddress string `yaml:"mac_address,omitempty"` MemLimit int64 `yaml:"mem_limit,omitempty"` MemSwapLimit int64 `yaml:"memswap_limit,omitempty"` Name string `yaml:"name,omitempty"` Net string `yaml:"net,omitempty"` Pid string `yaml:"pid,omitempty"` Uts string `yaml:"uts,omitempty"` Ipc string `yaml:"ipc,omitempty"` Ports []string `yaml:"ports,omitempty"` Privileged bool `yaml:"privileged,omitempty"` Restart string `yaml:"restart,omitempty"` ReadOnly bool `yaml:"read_only,omitempty"` StdinOpen bool `yaml:"stdin_open,omitempty"` SecurityOpt []string `yaml:"security_opt,omitempty"` Tty bool `yaml:"tty,omitempty"` User string `yaml:"user,omitempty"` VolumeDriver string `yaml:"volume_driver,omitempty"` Volumes []string `yaml:"volumes,omitempty"` VolumesFrom []string `yaml:"volumes_from,omitempty"` WorkingDir string `yaml:"working_dir,omitempty"` Expose []string `yaml:"expose,omitempty"` ExternalLinks []string `yaml:"external_links,omitempty"` LogOpt map[string]string `yaml:"log_opt,omitempty"` ExtraHosts []string `yaml:"extra_hosts,omitempty"` Ulimits yaml.Ulimits `yaml:"ulimits,omitempty"` }
ServiceConfigV1 holds version 1 of libcompose service configuration
type ServiceConfigs ¶
type ServiceConfigs struct {
// contains filtered or unexported fields
}
ServiceConfigs holds a concurrent safe map of ServiceConfig
func NewServiceConfigs ¶
func NewServiceConfigs() *ServiceConfigs
NewServiceConfigs initializes a new Configs struct
func (*ServiceConfigs) Add ¶
func (c *ServiceConfigs) Add(name string, service *ServiceConfig)
Add add the specifed config with the specified name
func (*ServiceConfigs) Get ¶
func (c *ServiceConfigs) Get(name string) (*ServiceConfig, bool)
Get returns the config and the presence of the specified name
func (*ServiceConfigs) Has ¶
func (c *ServiceConfigs) Has(name string) bool
Has checks if the config map has the specified name
func (*ServiceConfigs) Keys ¶
func (c *ServiceConfigs) Keys() []string
Keys returns the names of the config