Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

Adding Virtual Private Cloud (VPC) added (deprecated use vpc) in private networking #4867

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion drivers/digitalocean/digitalocean.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type Driver struct {
UserDataFile string
Monitoring bool
Tags string
VPC string
}

const (
Expand Down Expand Up @@ -104,7 +105,7 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
mcnflag.BoolFlag{
EnvVar: "DIGITALOCEAN_PRIVATE_NETWORKING",
Name: "digitalocean-private-networking",
Usage: "enable private networking for droplet",
Usage: "enable private networking for droplet (deprecated use vpc)",
},
mcnflag.BoolFlag{
EnvVar: "DIGITALOCEAN_BACKUPS",
Expand All @@ -126,6 +127,11 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
Name: "digitalocean-tags",
Usage: "comma-separated list of tags to apply to the Droplet",
},
mcnflag.StringFlag{
EnvVar: "DIGITALOCEAN_VPC",
Name: "digitalocean-vpc",
Usage: "virtual private cloud network",
},
}
}

Expand Down Expand Up @@ -165,6 +171,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.SSHKey = flags.String("digitalocean-ssh-key-path")
d.Monitoring = flags.Bool("digitalocean-monitoring")
d.Tags = flags.String("digitalocean-tags")
d.VPC = flags.String("digitalocean-vpc")

d.SetSwarmConfigFromFlags(flags)

Expand Down Expand Up @@ -241,6 +248,7 @@ func (d *Driver) Create() error {
SSHKeys: []godo.DropletCreateSSHKey{{ID: d.SSHKeyID}},
Monitoring: d.Monitoring,
Tags: d.getTags(),
VPC: d.vpc,
}

newDroplet, _, err := client.Droplets.Create(context.TODO(), createRequest)
Expand Down