@ -88,88 +88,90 @@ type ServiceConfig struct {
Name string ` yaml:"-" json:"-" `
Name string ` yaml:"-" json:"-" `
Profiles [ ] string ` mapstructure:"profiles" yaml:"profiles,omitempty" json:"profiles,omitempty" `
Profiles [ ] string ` mapstructure:"profiles" yaml:"profiles,omitempty" json:"profiles,omitempty" `
Build * BuildConfig ` yaml:",omitempty" json:"build,omitempty" `
Build * BuildConfig ` yaml:",omitempty" json:"build,omitempty" `
BlkioConfig * BlkioConfig ` mapstructure:"blkio_config" yaml:",omitempty" json:"blkio_config,omitempty" `
BlkioConfig * BlkioConfig ` mapstructure:"blkio_config" yaml:",omitempty" json:"blkio_config,omitempty" `
CapAdd [ ] string ` mapstructure:"cap_add" yaml:"cap_add,omitempty" json:"cap_add,omitempty" `
CapAdd [ ] string ` mapstructure:"cap_add" yaml:"cap_add,omitempty" json:"cap_add,omitempty" `
CapDrop [ ] string ` mapstructure:"cap_drop" yaml:"cap_drop,omitempty" json:"cap_drop,omitempty" `
CapDrop [ ] string ` mapstructure:"cap_drop" yaml:"cap_drop,omitempty" json:"cap_drop,omitempty" `
CgroupParent string ` mapstructure:"cgroup_parent" yaml:"cgroup_parent,omitempty" json:"cgroup_parent,omitempty" `
CgroupParent string ` mapstructure:"cgroup_parent" yaml:"cgroup_parent,omitempty" json:"cgroup_parent,omitempty" `
CPUCount int64 ` mapstructure:"cpu_count" yaml:"cpu_count,omitempty" json:"cpu_count,omitempty" `
CPUCount int64 ` mapstructure:"cpu_count" yaml:"cpu_count,omitempty" json:"cpu_count,omitempty" `
CPUPercent float32 ` mapstructure:"cpu_percent" yaml:"cpu_percent,omitempty" json:"cpu_percent,omitempty" `
CPUPercent float32 ` mapstructure:"cpu_percent" yaml:"cpu_percent,omitempty" json:"cpu_percent,omitempty" `
CPUPeriod int64 ` mapstructure:"cpu_period" yaml:"cpu_period,omitempty" json:"cpu_period,omitempty" `
CPUPeriod int64 ` mapstructure:"cpu_period" yaml:"cpu_period,omitempty" json:"cpu_period,omitempty" `
CPUQuota int64 ` mapstructure:"cpu_quota" yaml:"cpu_quota,omitempty" json:"cpu_quota,omitempty" `
CPUQuota int64 ` mapstructure:"cpu_quota" yaml:"cpu_quota,omitempty" json:"cpu_quota,omitempty" `
CPURTPeriod int64 ` mapstructure:"cpu_rt_period" yaml:"cpu_rt_period,omitempty" json:"cpu_rt_period,omitempty" `
CPURTPeriod int64 ` mapstructure:"cpu_rt_period" yaml:"cpu_rt_period,omitempty" json:"cpu_rt_period,omitempty" `
CPURTRuntime int64 ` mapstructure:"cpu_rt_runtime" yaml:"cpu_rt_runtime,omitempty" json:"cpu_rt_runtime,omitempty" `
CPURTRuntime int64 ` mapstructure:"cpu_rt_runtime" yaml:"cpu_rt_runtime,omitempty" json:"cpu_rt_runtime,omitempty" `
CPUS float32 ` mapstructure:"cpus" yaml:"cpus,omitempty" json:"cpus,omitempty" `
CPUS float32 ` mapstructure:"cpus" yaml:"cpus,omitempty" json:"cpus,omitempty" `
CPUSet string ` mapstructure:"cpuset" yaml:"cpuset,omitempty" json:"cpuset,omitempty" `
CPUSet string ` mapstructure:"cpuset" yaml:"cpuset,omitempty" json:"cpuset,omitempty" `
CPUShares int64 ` mapstructure:"cpu_shares" yaml:"cpu_shares,omitempty" json:"cpu_shares,omitempty" `
CPUShares int64 ` mapstructure:"cpu_shares" yaml:"cpu_shares,omitempty" json:"cpu_shares,omitempty" `
Command ShellCommand ` yaml:",omitempty" json:"command,omitempty" `
Command ShellCommand ` yaml:",omitempty" json:"command,omitempty" `
Configs [ ] ServiceConfigObjConfig ` yaml:",omitempty" json:"configs,omitempty" `
Configs [ ] ServiceConfigObjConfig ` yaml:",omitempty" json:"configs,omitempty" `
ContainerName string ` mapstructure:"container_name" yaml:"container_name,omitempty" json:"container_name,omitempty" `
ContainerName string ` mapstructure:"container_name" yaml:"container_name,omitempty" json:"container_name,omitempty" `
CredentialSpec * CredentialSpecConfig ` mapstructure:"credential_spec" yaml:"credential_spec,omitempty" json:"credential_spec,omitempty" `
CredentialSpec * CredentialSpecConfig ` mapstructure:"credential_spec" yaml:"credential_spec,omitempty" json:"credential_spec,omitempty" `
DependsOn DependsOnConfig ` mapstructure:"depends_on" yaml:"depends_on,omitempty" json:"depends_on,omitempty" `
DependsOn DependsOnConfig ` mapstructure:"depends_on" yaml:"depends_on,omitempty" json:"depends_on,omitempty" `
Deploy * DeployConfig ` yaml:",omitempty" json:"deploy,omitempty" `
Deploy * DeployConfig ` yaml:",omitempty" json:"deploy,omitempty" `
Devices [ ] string ` yaml:",omitempty" json:"devices,omitempty" `
DeviceCgroupRules [ ] string ` mapstructure:"device_cgroup_rules" yaml:"device_cgroup_rules,omitempty" json:"device_cgroup_rules,omitempty" `
DNS StringList ` yaml:",omitempty" json:"dns,omitempty" `
Devices [ ] string ` yaml:",omitempty" json:"devices,omitempty" `
DNSOpts [ ] string ` mapstructure:"dns_opt" yaml:"dns_opt,omitempty" json:"dns_opt,omitempty" `
DNS StringList ` yaml:",omitempty" json:"dns,omitempty" `
DNSSearch StringList ` mapstructure:"dns_search" yaml:"dns_search,omitempty" json:"dns_search,omitempty" `
DNSOpts [ ] string ` mapstructure:"dns_opt" yaml:"dns_opt,omitempty" json:"dns_opt,omitempty" `
Dockerfile string ` yaml:"dockerfile,omitempty" json:"dockerfile,omitempty" `
DNSSearch StringList ` mapstructure:"dns_search" yaml:"dns_search,omitempty" json:"dns_search,omitempty" `
DomainName string ` mapstructure:"domainname" yaml:"domainname,omitempty" json:"domainname,omitempty" `
Dockerfile string ` yaml:"dockerfile,omitempty" json:"dockerfile,omitempty" `
Entrypoint ShellCommand ` yaml:",omitempty" json:"entrypoint,omitempty" `
DomainName string ` mapstructure:"domainname" yaml:"domainname,omitempty" json:"domainname,omitempty" `
Environment MappingWithEquals ` yaml:",omitempty" json:"environment,omitempty" `
Entrypoint ShellCommand ` yaml:",omitempty" json:"entrypoint,omitempty" `
EnvFile StringList ` mapstructure:"env_file" yaml:"env_file,omitempty" json:"env_file,omitempty" `
Environment MappingWithEquals ` yaml:",omitempty" json:"environment,omitempty" `
Expose StringOrNumberList ` yaml:",omitempty" json:"expose,omitempty" `
EnvFile StringList ` mapstructure:"env_file" yaml:"env_file,omitempty" json:"env_file,omitempty" `
Extends ExtendsConfig ` yaml:"extends,omitempty" json:"extends,omitempty" `
Expose StringOrNumberList ` yaml:",omitempty" json:"expose,omitempty" `
ExternalLinks [ ] string ` mapstructure:"external_links" yaml:"external_links,omitempty" json:"external_links,omitempty" `
Extends ExtendsConfig ` yaml:"extends,omitempty" json:"extends,omitempty" `
ExtraHosts HostsList ` mapstructure:"extra_hosts" yaml:"extra_hosts,omitempty" json:"extra_hosts,omitempty" `
ExternalLinks [ ] string ` mapstructure:"external_links" yaml:"external_links,omitempty" json:"external_links,omitempty" `
GroupAdd [ ] string ` mapstructure:"group_add" yaml:"group_add,omitempty" json:"group_add,omitempty" `
ExtraHosts HostsList ` mapstructure:"extra_hosts" yaml:"extra_hosts,omitempty" json:"extra_hosts,omitempty" `
Hostname string ` yaml:",omitempty" json:"hostname,omitempty" `
GroupAdd [ ] string ` mapstructure:"group_add" yaml:"group_add,omitempty" json:"group_add,omitempty" `
HealthCheck * HealthCheckConfig ` yaml:",omitempty" json:"healthcheck,omitempty" `
Hostname string ` yaml:",omitempty" json:"hostname,omitempty" `
Image string ` yaml:",omitempty" json:"image,omitempty" `
HealthCheck * HealthCheckConfig ` yaml:",omitempty" json:"healthcheck,omitempty" `
Init * bool ` yaml:",omitempty" json:"init,omitempty" `
Image string ` yaml:",omitempty" json:"image,omitempty" `
Ipc string ` yaml:",omitempty" json:"ipc,omitempty" `
Init * bool ` yaml:",omitempty" json:"init,omitempty" `
Isolation string ` mapstructure:"isolation" yaml:"isolation,omitempty" json:"isolation,omitempty" `
Ipc string ` yaml:",omitempty" json:"ipc,omitempty" `
Labels Labels ` yaml:",omitempty" json:"labels,omitempty" `
Isolation string ` mapstructure:"isolation" yaml:"isolation,omitempty" json:"isolation,omitempty" `
Links [ ] string ` yaml:",omitempty" json:"links,omitempty" `
Labels Labels ` yaml:",omitempty" json:"labels,omitempty" `
Logging * LoggingConfig ` yaml:",omitempty" json:"logging,omitempty" `
CustomLabels Labels ` yaml:"-" json:"-" `
LogDriver string ` mapstructure:"log_driver" yaml:"log_driver,omitempty" json:"log_driver,omitempty" `
Links [ ] string ` yaml:",omitempty" json:"links,omitempty" `
LogOpt map [ string ] string ` mapstructure:"log_opt" yaml:"log_opt,omitempty" json:"log_opt,omitempty" `
Logging * LoggingConfig ` yaml:",omitempty" json:"logging,omitempty" `
MemLimit UnitBytes ` mapstructure:"mem_limit" yaml:"mem_limit,omitempty" json:"mem_limit,omitempty" `
LogDriver string ` mapstructure:"log_driver" yaml:"log_driver,omitempty" json:"log_driver,omitempty" `
MemReservation UnitBytes ` mapstructure:"mem_reservation" yaml:"mem_reservation,omitempty" json:"mem_reservation,omitempty" `
LogOpt map [ string ] string ` mapstructure:"log_opt" yaml:"log_opt,omitempty" json:"log_opt,omitempty" `
MemSwapLimit UnitBytes ` mapstructure:"memswap_limit" yaml:"memswap_limit,omitempty" json:"memswap_limit,omitempty" `
MemLimit UnitBytes ` mapstructure:"mem_limit" yaml:"mem_limit,omitempty" json:"mem_limit,omitempty" `
MemSwappiness UnitBytes ` mapstructure:"mem_swappiness" yaml:"mem_swappiness,omitempty" json:"mem_swappiness,omitempty" `
MemReservation UnitBytes ` mapstructure:"mem_reservation" yaml:"mem_reservation,omitempty" json:"mem_reservation,omitempty" `
MacAddress string ` mapstructure:"mac_address" yaml:"mac_address,omitempty" json:"mac_address,omitempty" `
MemSwapLimit UnitBytes ` mapstructure:"memswap_limit" yaml:"memswap_limit,omitempty" json:"memswap_limit,omitempty" `
Net string ` yaml:"net,omitempty" json:"net,omitempty" `
MemSwappiness UnitBytes ` mapstructure:"mem_swappiness" yaml:"mem_swappiness,omitempty" json:"mem_swappiness,omitempty" `
NetworkMode string ` mapstructure:"network_mode" yaml:"network_mode,omitempty" json:"network_mode,omitempty" `
MacAddress string ` mapstructure:"mac_address" yaml:"mac_address,omitempty" json:"mac_address,omitempty" `
Networks map [ string ] * ServiceNetworkConfig ` yaml:",omitempty" json:"networks,omitempty" `
Net string ` yaml:"net,omitempty" json:"net,omitempty" `
OomKillDisable bool ` mapstructure:"oom_kill_disable" yaml:"oom_kill_disable,omitempty" json:"oom_kill_disable,omitempty" `
NetworkMode string ` mapstructure:"network_mode" yaml:"network_mode,omitempty" json:"network_mode,omitempty" `
OomScoreAdj int64 ` mapstructure:"oom_score_adj" yaml:"oom_score_adj,omitempty" json:"oom_score_adj,omitempty" `
Networks map [ string ] * ServiceNetworkConfig ` yaml:",omitempty" json:"networks,omitempty" `
Pid string ` yaml:",omitempty" json:"pid,omitempty" `
OomKillDisable bool ` mapstructure:"oom_kill_disable" yaml:"oom_kill_disable,omitempty" json:"oom_kill_disable,omitempty" `
PidsLimit int64 ` mapstructure:"pids_limit" yaml:"pids_limit,omitempty" json:"pids_limit,omitempty" `
OomScoreAdj int64 ` mapstructure:"oom_score_adj" yaml:"oom_score_adj,omitempty" json:"oom_score_adj,omitempty" `
Platform string ` yaml:",omitempty" json:"platform,omitempty" `
Pid string ` yaml:",omitempty" json:"pid,omitempty" `
Ports [ ] ServicePortConfig ` yaml:",omitempty" json:"ports,omitempty" `
PidsLimit int64 ` mapstructure:"pids_limit" yaml:"pids_limit,omitempty" json:"pids_limit,omitempty" `
Privileged bool ` yaml:",omitempty" json:"privileged,omitempty" `
Platform string ` yaml:",omitempty" json:"platform,omitempty" `
PullPolicy string ` mapstructure:"pull_policy" yaml:"pull_policy,omitempty" json:"pull_policy,omitempty" `
Ports [ ] ServicePortConfig ` yaml:",omitempty" json:"ports,omitempty" `
ReadOnly bool ` mapstructure:"read_only" yaml:"read_only,omitempty" json:"read_only,omitempty" `
Privileged bool ` yaml:",omitempty" json:"privileged,omitempty" `
Restart string ` yaml:",omitempty" json:"restart,omitempty" `
PullPolicy string ` mapstructure:"pull_policy" yaml:"pull_policy,omitempty" json:"pull_policy,omitempty" `
Runtime string ` yaml:",omitempty" json:"runtime,omitempty" `
ReadOnly bool ` mapstructure:"read_only" yaml:"read_only,omitempty" json:"read_only,omitempty" `
Scale int ` yaml:"-" json:"-" `
Restart string ` yaml:",omitempty" json:"restart,omitempty" `
Secrets [ ] ServiceSecretConfig ` yaml:",omitempty" json:"secrets,omitempty" `
Runtime string ` yaml:",omitempty" json:"runtime,omitempty" `
SecurityOpt [ ] string ` mapstructure:"security_opt" yaml:"security_opt,omitempty" json:"security_opt,omitempty" `
Scale int ` yaml:"-" json:"-" `
ShmSize UnitBytes ` mapstructure:"shm_size" yaml:"shm_size,omitempty" json:"shm_size,omitempty" `
Secrets [ ] ServiceSecretConfig ` yaml:",omitempty" json:"secrets,omitempty" `
StdinOpen bool ` mapstructure:"stdin_open" yaml:"stdin_open,omitempty" json:"stdin_open,omitempty" `
SecurityOpt [ ] string ` mapstructure:"security_opt" yaml:"security_opt,omitempty" json:"security_opt,omitempty" `
StopGracePeriod * Duration ` mapstructure:"stop_grace_period" yaml:"stop_grace_period,omitempty" json:"stop_grace_period,omitempty" `
ShmSize UnitBytes ` mapstructure:"shm_size" yaml:"shm_size,omitempty" json:"shm_size,omitempty" `
StopSignal string ` mapstructure:"stop_signal" yaml:"stop_signal,omitempty" json:"stop_signal,omitempty" `
StdinOpen bool ` mapstructure:"stdin_open" yaml:"stdin_open,omitempty" json:"stdin_open,omitempty" `
Sysctls Mapping ` yaml:",omitempty" json:"sysctls,omitempty" `
StopGracePeriod * Duration ` mapstructure:"stop_grace_period" yaml:"stop_grace_period,omitempty" json:"stop_grace_period,omitempty" `
Tmpfs StringList ` yaml:",omitempty" json:"tmpfs,omitempty" `
StopSignal string ` mapstructure:"stop_signal" yaml:"stop_signal,omitempty" json:"stop_signal,omitempty" `
Tty bool ` mapstructure:"tty" yaml:"tty,omitempty" json:"tty,omitempty" `
Sysctls Mapping ` yaml:",omitempty" json:"sysctls,omitempty" `
Ulimits map [ string ] * UlimitsConfig ` yaml:",omitempty" json:"ulimits,omitempty" `
Tmpfs StringList ` yaml:",omitempty" json:"tmpfs,omitempty" `
User string ` yaml:",omitempty" json:"user,omitempty" `
Tty bool ` mapstructure:"tty" yaml:"tty,omitempty" json:"tty,omitempty" `
UserNSMode string ` mapstructure:"userns_mode" yaml:"userns_mode,omitempty" json:"userns_mode,omitempty" `
Ulimits map [ string ] * UlimitsConfig ` yaml:",omitempty" json:"ulimits,omitempty" `
Uts string ` yaml:"uts,omitempty" json:"uts,omitempty" `
User string ` yaml:",omitempty" json:"user,omitempty" `
VolumeDriver string ` mapstructure:"volume_driver" yaml:"volume_driver,omitempty" json:"volume_driver,omitempty" `
UserNSMode string ` mapstructure:"userns_mode" yaml:"userns_mode,omitempty" json:"userns_mode,omitempty" `
Volumes [ ] ServiceVolumeConfig ` yaml:",omitempty" json:"volumes,omitempty" `
Uts string ` yaml:"uts,omitempty" json:"uts,omitempty" `
VolumesFrom [ ] string ` mapstructure:"volumes_from" yaml:"volumes_from,omitempty" json:"volumes_from,omitempty" `
VolumeDriver string ` mapstructure:"volume_driver" yaml:"volume_driver,omitempty" json:"volume_driver,omitempty" `
WorkingDir string ` mapstructure:"working_dir" yaml:"working_dir,omitempty" json:"working_dir,omitempty" `
Volumes [ ] ServiceVolumeConfig ` yaml:",omitempty" json:"volumes,omitempty" `
VolumesFrom [ ] string ` mapstructure:"volumes_from" yaml:"volumes_from,omitempty" json:"volumes_from,omitempty" `
WorkingDir string ` mapstructure:"working_dir" yaml:"working_dir,omitempty" json:"working_dir,omitempty" `
Extensions map [ string ] interface { } ` yaml:",inline" json:"-" `
Extensions map [ string ] interface { } ` yaml:",inline" json:"-" `
}
}
@ -292,8 +294,12 @@ type BuildConfig struct {
Context string ` yaml:",omitempty" json:"context,omitempty" `
Context string ` yaml:",omitempty" json:"context,omitempty" `
Dockerfile string ` yaml:",omitempty" json:"dockerfile,omitempty" `
Dockerfile string ` yaml:",omitempty" json:"dockerfile,omitempty" `
Args MappingWithEquals ` yaml:",omitempty" json:"args,omitempty" `
Args MappingWithEquals ` yaml:",omitempty" json:"args,omitempty" `
SSH SSHConfig ` yaml:"ssh,omitempty" json:"ssh,omitempty" `
Labels Labels ` yaml:",omitempty" json:"labels,omitempty" `
Labels Labels ` yaml:",omitempty" json:"labels,omitempty" `
CacheFrom StringList ` mapstructure:"cache_from" yaml:"cache_from,omitempty" json:"cache_from,omitempty" `
CacheFrom StringList ` mapstructure:"cache_from" yaml:"cache_from,omitempty" json:"cache_from,omitempty" `
CacheTo StringList ` mapstructure:"cache_to" yaml:"cache_to,omitempty" json:"cache_to,omitempty" `
NoCache bool ` mapstructure:"no_cache" yaml:"no_cache,omitempty" json:"no_cache,omitempty" `
Pull bool ` mapstructure:"pull" yaml:"pull,omitempty" json:"pull,omitempty" `
ExtraHosts HostsList ` mapstructure:"extra_hosts" yaml:"extra_hosts,omitempty" json:"extra_hosts,omitempty" `
ExtraHosts HostsList ` mapstructure:"extra_hosts" yaml:"extra_hosts,omitempty" json:"extra_hosts,omitempty" `
Isolation string ` yaml:",omitempty" json:"isolation,omitempty" `
Isolation string ` yaml:",omitempty" json:"isolation,omitempty" `
Network string ` yaml:",omitempty" json:"network,omitempty" `
Network string ` yaml:",omitempty" json:"network,omitempty" `
@ -305,11 +311,11 @@ type BuildConfig struct {
// BlkioConfig define blkio config
// BlkioConfig define blkio config
type BlkioConfig struct {
type BlkioConfig struct {
Weight uint16 ` yaml:",omitempty" json:"weight,omitempty" `
Weight uint16 ` yaml:",omitempty" json:"weight,omitempty" `
WeightDevice [ ] WeightDevice ` yaml:",omitempty" json:"weight_device,omitempty"`
WeightDevice [ ] WeightDevice ` mapstructure:"weight_device" yaml:",omitempty" json:"weight_device,omitempty"`
DeviceReadBps [ ] ThrottleDevice ` yaml:",omitempty" json:"device_read_bps,omitempty"`
DeviceReadBps [ ] ThrottleDevice ` mapstructure:"device_read_bps" yaml:",omitempty" json:"device_read_bps,omitempty"`
DeviceReadIOps [ ] ThrottleDevice ` yaml:",omitempty" json:"device_read_iops,omitempty"`
DeviceReadIOps [ ] ThrottleDevice ` mapstructure:"device_read_iops" yaml:",omitempty" json:"device_read_iops,omitempty"`
DeviceWriteBps [ ] ThrottleDevice ` yaml:",omitempty" json:"device_write_bps,omitempty"`
DeviceWriteBps [ ] ThrottleDevice ` mapstructure:"device_write_bps" yaml:",omitempty" json:"device_write_bps,omitempty"`
DeviceWriteIOps [ ] ThrottleDevice ` yaml:",omitempty" json:"device_write_iops,omitempty"`
DeviceWriteIOps [ ] ThrottleDevice ` mapstructure:"device_write_iops" yaml:",omitempty" json:"device_write_iops,omitempty"`
Extensions map [ string ] interface { } ` yaml:",inline" json:"-" `
Extensions map [ string ] interface { } ` yaml:",inline" json:"-" `
}
}
@ -423,6 +429,39 @@ func (l Labels) Add(key, value string) Labels {
return l
return l
}
}
type SSHKey struct {
ID string
Path string
}
// SSHConfig is a mapping type for SSH build config
type SSHConfig [ ] SSHKey
func ( s SSHConfig ) Get ( id string ) ( string , error ) {
for _ , sshKey := range s {
if sshKey . ID == id {
return sshKey . Path , nil
}
}
return "" , fmt . Errorf ( "ID %s not found in SSH keys" , id )
}
// MarshalYAML makes SSHKey implement yaml.Marshaller
func ( s SSHKey ) MarshalYAML ( ) ( interface { } , error ) {
if s . Path == "" {
return s . ID , nil
}
return fmt . Sprintf ( "%s: %s" , s . ID , s . Path ) , nil
}
// MarshalJSON makes SSHKey implement json.Marshaller
func ( s SSHKey ) MarshalJSON ( ) ( [ ] byte , error ) {
if s . Path == "" {
return [ ] byte ( fmt . Sprintf ( ` "%s" ` , s . ID ) ) , nil
}
return [ ] byte ( fmt . Sprintf ( ` "%s": %s ` , s . ID , s . Path ) ) , nil
}
// MappingWithColon is a mapping type that can be converted from a list of
// MappingWithColon is a mapping type that can be converted from a list of
// 'key: value' strings
// 'key: value' strings
type MappingWithColon map [ string ] string
type MappingWithColon map [ string ] string
@ -493,6 +532,7 @@ type Resource struct {
// TODO: types to convert from units and ratios
// TODO: types to convert from units and ratios
NanoCPUs string ` mapstructure:"cpus" yaml:"cpus,omitempty" json:"cpus,omitempty" `
NanoCPUs string ` mapstructure:"cpus" yaml:"cpus,omitempty" json:"cpus,omitempty" `
MemoryBytes UnitBytes ` mapstructure:"memory" yaml:"memory,omitempty" json:"memory,omitempty" `
MemoryBytes UnitBytes ` mapstructure:"memory" yaml:"memory,omitempty" json:"memory,omitempty" `
PIds int64 ` mapstructure:"pids" yaml:"pids,omitempty" json:"pids,omitempty" `
Devices [ ] DeviceRequest ` mapstructure:"devices" yaml:"devices,omitempty" json:"devices,omitempty" `
Devices [ ] DeviceRequest ` mapstructure:"devices" yaml:"devices,omitempty" json:"devices,omitempty" `
GenericResources [ ] GenericResource ` mapstructure:"generic_resources" yaml:"generic_resources,omitempty" json:"generic_resources,omitempty" `
GenericResources [ ] GenericResource ` mapstructure:"generic_resources" yaml:"generic_resources,omitempty" json:"generic_resources,omitempty" `
@ -579,7 +619,7 @@ type ServicePortConfig struct {
Mode string ` yaml:",omitempty" json:"mode,omitempty" `
Mode string ` yaml:",omitempty" json:"mode,omitempty" `
HostIP string ` mapstructure:"host_ip" yaml:"host_ip,omitempty" json:"host_ip,omitempty" `
HostIP string ` mapstructure:"host_ip" yaml:"host_ip,omitempty" json:"host_ip,omitempty" `
Target uint32 ` yaml:",omitempty" json:"target,omitempty" `
Target uint32 ` yaml:",omitempty" json:"target,omitempty" `
Published uint32 ` yaml:",omitempty" json:"published,omitempty" `
Published string ` yaml:",omitempty" json:"published,omitempty" `
Protocol string ` yaml:",omitempty" json:"protocol,omitempty" `
Protocol string ` yaml:",omitempty" json:"protocol,omitempty" `
Extensions map [ string ] interface { } ` yaml:",inline" json:"-" `
Extensions map [ string ] interface { } ` yaml:",inline" json:"-" `
@ -613,21 +653,13 @@ func ParsePortConfig(value string) ([]ServicePortConfig, error) {
func convertPortToPortConfig ( port nat . Port , portBindings map [ nat . Port ] [ ] nat . PortBinding ) ( [ ] ServicePortConfig , error ) {
func convertPortToPortConfig ( port nat . Port , portBindings map [ nat . Port ] [ ] nat . PortBinding ) ( [ ] ServicePortConfig , error ) {
var portConfigs [ ] ServicePortConfig
var portConfigs [ ] ServicePortConfig
for _ , binding := range portBindings [ port ] {
for _ , binding := range portBindings [ port ] {
startHostPort , endHostPort , err := nat . ParsePortRange ( binding . HostPort )
portConfigs = append ( portConfigs , ServicePortConfig {
HostIP : binding . HostIP ,
if err != nil && binding . HostPort != "" {
Protocol : strings . ToLower ( port . Proto ( ) ) ,
return nil , fmt . Errorf ( "invalid hostport binding (%s) for port (%s)" , binding . HostPort , port . Port ( ) )
Target : uint32 ( port . Int ( ) ) ,
}
Published : binding . HostPort ,
Mode : "ingress" ,
for i := startHostPort ; i <= endHostPort ; i ++ {
} )
portConfigs = append ( portConfigs , ServicePortConfig {
HostIP : binding . HostIP ,
Protocol : strings . ToLower ( port . Proto ( ) ) ,
Target : uint32 ( port . Int ( ) ) ,
Published : uint32 ( i ) ,
Mode : "ingress" ,
} )
}
}
}
return portConfigs , nil
return portConfigs , nil
}
}
@ -655,16 +687,30 @@ const (
VolumeTypeTmpfs = "tmpfs"
VolumeTypeTmpfs = "tmpfs"
// VolumeTypeNamedPipe is the type for mounting Windows named pipes
// VolumeTypeNamedPipe is the type for mounting Windows named pipes
VolumeTypeNamedPipe = "npipe"
VolumeTypeNamedPipe = "npipe"
// SElinuxShared share the volume content
SElinuxShared = "z"
// SElinuxUnshared label content as private unshared
SElinuxUnshared = "Z"
)
)
// ServiceVolumeBind are options for a service volume of type bind
// ServiceVolumeBind are options for a service volume of type bind
type ServiceVolumeBind struct {
type ServiceVolumeBind struct {
SELinux string ` mapstructure:"selinux" yaml:",omitempty" json:"selinux,omitempty" `
Propagation string ` yaml:",omitempty" json:"propagation,omitempty" `
Propagation string ` yaml:",omitempty" json:"propagation,omitempty" `
CreateHostPath bool ` mapstructure:"create_host_path" yaml:"create_host_path,omitempty" json:"create_host_path,omitempty" `
CreateHostPath bool ` mapstructure:"create_host_path" yaml:"create_host_path,omitempty" json:"create_host_path,omitempty" `
Extensions map [ string ] interface { } ` yaml:",inline" json:"-" `
Extensions map [ string ] interface { } ` yaml:",inline" json:"-" `
}
}
// SELinux represents the SELinux re-labeling options.
const (
// SELinuxShared option indicates that the bind mount content is shared among multiple containers
SELinuxShared string = "z"
// SELinuxPrivate option indicates that the bind mount content is private and unshared
SELinuxPrivate string = "Z"
)
// Propagation represents the propagation of a mount.
// Propagation represents the propagation of a mount.
const (
const (
// PropagationRPrivate RPRIVATE
// PropagationRPrivate RPRIVATE