Implement ipamconfig.subnet and be more explicit about restart policy always.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2016-11-10 16:22:31 -05:00
parent ef90081d44
commit dfd1227906

View file

@ -178,13 +178,19 @@ func convertNetworks(
Options: network.DriverOpts,
}
if network.Ipam.Driver != "" {
createOpts.IPAM = &networktypes.IPAM{
Driver: network.Ipam.Driver,
}
if network.Ipam.Driver != "" || len(network.Ipam.Config) > 0 {
createOpts.IPAM = &networktypes.IPAM{}
}
// TODO: IPAMConfig.Config
if network.Ipam.Driver != "" {
createOpts.IPAM.Driver = network.Ipam.Driver
}
for _, ipamConfig := range network.Ipam.Config {
config := networktypes.IPAMConfig{
Subnet: ipamConfig.Subnet,
}
createOpts.IPAM.Config = append(createOpts.IPAM.Config, config)
}
result[internalName] = createOpts
}
@ -523,8 +529,12 @@ func convertRestartPolicy(restart string, source *composetypes.RestartPolicy) (*
}
// TODO: is this an accurate convertion?
switch {
case policy.IsNone(), policy.IsAlways(), policy.IsUnlessStopped():
case policy.IsNone():
return nil, nil
case policy.IsAlways(), policy.IsUnlessStopped():
return &swarm.RestartPolicy{
Condition: swarm.RestartPolicyConditionAny,
}, nil
case policy.IsOnFailure():
attempts := uint64(policy.MaximumRetryCount)
return &swarm.RestartPolicy{