-
Notifications
You must be signed in to change notification settings - Fork 295
Use existing subnets when creating/updating cluster #227
Changes from all commits
8820e8e
dc4cdc2
f034cbb
2c9e398
c7ee3a1
bc7c8a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,8 +171,10 @@ controller: | |
# subnets: | ||
# - availabilityZone: us-west-1a | ||
# instanceCIDR: "10.0.0.0/24" | ||
# subnetId: "subnet-xxxxxxxx" #optional | ||
# - availabilityZone: us-west-1b | ||
# instanceCIDR: "10.0.1.0/24" | ||
# subnetId: "subnet-xxxxxxxx" #optional | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: |
||
|
||
# CIDR for all service IP addresses | ||
# serviceCIDR: "10.3.0.0/24" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,12 +51,8 @@ | |
{{end}} | ||
"VPCZoneIdentifier": [ | ||
{{range $index, $subnet := .Subnets}} | ||
{{with $subnetLogicalName := printf "Subnet%d" $index}} | ||
{{if gt $index 0}},{{end}} | ||
{ | ||
"Ref": "{{$subnetLogicalName}}" | ||
} | ||
{{end}} | ||
{{$subnet.Ref}} | ||
{{end}} | ||
] | ||
}, | ||
|
@@ -159,12 +155,8 @@ | |
], | ||
"VPCZoneIdentifier": [ | ||
{{range $index, $subnet := .Subnets}} | ||
{{with $subnetLogicalName := printf "Subnet%d" $index}} | ||
{{if gt $index 0}},{{end}} | ||
{ | ||
"Ref": "{{$subnetLogicalName}}" | ||
} | ||
{{end}} | ||
{{$subnet.Ref}} | ||
{{end}} | ||
], | ||
"LoadBalancerNames" : [ | ||
|
@@ -660,7 +652,7 @@ | |
"Subnets" : [ | ||
{{range $index, $subnet := .Subnets}} | ||
{{if gt $index 0}},{{end}} | ||
{ "Ref" : "Subnet{{$index}}" } | ||
{{$subnet.Ref}} | ||
{{end}} | ||
], | ||
"Listeners" : [ | ||
|
@@ -1084,17 +1076,17 @@ | |
} | ||
{{end}} | ||
{{range $index, $subnet := .Subnets}} | ||
{{with $subnetLogicalName := printf "Subnet%d" $index}} | ||
{{if not $subnet.SubnetId }} | ||
, | ||
"{{$subnetLogicalName}}": { | ||
"{{$subnet.SubnetLogicalName}}": { | ||
"Properties": { | ||
"AvailabilityZone": "{{$subnet.AvailabilityZone}}", | ||
"CidrBlock": "{{$subnet.InstanceCIDR}}", | ||
"MapPublicIpOnLaunch": {{$.MapPublicIPs}}, | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "{{$.ClusterName}}-{{$subnetLogicalName}}" | ||
"Value": "{{$.ClusterName}}-{{$subnet.SubnetLogicalName}}" | ||
}, | ||
{ | ||
"Key": "KubernetesCluster", | ||
|
@@ -1105,19 +1097,19 @@ | |
}, | ||
"Type": "AWS::EC2::Subnet" | ||
} | ||
{{end}} | ||
{{if $.ElasticFileSystemID}} | ||
, | ||
"{{$subnetLogicalName}}MountTarget": { | ||
"{{$subnet.SubnetLogicalName}}MountTarget": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: When the |
||
"Properties" : { | ||
"FileSystemId": "{{$.ElasticFileSystemID}}", | ||
"SubnetId": { "Ref": "{{$subnetLogicalName}}" }, | ||
"SubnetId": {{$subnet.Ref}}, | ||
"SecurityGroups": [ { "Ref": "SecurityGroupMountTarget" } ] | ||
}, | ||
"Type" : "AWS::EFS::MountTarget" | ||
} | ||
{{end}} | ||
{{end}} | ||
{{end}} | ||
{{if not .VPCID}} | ||
, | ||
"{{.VPCLogicalName}}": { | ||
|
@@ -1190,14 +1182,12 @@ | |
"Type": "AWS::EC2::VPCGatewayAttachment" | ||
} | ||
{{range $index, $subnet := .Subnets}} | ||
{{with $subnetLogicalName := printf "Subnet%d" $index}} | ||
{{if not $subnet.SubnetId }} | ||
, | ||
"{{$subnetLogicalName}}RouteTableAssociation": { | ||
"{{$subnet.SubnetLogicalName}}RouteTableAssociation": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit but we probably need to create a route table association if and only if the one doesn't exist for the subnet or I guess a cluster creation fails because of a duplicated association in the route table? |
||
"Properties": { | ||
"RouteTableId": { "Ref" : "RouteTable"}, | ||
"SubnetId": { | ||
"Ref": "{{$subnetLogicalName}}" | ||
} | ||
"SubnetId": {{$subnet.Ref}} | ||
}, | ||
"Type": "AWS::EC2::SubnetRouteTableAssociation" | ||
} | ||
|
@@ -1206,14 +1196,12 @@ | |
{{else}} | ||
{{if .RouteTableID}} | ||
{{range $index, $subnet := .Subnets}} | ||
{{with $subnetLogicalName := printf "Subnet%d" $index}} | ||
{{if not $subnet.SubnetId }} | ||
, | ||
"{{$subnetLogicalName}}RouteTableAssociation": { | ||
"{{$subnet.SubnetLogicalName}}RouteTableAssociation": { | ||
"Properties": { | ||
"RouteTableId": "{{$.RouteTableID}}", | ||
"SubnetId": { | ||
"Ref": "{{$subnetLogicalName}}" | ||
} | ||
"SubnetId": {{$subnet.Ref}} | ||
}, | ||
"Type": "AWS::EC2::SubnetRouteTableAssociation" | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally it should work with just
subnetId
specifieddoes it work like that already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I did not pull any data from AWS, it uses {{$subnet.AvailabilityZone}} at some points so I used the static value. I'll look into pulling that from existing subnet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why AvailabilityZone is even needed if subnets are specified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I tried getting data from AWS but I couldn't find a nice place to put that checks as i would also need to set availabilityZone and instanceCIDR to not break other stuff. So i ran into other validation failing when removing this out.
I don't mind setting availabilityZone and instanceCIDR and I will leave it as is for now. It would take me to much time to correctly do this. If anyone has an suggestion, easy fix or want to help whit this that would be awesome.