diff --git a/MAINTAINERS b/MAINTAINERS index ce9bfa76ef..bc91f51300 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11,11 +11,13 @@ [Org] [Org."Core maintainers"] people = [ - "dgageot", "jeanlaurent", - "shin-", ] + [Org.Alumni] + people = [ + "shin-", + ] [people] # A reference list of all people associated with the project. @@ -24,11 +26,6 @@ # ADD YOURSELF HERE IN ALPHABETICAL ORDER - [people.dgageot] - Name = "David Gageot" - Email = "david.gageot@docker.com" - GitHub = "dgageot" - [people.jeanlaurent] Name = "Jean-Laurent de Morlhon" Email = "jeanlaurent@docker.com" @@ -36,5 +33,5 @@ [people.shin-] Name = "Joffrey F" - Email = "joffrey@docker.com" + Email = "f.joffrey@gmail.com" GitHub = "shin-" diff --git a/drivers/amazonec2/amazonec2.go b/drivers/amazonec2/amazonec2.go index f4796baa08..b7704ad9d8 100644 --- a/drivers/amazonec2/amazonec2.go +++ b/drivers/amazonec2/amazonec2.go @@ -39,6 +39,7 @@ const ( defaultVolumeType = "gp2" defaultZone = "a" defaultSecurityGroup = machineSecurityGroupName + defaultSSHPort = 22 defaultSSHUser = "ubuntu" defaultSpotPrice = "0.50" defaultBlockDurationMinutes = 0 @@ -211,9 +212,15 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag { Usage: "AWS IAM Instance Profile", EnvVar: "AWS_INSTANCE_PROFILE", }, + mcnflag.IntFlag{ + Name: "amazonec2-ssh-port", + Usage: "SSH port", + Value: defaultSSHPort, + EnvVar: "AWS_SSH_PORT", + }, mcnflag.StringFlag{ Name: "amazonec2-ssh-user", - Usage: "Set the name of the ssh user", + Usage: "SSH username", Value: defaultSSHUser, EnvVar: "AWS_SSH_USER", }, @@ -294,6 +301,7 @@ func NewDriver(hostName, storePath string) *Driver { SpotPrice: defaultSpotPrice, BlockDurationMinutes: defaultBlockDurationMinutes, BaseDriver: &drivers.BaseDriver{ + SSHPort: defaultSSHPort, SSHUser: defaultSSHUser, MachineName: hostName, StorePath: storePath, @@ -363,7 +371,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error { d.VolumeType = flags.String("amazonec2-volume-type") d.IamInstanceProfile = flags.String("amazonec2-iam-instance-profile") d.SSHUser = flags.String("amazonec2-ssh-user") - d.SSHPort = 22 + d.SSHPort = flags.Int("amazonec2-ssh-port") d.PrivateIPOnly = flags.Bool("amazonec2-private-address-only") d.UsePrivateIP = flags.Bool("amazonec2-use-private-address") d.Monitoring = flags.Bool("amazonec2-monitoring") @@ -837,6 +845,14 @@ func (d *Driver) GetSSHHostname() (string, error) { return d.GetIP() } +func (d *Driver) GetSSHPort() (int, error) { + if d.SSHPort == 0 { + d.SSHPort = defaultSSHPort + } + + return d.SSHPort, nil +} + func (d *Driver) GetSSHUsername() string { if d.SSHUser == "" { d.SSHUser = defaultSSHUser @@ -1161,11 +1177,11 @@ func (d *Driver) configureSecurityGroupPermissions(group *ec2.SecurityGroup) ([] perms := []*ec2.IpPermission{} - if !hasPorts["22/tcp"] { + if !hasPorts[fmt.Sprintf("%d/tcp", d.BaseDriver.SSHPort)] { perms = append(perms, &ec2.IpPermission{ IpProtocol: aws.String("tcp"), - FromPort: aws.Int64(22), - ToPort: aws.Int64(22), + FromPort: aws.Int64(int64(d.BaseDriver.SSHPort)), + ToPort: aws.Int64(int64(d.BaseDriver.SSHPort)), IpRanges: []*ec2.IpRange{{CidrIp: aws.String(ipRange)}}, }) } diff --git a/drivers/amazonec2/region.go b/drivers/amazonec2/region.go index ce52857746..ae990d67ea 100644 --- a/drivers/amazonec2/region.go +++ b/drivers/amazonec2/region.go @@ -19,6 +19,7 @@ var regionDetails map[string]*region = map[string]*region{ "ca-central-1": {"ami-8d9e19e9"}, "cn-north-1": {"ami-cc4499a1"}, // Note: this is 20180126 "cn-northwest-1": {"ami-fd0e1a9f"}, // Note: this is 20180126 + "eu-north-1": {"ami-017ff17f"}, "eu-central-1": {"ami-bc4925d3"}, "eu-west-1": {"ami-0b541372"}, "eu-west-2": {"ami-ff46a298"}, diff --git a/drivers/google/compute_util.go b/drivers/google/compute_util.go index 3940269e07..e095bab0c0 100644 --- a/drivers/google/compute_util.go +++ b/drivers/google/compute_util.go @@ -265,7 +265,7 @@ func (c *ComputeUtil) createInstance(d *Driver) error { }, ServiceAccounts: []*raw.ServiceAccount{ { - Email: "default", + Email: d.ServiceAccount, Scopes: strings.Split(d.Scopes, ","), }, }, diff --git a/drivers/google/google.go b/drivers/google/google.go index ab9df17922..18a07ee452 100644 --- a/drivers/google/google.go +++ b/drivers/google/google.go @@ -26,6 +26,7 @@ type Driver struct { Preemptible bool UseInternalIP bool UseInternalIPOnly bool + ServiceAccount string Scopes string DiskSize int Project string @@ -35,15 +36,16 @@ type Driver struct { } const ( - defaultZone = "us-central1-a" - defaultUser = "docker-user" - defaultMachineType = "n1-standard-1" - defaultImageName = "ubuntu-os-cloud/global/images/ubuntu-1604-xenial-v20170721" - defaultScopes = "https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write" - defaultDiskType = "pd-standard" - defaultDiskSize = 10 - defaultNetwork = "default" - defaultSubnetwork = "" + defaultZone = "us-central1-a" + defaultUser = "docker-user" + defaultMachineType = "n1-standard-1" + defaultImageName = "ubuntu-os-cloud/global/images/ubuntu-1604-xenial-v20170721" + defaultServiceAccount = "default" + defaultScopes = "https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write" + defaultDiskType = "pd-standard" + defaultDiskSize = 10 + defaultNetwork = "default" + defaultSubnetwork = "" ) // GetCreateFlags registers the flags this driver adds to @@ -79,6 +81,12 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag { Usage: "GCE Project", EnvVar: "GOOGLE_PROJECT", }, + mcnflag.StringFlag{ + Name: "google-service-account", + Usage: "GCE Service Account for the VM (email address)", + Value: defaultServiceAccount, + EnvVar: "GOOGLE_SERVICE_ACCOUNT", + }, mcnflag.StringFlag{ Name: "google-scopes", Usage: "GCE Scopes (comma-separated if multiple scopes)", @@ -150,14 +158,15 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag { // NewDriver creates a Driver with the specified storePath. func NewDriver(machineName string, storePath string) *Driver { return &Driver{ - Zone: defaultZone, - DiskType: defaultDiskType, - DiskSize: defaultDiskSize, - MachineType: defaultMachineType, - MachineImage: defaultImageName, - Network: defaultNetwork, - Subnetwork: defaultSubnetwork, - Scopes: defaultScopes, + Zone: defaultZone, + DiskType: defaultDiskType, + DiskSize: defaultDiskSize, + MachineType: defaultMachineType, + MachineImage: defaultImageName, + Network: defaultNetwork, + Subnetwork: defaultSubnetwork, + ServiceAccount: defaultServiceAccount, + Scopes: defaultScopes, BaseDriver: &drivers.BaseDriver{ SSHUser: defaultUser, MachineName: machineName, @@ -205,6 +214,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error { d.Preemptible = flags.Bool("google-preemptible") d.UseInternalIP = flags.Bool("google-use-internal-ip") || flags.Bool("google-use-internal-ip-only") d.UseInternalIPOnly = flags.Bool("google-use-internal-ip-only") + d.ServiceAccount = flags.String("google-service-account") d.Scopes = flags.String("google-scopes") d.Tags = flags.String("google-tags") d.OpenPorts = flags.StringSlice("google-open-port") diff --git a/drivers/openstack/client.go b/drivers/openstack/client.go index ef84f407db..8b47b86e49 100644 --- a/drivers/openstack/client.go +++ b/drivers/openstack/client.go @@ -69,6 +69,7 @@ func (c *GenericClient) CreateInstance(d *Driver) (string, error) { SecurityGroups: d.SecurityGroups, AvailabilityZone: d.AvailabilityZone, ConfigDrive: d.ConfigDrive, + Metadata: d.GetMetadata(), } if d.NetworkId != "" { serverOpts.Networks = []servers.Network{ diff --git a/drivers/openstack/openstack.go b/drivers/openstack/openstack.go index b6ec9823eb..7e305d840a 100644 --- a/drivers/openstack/openstack.go +++ b/drivers/openstack/openstack.go @@ -49,6 +49,7 @@ type Driver struct { FloatingIpPoolId string IpVersion int ConfigDrive bool + metadata string client Client // ExistingKey keeps track of whether the key was created by us or we used an existing one. If an existing one was used, we shouldn't delete it when the machine is deleted. ExistingKey bool @@ -233,6 +234,12 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag { Name: "openstack-config-drive", Usage: "Enables the OpenStack config drive for the instance", }, + mcnflag.StringFlag{ + EnvVar: "OS_METADATA", + Name: "openstack-metadata", + Usage: "OpenStack Instance Metadata (e.g. key1,value1,key2,value2)", + Value: "", + }, } } @@ -286,6 +293,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error { d.ImageName = flags.String("openstack-image-name") d.NetworkId = flags.String("openstack-net-id") d.NetworkName = flags.String("openstack-net-name") + d.metadata = flags.String("openstack-metadata") if flags.String("openstack-sec-groups") != "" { d.SecurityGroups = strings.Split(flags.String("openstack-sec-groups"), ",") } @@ -487,6 +495,22 @@ func (d *Driver) Remove() error { return nil } +func (d *Driver) GetMetadata() map[string]string { + metadata := make(map[string]string) + + if d.metadata != "" { + items := strings.Split(d.metadata, ",") + if len(items) > 0 && len(items)%2 != 0 { + log.Warnf("Metadata are not key value in pairs. %d elements found", len(items)) + } + for i := 0; i < len(items)-1; i += 2 { + metadata[items[i]] = items[i+1] + } + } + + return metadata +} + const ( errorMandatoryEnvOrOption string = "%s must be specified either using the environment variable %s or the CLI option %s" errorMandatoryOption string = "%s must be specified using the CLI option %s" diff --git a/drivers/softlayer/softlayer.go b/drivers/softlayer/softlayer.go index 5b12d70303..6d10905dd8 100644 --- a/drivers/softlayer/softlayer.go +++ b/drivers/softlayer/softlayer.go @@ -114,7 +114,6 @@ func (c *Client) newRequest(method, uri string, body interface{}) ([]byte, error } req.SetBasicAuth(c.User, c.ApiKey) - req.Method = method resp, err := client.Do(req) if err != nil { diff --git a/drivers/vmwarefusion/fusion_darwin.go b/drivers/vmwarefusion/fusion_darwin.go index 1211304e31..fb22c96ab5 100644 --- a/drivers/vmwarefusion/fusion_darwin.go +++ b/drivers/vmwarefusion/fusion_darwin.go @@ -436,7 +436,7 @@ func (d *Driver) Start() error { return err } else if !os.IsNotExist(err) { // create mountpoint and mount shared folder - command := "([ ! -d " + shareDir + " ]&& sudo mkdir " + shareDir + "; sudo mount --bind /mnt/hgfs/" + shareDir + " " + shareDir + ") || ([ -f /usr/local/bin/vmhgfs-fuse ]&& sudo /usr/local/bin/vmhgfs-fuse -o allow_other .host:/" + shareName + " " + shareDir + ") || sudo mount -t vmhgfs -o uid=$(id -u),gid=$(id -g) .host:/" + shareName + " " + shareDir + command := "([ ! -d " + shareDir + " ]&& sudo mkdir " + shareDir + "; sudo mount --bind /mnt/hgfs/" + shareDir + " " + shareDir + ") || ([ -f /usr/local/bin/vmhgfs-fuse ]&& sudo /usr/local/bin/vmhgfs-fuse -o nonempty -o allow_other .host:/" + shareName + " " + shareDir + ") || sudo mount -t vmhgfs -o uid=$(id -u),gid=$(id -g) .host:/" + shareName + " " + shareDir vmrun("-gu", B2DUser, "-gp", B2DPass, "runScriptInGuest", d.vmxPath(), "/bin/sh", command) } } diff --git a/libmachine/provision/arch.go b/libmachine/provision/arch.go index 6a73998301..86dc90cd74 100644 --- a/libmachine/provision/arch.go +++ b/libmachine/provision/arch.go @@ -94,7 +94,7 @@ func (provisioner *ArchProvisioner) Provision(swarmOptions swarm.Options, authOp provisioner.EngineOptions = engineOptions swarmOptions.Env = engineOptions.Env - storageDriver, err := decideStorageDriver(provisioner, "overlay", engineOptions.StorageDriver) + storageDriver, err := decideStorageDriver(provisioner, "overlay2", engineOptions.StorageDriver) if err != nil { return err } diff --git a/libmachine/provision/arch_test.go b/libmachine/provision/arch_test.go index 4aa19b61a6..6533ed39a2 100644 --- a/libmachine/provision/arch_test.go +++ b/libmachine/provision/arch_test.go @@ -14,7 +14,7 @@ func TestArchDefaultStorageDriver(t *testing.T) { p := NewArchProvisioner(&fakedriver.Driver{}).(*ArchProvisioner) p.SSHCommander = provisiontest.NewFakeSSHCommander(provisiontest.FakeSSHCommanderOptions{}) p.Provision(swarm.Options{}, auth.Options{}, engine.Options{}) - if p.EngineOptions.StorageDriver != "overlay" { - t.Fatal("Default storage driver should be overlay") + if p.EngineOptions.StorageDriver != "overlay2" { + t.Fatal("Default storage driver should be overlay2") } }