2018-04-10 10:29:48 -04:00
|
|
|
package daemon
|
|
|
|
|
2018-04-13 11:02:56 -04:00
|
|
|
import "github.com/docker/docker/internal/test/environment"
|
|
|
|
|
2018-04-10 10:29:48 -04:00
|
|
|
// WithExperimental sets the daemon in experimental mode
|
|
|
|
func WithExperimental(d *Daemon) {
|
|
|
|
d.experimental = true
|
2018-06-01 06:47:38 -04:00
|
|
|
d.init = true
|
|
|
|
}
|
|
|
|
|
|
|
|
// WithInit sets the daemon init
|
|
|
|
func WithInit(d *Daemon) {
|
|
|
|
d.init = true
|
2018-04-10 10:29:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// WithDockerdBinary sets the dockerd binary to the specified one
|
|
|
|
func WithDockerdBinary(dockerdBinary string) func(*Daemon) {
|
|
|
|
return func(d *Daemon) {
|
|
|
|
d.dockerdBinary = dockerdBinary
|
|
|
|
}
|
|
|
|
}
|
2018-04-11 06:10:17 -04:00
|
|
|
|
|
|
|
// WithSwarmPort sets the swarm port to use for swarm mode
|
|
|
|
func WithSwarmPort(port int) func(*Daemon) {
|
|
|
|
return func(d *Daemon) {
|
|
|
|
d.SwarmPort = port
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// WithSwarmListenAddr sets the swarm listen addr to use for swarm mode
|
|
|
|
func WithSwarmListenAddr(listenAddr string) func(*Daemon) {
|
|
|
|
return func(d *Daemon) {
|
|
|
|
d.swarmListenAddr = listenAddr
|
|
|
|
}
|
|
|
|
}
|
2018-04-13 11:02:56 -04:00
|
|
|
|
2018-07-30 11:25:02 -04:00
|
|
|
// WithSwarmDefaultAddrPool sets the swarm default address pool to use for swarm mode
|
|
|
|
func WithSwarmDefaultAddrPool(defaultAddrPool []string) func(*Daemon) {
|
|
|
|
return func(d *Daemon) {
|
|
|
|
d.DefaultAddrPool = defaultAddrPool
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// WithSwarmDefaultAddrPoolSubnetSize sets the subnet length mask of swarm default address pool to use for swarm mode
|
|
|
|
func WithSwarmDefaultAddrPoolSubnetSize(subnetSize uint32) func(*Daemon) {
|
|
|
|
return func(d *Daemon) {
|
|
|
|
d.SubnetSize = subnetSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-20 16:44:40 -05:00
|
|
|
// WithSwarmDataPathPort sets the swarm datapath port to use for swarm mode
|
|
|
|
func WithSwarmDataPathPort(datapathPort uint32) func(*Daemon) {
|
|
|
|
return func(d *Daemon) {
|
|
|
|
d.DataPathPort = datapathPort
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-13 11:02:56 -04:00
|
|
|
// WithEnvironment sets options from internal/test/environment.Execution struct
|
|
|
|
func WithEnvironment(e environment.Execution) func(*Daemon) {
|
|
|
|
return func(d *Daemon) {
|
|
|
|
if e.DaemonInfo.ExperimentalBuild {
|
|
|
|
d.experimental = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|