Skip to content

Commit

Permalink
Add default network and vm_type to cloud config
Browse files Browse the repository at this point in the history
[#136470885]

Signed-off-by: Angela Chin <[email protected]>
  • Loading branch information
rizwanreza authored and Pivotal committed Jan 18, 2017
1 parent 06138c4 commit 1926a98
Show file tree
Hide file tree
Showing 15 changed files with 551 additions and 7 deletions.
45 changes: 45 additions & 0 deletions bbl/fixtures/cloud-config-cf-elb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 45 additions & 0 deletions bbl/fixtures/cloud-config-concourse-elb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 45 additions & 0 deletions bbl/fixtures/cloud-config-no-elb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 46 additions & 0 deletions bosh/fixtures/cloud_config_with_load_balancers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
46 changes: 46 additions & 0 deletions bosh/fixtures/cloud_config_without_load_balancers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions bosh/networks_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
60 changes: 60 additions & 0 deletions bosh/networks_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Loading

0 comments on commit 1926a98

Please sign in to comment.