diff --git a/bbl/fixtures/cloud-config-cf-elb.yml b/bbl/fixtures/cloud-config-cf-elb.yml index 2f209f756..14a35f63a 100644 --- a/bbl/fixtures/cloud-config-cf-elb.yml +++ b/bbl/fixtures/cloud-config-cf-elb.yml @@ -95,8 +95,53 @@ networks: static: - 10.0.63.190-10.0.63.254 type: manual +- name: default + subnets: + - az: z1 + cloud_properties: + security_groups: + - some-internal-security-group + subnet: some-subnet-1 + gateway: 10.0.16.1 + range: 10.0.16.0/20 + reserved: + - 10.0.16.2-10.0.16.3 + - 10.0.31.255 + static: + - 10.0.31.190-10.0.31.254 + - az: z2 + cloud_properties: + security_groups: + - some-internal-security-group + subnet: some-subnet-2 + gateway: 10.0.32.1 + range: 10.0.32.0/20 + reserved: + - 10.0.32.2-10.0.32.3 + - 10.0.47.255 + static: + - 10.0.47.190-10.0.47.254 + - az: z3 + cloud_properties: + security_groups: + - some-internal-security-group + subnet: some-subnet-3 + gateway: 10.0.48.1 + range: 10.0.48.0/20 + reserved: + - 10.0.48.2-10.0.48.3 + - 10.0.63.255 + static: + - 10.0.63.190-10.0.63.254 + type: manual vm_types: +- name: default + cloud_properties: + instance_type: m3.medium + ephemeral_disk: + size: 1024 + type: gp2 - name: m3.medium cloud_properties: instance_type: m3.medium diff --git a/bbl/fixtures/cloud-config-concourse-elb.yml b/bbl/fixtures/cloud-config-concourse-elb.yml index 387ff34b2..a57f2b69b 100644 --- a/bbl/fixtures/cloud-config-concourse-elb.yml +++ b/bbl/fixtures/cloud-config-concourse-elb.yml @@ -95,8 +95,53 @@ networks: static: - 10.0.63.190-10.0.63.254 type: manual +- name: default + subnets: + - az: z1 + cloud_properties: + security_groups: + - some-internal-security-group + subnet: some-subnet-1 + gateway: 10.0.16.1 + range: 10.0.16.0/20 + reserved: + - 10.0.16.2-10.0.16.3 + - 10.0.31.255 + static: + - 10.0.31.190-10.0.31.254 + - az: z2 + cloud_properties: + security_groups: + - some-internal-security-group + subnet: some-subnet-2 + gateway: 10.0.32.1 + range: 10.0.32.0/20 + reserved: + - 10.0.32.2-10.0.32.3 + - 10.0.47.255 + static: + - 10.0.47.190-10.0.47.254 + - az: z3 + cloud_properties: + security_groups: + - some-internal-security-group + subnet: some-subnet-3 + gateway: 10.0.48.1 + range: 10.0.48.0/20 + reserved: + - 10.0.48.2-10.0.48.3 + - 10.0.63.255 + static: + - 10.0.63.190-10.0.63.254 + type: manual vm_types: +- name: default + cloud_properties: + instance_type: m3.medium + ephemeral_disk: + size: 1024 + type: gp2 - name: m3.medium cloud_properties: instance_type: m3.medium diff --git a/bbl/fixtures/cloud-config-no-elb.yml b/bbl/fixtures/cloud-config-no-elb.yml index 89b9e80fd..0522706ca 100644 --- a/bbl/fixtures/cloud-config-no-elb.yml +++ b/bbl/fixtures/cloud-config-no-elb.yml @@ -95,8 +95,53 @@ networks: static: - 10.0.63.190-10.0.63.254 type: manual +- name: default + subnets: + - az: z1 + cloud_properties: + security_groups: + - some-internal-security-group + subnet: some-subnet-1 + gateway: 10.0.16.1 + range: 10.0.16.0/20 + reserved: + - 10.0.16.2-10.0.16.3 + - 10.0.31.255 + static: + - 10.0.31.190-10.0.31.254 + - az: z2 + cloud_properties: + security_groups: + - some-internal-security-group + subnet: some-subnet-2 + gateway: 10.0.32.1 + range: 10.0.32.0/20 + reserved: + - 10.0.32.2-10.0.32.3 + - 10.0.47.255 + static: + - 10.0.47.190-10.0.47.254 + - az: z3 + cloud_properties: + security_groups: + - some-internal-security-group + subnet: some-subnet-3 + gateway: 10.0.48.1 + range: 10.0.48.0/20 + reserved: + - 10.0.48.2-10.0.48.3 + - 10.0.63.255 + static: + - 10.0.63.190-10.0.63.254 + type: manual vm_types: +- name: default + cloud_properties: + instance_type: m3.medium + ephemeral_disk: + size: 1024 + type: gp2 - name: m3.medium cloud_properties: instance_type: m3.medium diff --git a/bosh/fixtures/cloud_config_with_load_balancers.yml b/bosh/fixtures/cloud_config_with_load_balancers.yml index 1f45bd3f7..c98d4ff10 100644 --- a/bosh/fixtures/cloud_config_with_load_balancers.yml +++ b/bosh/fixtures/cloud_config_with_load_balancers.yml @@ -10,6 +10,13 @@ azs: availability_zone: us-east-1c vm_types: +- name: default + cloud_properties: + instance_type: m3.medium + ephemeral_disk: + size: 1024 + type: gp2 + - name: m3.medium cloud_properties: instance_type: m3.medium @@ -225,6 +232,45 @@ networks: subnet: some-subnet-3 security_groups: - some-security-group-3 +- name: default + type: manual + subnets: + - az: z1 + gateway: 10.0.16.1 + range: 10.0.16.0/20 + static: + - 10.0.31.190-10.0.31.254 + reserved: + - 10.0.16.2-10.0.16.3 + - 10.0.31.255 + cloud_properties: + subnet: some-subnet-1 + security_groups: + - some-security-group-1 + - az: z2 + gateway: 10.0.32.1 + range: 10.0.32.0/20 + static: + - 10.0.47.190-10.0.47.254 + reserved: + - 10.0.32.2-10.0.32.3 + - 10.0.47.255 + cloud_properties: + subnet: some-subnet-2 + security_groups: + - some-security-group-2 + - az: z3 + gateway: 10.0.48.1 + range: 10.0.48.0/20 + static: + - 10.0.63.190-10.0.63.254 + reserved: + - 10.0.48.2-10.0.48.3 + - 10.0.63.255 + cloud_properties: + subnet: some-subnet-3 + security_groups: + - some-security-group-3 disk_types: - name: 1GB diff --git a/bosh/fixtures/cloud_config_without_load_balancers.yml b/bosh/fixtures/cloud_config_without_load_balancers.yml index 08c9ef329..0a17356e4 100644 --- a/bosh/fixtures/cloud_config_without_load_balancers.yml +++ b/bosh/fixtures/cloud_config_without_load_balancers.yml @@ -10,6 +10,13 @@ azs: availability_zone: us-east-1c vm_types: +- name: default + cloud_properties: + instance_type: m3.medium + ephemeral_disk: + size: 1024 + type: gp2 + - name: m3.medium cloud_properties: instance_type: m3.medium @@ -225,6 +232,45 @@ networks: subnet: some-subnet-3 security_groups: - some-security-group-3 +- name: default + type: manual + subnets: + - az: z1 + gateway: 10.0.16.1 + range: 10.0.16.0/20 + static: + - 10.0.31.190-10.0.31.254 + reserved: + - 10.0.16.2-10.0.16.3 + - 10.0.31.255 + cloud_properties: + subnet: some-subnet-1 + security_groups: + - some-security-group-1 + - az: z2 + gateway: 10.0.32.1 + range: 10.0.32.0/20 + static: + - 10.0.47.190-10.0.47.254 + reserved: + - 10.0.32.2-10.0.32.3 + - 10.0.47.255 + cloud_properties: + subnet: some-subnet-2 + security_groups: + - some-security-group-2 + - az: z3 + gateway: 10.0.48.1 + range: 10.0.48.0/20 + static: + - 10.0.63.190-10.0.63.254 + reserved: + - 10.0.48.2-10.0.48.3 + - 10.0.63.255 + cloud_properties: + subnet: some-subnet-3 + security_groups: + - some-security-group-3 disk_types: - name: 1GB diff --git a/bosh/networks_generator.go b/bosh/networks_generator.go index 19dd27605..79cea5cbb 100644 --- a/bosh/networks_generator.go +++ b/bosh/networks_generator.go @@ -37,10 +37,15 @@ func NewNetworksGenerator(inputs []SubnetInput, azAssociations map[string]string func (n NetworksGenerator) Generate() ([]Network, error) { const MINIMUM_CIDR_SIZE = 5 - network := Network{ + privateNetwork := Network{ Name: "private", Type: "manual", } + defaultNetwork := Network{ + Name: "default", + Type: "manual", + } + for _, subnet := range n.subnetInputs { parsedCidr, err := ParseCIDRBlock(subnet.CIDR) if err != nil { @@ -74,9 +79,11 @@ func (n NetworksGenerator) Generate() ([]Network, error) { SecurityGroups: subnet.SecurityGroups, }, } - network.Subnets = append(network.Subnets, networkSubnet) + privateNetwork.Subnets = append(privateNetwork.Subnets, networkSubnet) + defaultNetwork.Subnets = append(defaultNetwork.Subnets, networkSubnet) } return []Network{ - network, + privateNetwork, + defaultNetwork, }, nil } diff --git a/bosh/networks_generator_test.go b/bosh/networks_generator_test.go index 15d224ed8..932991621 100644 --- a/bosh/networks_generator_test.go +++ b/bosh/networks_generator_test.go @@ -98,6 +98,66 @@ var _ = Describe("NetworksGenerator", func() { }, }, }, + bosh.Network{ + Name: "default", + Type: "manual", + Subnets: []bosh.NetworkSubnet{ + { + AZ: "z1", + Gateway: "10.0.16.1", + Range: "10.0.16.0/20", + Reserved: []string{ + "10.0.16.2-10.0.16.3", + "10.0.31.255", + }, + Static: []string{ + "10.0.31.190-10.0.31.254", + }, + CloudProperties: bosh.SubnetCloudProperties{ + Subnet: "some-subnet-1", + SecurityGroups: []string{ + "some-security-group-1", + }, + }, + }, + { + AZ: "z2", + Gateway: "10.0.32.1", + Range: "10.0.32.0/20", + Reserved: []string{ + "10.0.32.2-10.0.32.3", + "10.0.47.255", + }, + Static: []string{ + "10.0.47.190-10.0.47.254", + }, + CloudProperties: bosh.SubnetCloudProperties{ + Subnet: "some-subnet-2", + SecurityGroups: []string{ + "some-security-group-2", + }, + }, + }, + { + AZ: "z3", + Gateway: "10.0.48.1", + Range: "10.0.48.0/20", + Reserved: []string{ + "10.0.48.2-10.0.48.3", + "10.0.63.255", + }, + Static: []string{ + "10.0.63.190-10.0.63.254", + }, + CloudProperties: bosh.SubnetCloudProperties{ + Subnet: "some-subnet-3", + SecurityGroups: []string{ + "some-security-group-3", + }, + }, + }, + }, + }, )) }) Context("failure cases", func() { diff --git a/bosh/vm_types_generator.go b/bosh/vm_types_generator.go index a40ef9604..9391861a1 100644 --- a/bosh/vm_types_generator.go +++ b/bosh/vm_types_generator.go @@ -24,6 +24,7 @@ func NewVMTypesGenerator() VMTypesGenerator { func (g VMTypesGenerator) Generate() []VMType { return []VMType{ + createVMTypeWithCustomName("default", "m3.medium"), createVMType("m3.medium"), createVMType("m3.large"), createVMType("m3.xlarge"), @@ -57,8 +58,12 @@ func (g VMTypesGenerator) Generate() []VMType { } func createVMType(instanceType string) VMType { + return createVMTypeWithCustomName(instanceType, instanceType) +} + +func createVMTypeWithCustomName(name, instanceType string) VMType { return VMType{ - Name: instanceType, + Name: name, CloudProperties: &VMTypeCloudProperties{ InstanceType: instanceType, EphemeralDisk: &EphemeralDisk{ diff --git a/bosh/vm_types_generator_test.go b/bosh/vm_types_generator_test.go index adc8cd06c..2909f18db 100644 --- a/bosh/vm_types_generator_test.go +++ b/bosh/vm_types_generator_test.go @@ -41,6 +41,17 @@ var _ = Describe("VMTypes Generator", func() { ExpectToContainVMType(vmTypes, "t2.small") ExpectToContainVMType(vmTypes, "t2.medium") ExpectToContainVMType(vmTypes, "t2.large") + Expect(vmTypes).To(ContainElement( + bosh.VMType{ + Name: "default", + CloudProperties: &bosh.VMTypeCloudProperties{ + InstanceType: "m3.medium", + EphemeralDisk: &bosh.EphemeralDisk{ + Size: 1024, + Type: "gp2", + }, + }, + })) }) }) }) diff --git a/cloudconfig/gcp/cloud_config_template.go b/cloudconfig/gcp/cloud_config_template.go index 3affbc5f3..cbe9623d9 100644 --- a/cloudconfig/gcp/cloud_config_template.go +++ b/cloudconfig/gcp/cloud_config_template.go @@ -48,6 +48,12 @@ disk_types: encrypted: true vm_types: +- name: default + cloud_properties: + machine_type: n1-standard-1 + root_disk_size_gb: 10 + root_disk_type: pd-ssd + - name: n1-standard-2 cloud_properties: machine_type: n1-standard-2 diff --git a/cloudconfig/gcp/fixtures/cloud-config-cf-lb.yml b/cloudconfig/gcp/fixtures/cloud-config-cf-lb.yml index 267152736..a1371038a 100644 --- a/cloudconfig/gcp/fixtures/cloud-config-cf-lb.yml +++ b/cloudconfig/gcp/fixtures/cloud-config-cf-lb.yml @@ -102,8 +102,59 @@ networks: tags: - some-tag type: manual +- name: default + subnets: + - az: z1 + gateway: 10.0.16.1 + range: 10.0.16.0/20 + reserved: + - 10.0.16.2-10.0.16.3 + - 10.0.31.255 + static: + - 10.0.31.190-10.0.31.254 + cloud_properties: + ephemeral_external_ip: true + network_name: some-network-name + subnetwork_name: some-subnetwork-name + tags: + - some-tag + - az: z2 + gateway: 10.0.32.1 + range: 10.0.32.0/20 + reserved: + - 10.0.32.2-10.0.32.3 + - 10.0.47.255 + static: + - 10.0.47.190-10.0.47.254 + cloud_properties: + ephemeral_external_ip: true + network_name: some-network-name + subnetwork_name: some-subnetwork-name + tags: + - some-tag + - az: z3 + gateway: 10.0.48.1 + range: 10.0.48.0/20 + reserved: + - 10.0.48.2-10.0.48.3 + - 10.0.63.255 + static: + - 10.0.63.190-10.0.63.254 + cloud_properties: + ephemeral_external_ip: true + network_name: some-network-name + subnetwork_name: some-subnetwork-name + tags: + - some-tag + type: manual vm_types: +- name: default + cloud_properties: + machine_type: n1-standard-1 + root_disk_size_gb: 10 + root_disk_type: pd-ssd + - name: n1-standard-2 cloud_properties: machine_type: n1-standard-2 diff --git a/cloudconfig/gcp/fixtures/cloud-config-concourse-lb.yml b/cloudconfig/gcp/fixtures/cloud-config-concourse-lb.yml index 1dfa3a8ce..8a1b82e7e 100644 --- a/cloudconfig/gcp/fixtures/cloud-config-concourse-lb.yml +++ b/cloudconfig/gcp/fixtures/cloud-config-concourse-lb.yml @@ -102,8 +102,59 @@ networks: tags: - some-tag type: manual +- name: default + subnets: + - az: z1 + gateway: 10.0.16.1 + range: 10.0.16.0/20 + reserved: + - 10.0.16.2-10.0.16.3 + - 10.0.31.255 + static: + - 10.0.31.190-10.0.31.254 + cloud_properties: + ephemeral_external_ip: true + network_name: some-network-name + subnetwork_name: some-subnetwork-name + tags: + - some-tag + - az: z2 + gateway: 10.0.32.1 + range: 10.0.32.0/20 + reserved: + - 10.0.32.2-10.0.32.3 + - 10.0.47.255 + static: + - 10.0.47.190-10.0.47.254 + cloud_properties: + ephemeral_external_ip: true + network_name: some-network-name + subnetwork_name: some-subnetwork-name + tags: + - some-tag + - az: z3 + gateway: 10.0.48.1 + range: 10.0.48.0/20 + reserved: + - 10.0.48.2-10.0.48.3 + - 10.0.63.255 + static: + - 10.0.63.190-10.0.63.254 + cloud_properties: + ephemeral_external_ip: true + network_name: some-network-name + subnetwork_name: some-subnetwork-name + tags: + - some-tag + type: manual vm_types: +- name: default + cloud_properties: + machine_type: n1-standard-1 + root_disk_size_gb: 10 + root_disk_type: pd-ssd + - name: n1-standard-2 cloud_properties: machine_type: n1-standard-2 diff --git a/cloudconfig/gcp/fixtures/cloud-config-no-lb.yml b/cloudconfig/gcp/fixtures/cloud-config-no-lb.yml index d77f36ae7..efd931cf0 100644 --- a/cloudconfig/gcp/fixtures/cloud-config-no-lb.yml +++ b/cloudconfig/gcp/fixtures/cloud-config-no-lb.yml @@ -102,8 +102,59 @@ networks: tags: - some-tag type: manual +- name: default + subnets: + - az: z1 + gateway: 10.0.16.1 + range: 10.0.16.0/20 + reserved: + - 10.0.16.2-10.0.16.3 + - 10.0.31.255 + static: + - 10.0.31.190-10.0.31.254 + cloud_properties: + ephemeral_external_ip: true + network_name: some-network-name + subnetwork_name: some-subnetwork-name + tags: + - some-tag + - az: z2 + gateway: 10.0.32.1 + range: 10.0.32.0/20 + reserved: + - 10.0.32.2-10.0.32.3 + - 10.0.47.255 + static: + - 10.0.47.190-10.0.47.254 + cloud_properties: + ephemeral_external_ip: true + network_name: some-network-name + subnetwork_name: some-subnetwork-name + tags: + - some-tag + - az: z3 + gateway: 10.0.48.1 + range: 10.0.48.0/20 + reserved: + - 10.0.48.2-10.0.48.3 + - 10.0.63.255 + static: + - 10.0.63.190-10.0.63.254 + cloud_properties: + ephemeral_external_ip: true + network_name: some-network-name + subnetwork_name: some-subnetwork-name + tags: + - some-tag + type: manual vm_types: +- name: default + cloud_properties: + machine_type: n1-standard-1 + root_disk_size_gb: 10 + root_disk_type: pd-ssd + - name: n1-standard-2 cloud_properties: machine_type: n1-standard-2 diff --git a/cloudconfig/gcp/networks_generator.go b/cloudconfig/gcp/networks_generator.go index f5e4da1a8..14a72b699 100644 --- a/cloudconfig/gcp/networks_generator.go +++ b/cloudconfig/gcp/networks_generator.go @@ -45,11 +45,16 @@ func NewNetworksGenerator(networkName, subnetworkName string, tags, azs []string } func (n NetworksGenerator) Generate() ([]Network, error) { - network := Network{ + privateNetwork := Network{ Name: "private", Type: "manual", } + defaultNetwork := Network{ + Name: "default", + Type: "manual", + } + cidrBlocks := []string{} for i := 1; i <= len(n.azs); i++ { cidrBlocks = append(cidrBlocks, fmt.Sprintf("10.0.%d.0/20", 16*(i))) @@ -86,9 +91,11 @@ func (n NetworksGenerator) Generate() ([]Network, error) { Tags: n.tags, }, } - network.Subnets = append(network.Subnets, networkSubnet) + privateNetwork.Subnets = append(privateNetwork.Subnets, networkSubnet) + defaultNetwork.Subnets = append(defaultNetwork.Subnets, networkSubnet) } return []Network{ - network, + privateNetwork, + defaultNetwork, }, nil } diff --git a/cloudconfig/gcp/networks_generator_test.go b/cloudconfig/gcp/networks_generator_test.go index 08c80135e..23c55655a 100644 --- a/cloudconfig/gcp/networks_generator_test.go +++ b/cloudconfig/gcp/networks_generator_test.go @@ -91,6 +91,74 @@ var _ = Describe("NetworksGenerator", func() { }, }, }, + gcp.Network{ + Name: "default", + Type: "manual", + Subnets: []gcp.NetworkSubnet{ + { + AZ: "z1", + Gateway: "10.0.16.1", + Range: "10.0.16.0/20", + Reserved: []string{ + "10.0.16.2-10.0.16.3", + "10.0.31.255", + }, + Static: []string{ + "10.0.31.190-10.0.31.254", + }, + CloudProperties: gcp.SubnetCloudProperties{ + EphemeralExternalIP: true, + NetworkName: "some-network-name", + SubnetworkName: "some-subnetwork-name", + Tags: []string{ + "some-tag", + "some-other-tag", + }, + }, + }, + { + AZ: "z2", + Gateway: "10.0.32.1", + Range: "10.0.32.0/20", Reserved: []string{ + "10.0.32.2-10.0.32.3", + "10.0.47.255", + }, + Static: []string{ + "10.0.47.190-10.0.47.254", + }, + CloudProperties: gcp.SubnetCloudProperties{ + EphemeralExternalIP: true, + NetworkName: "some-network-name", + SubnetworkName: "some-subnetwork-name", + Tags: []string{ + "some-tag", + "some-other-tag", + }, + }, + }, + { + AZ: "z3", + Gateway: "10.0.48.1", + Range: "10.0.48.0/20", + Reserved: []string{ + "10.0.48.2-10.0.48.3", + "10.0.63.255", + }, + Static: []string{ + "10.0.63.190-10.0.63.254", + }, + CloudProperties: gcp.SubnetCloudProperties{ + EphemeralExternalIP: true, + NetworkName: "some-network-name", + SubnetworkName: "some-subnetwork-name", + Tags: []string{ + "some-tag", + "some-other-tag", + }, + }, + }, + }, + }, )) })