Skip to content

Commit 592c1f1

Browse files
committed
add option to create private IP
1 parent d3d4f16 commit 592c1f1

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Successfully removed linode
7272
| `linode-swap-size` | `LINODE_SWAP_SIZE` | `512` | The amount of swap space provisioned on the Linode Instance
7373
| `linode-stackscript` | `LINODE_STACKSCRIPT` | None | Specifies the Linode StackScript to use to create the instance, either by numeric ID, or using the form *username*/*label*.
7474
| `linode-stackscript-data` | `LINODE_STACKSCRIPT_DATA` | None | A JSON string specifying data that is passed (via UDF) to the selected StackScript.
75+
| `linode-create-private-ip` | `LINODE_CREATE_PRIVATE_IP` | None | A flag specifying to create private IP for the Linode instance.
7576

7677
## Discussion / Help
7778

pkg/drivers/linode/linode.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ type Driver struct {
2525
*drivers.BaseDriver
2626
client *linodego.Client
2727

28-
APIToken string
29-
IPAddress string
30-
DockerPort int
28+
APIToken string
29+
IPAddress string
30+
DockerPort int
31+
CreatePrivateIP bool
3132

3233
InstanceID int
3334
InstanceLabel string
@@ -194,6 +195,11 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
194195
Usage: "A JSON string specifying data for the selected StackScript",
195196
Value: "",
196197
},
198+
mcnflag.BoolFlag{
199+
EnvVar: "LINODE_CREATE_PRIVATE_IP",
200+
Name: "linode-create-private-ip",
201+
Usage: "Create private IP for the instance",
202+
},
197203
}
198204
}
199205

@@ -233,6 +239,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
233239
d.InstanceLabel = flags.String("linode-label")
234240
d.SwapSize = flags.Int("linode-swap-size")
235241
d.DockerPort = flags.Int("linode-docker-port")
242+
d.CreatePrivateIP = flags.Bool("linode-create-private-ip")
236243

237244
d.SetSwarmConfigFromFlags(flags)
238245

@@ -351,6 +358,7 @@ func (d *Driver) Create() error {
351358
AuthorizedKeys: []string{strings.TrimSpace(publicKey)},
352359
Image: d.InstanceImage,
353360
SwapSize: &d.SwapSize,
361+
PrivateIP: d.CreatePrivateIP,
354362
}
355363

356364
if d.StackScriptID != 0 {

0 commit comments

Comments
 (0)