mirror of https://github.com/docker/docs.git
Merge pull request #1668 from ehazlett/carry-1454-ec2-private-address
Amazon Ec2 - Add the option amazonec2-use-private-address
This commit is contained in:
commit
cf10bf45b5
|
@ -59,6 +59,7 @@ type Driver struct {
|
||||||
RequestSpotInstance bool
|
RequestSpotInstance bool
|
||||||
SpotPrice string
|
SpotPrice string
|
||||||
PrivateIPOnly bool
|
PrivateIPOnly bool
|
||||||
|
UsePrivateIP bool
|
||||||
Monitoring bool
|
Monitoring bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,6 +161,10 @@ func GetCreateFlags() []cli.Flag {
|
||||||
Name: "amazonec2-private-address-only",
|
Name: "amazonec2-private-address-only",
|
||||||
Usage: "Only use a private IP address",
|
Usage: "Only use a private IP address",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "amazonec2-use-private-address",
|
||||||
|
Usage: "Force the usage of private IP address",
|
||||||
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "amazonec2-monitoring",
|
Name: "amazonec2-monitoring",
|
||||||
Usage: "Set this flag to enable CloudWatch monitoring",
|
Usage: "Set this flag to enable CloudWatch monitoring",
|
||||||
|
@ -208,6 +213,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
||||||
d.SSHUser = flags.String("amazonec2-ssh-user")
|
d.SSHUser = flags.String("amazonec2-ssh-user")
|
||||||
d.SSHPort = 22
|
d.SSHPort = 22
|
||||||
d.PrivateIPOnly = flags.Bool("amazonec2-private-address-only")
|
d.PrivateIPOnly = flags.Bool("amazonec2-private-address-only")
|
||||||
|
d.UsePrivateIP = flags.Bool("amazonec2-use-private-address")
|
||||||
d.Monitoring = flags.Bool("amazonec2-monitoring")
|
d.Monitoring = flags.Bool("amazonec2-monitoring")
|
||||||
|
|
||||||
if d.AccessKey == "" {
|
if d.AccessKey == "" {
|
||||||
|
@ -415,6 +421,10 @@ func (d *Driver) GetIP() (string, error) {
|
||||||
return inst.PrivateIpAddress, nil
|
return inst.PrivateIpAddress, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if d.UsePrivateIP {
|
||||||
|
return inst.PrivateIpAddress, nil
|
||||||
|
}
|
||||||
|
|
||||||
return inst.IpAddress, nil
|
return inst.IpAddress, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,7 @@ func getDefaultTestDriverFlags() *DriverOptionsMock {
|
||||||
"amazonec2-request-spot-instance": false,
|
"amazonec2-request-spot-instance": false,
|
||||||
"amazonec2-spot-price": "",
|
"amazonec2-spot-price": "",
|
||||||
"amazonec2-private-address-only": false,
|
"amazonec2-private-address-only": false,
|
||||||
|
"amazonec2-use-private-address": false,
|
||||||
"amazonec2-monitoring": false,
|
"amazonec2-monitoring": false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue