Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Commit 10e4333

Browse files
committed
Simple toggle to stop the automatic assignment of public IP's for all
the nodes. This toggle requires the operator to bootstrap the VPC with a NAT gateway.
1 parent 689f9c0 commit 10e4333

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

config/config.go

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func newDefaultCluster() *Cluster {
6565
CreateRecordSet: false,
6666
RecordSetTTL: 300,
6767
Subnets: []*Subnet{},
68+
MapPublicIPs: true,
6869
Experimental: experimental,
6970
}
7071
}
@@ -167,6 +168,7 @@ type Cluster struct {
167168
StackTags map[string]string `yaml:"stackTags,omitempty"`
168169
UseCalico bool `yaml:"useCalico,omitempty"`
169170
Subnets []*Subnet `yaml:"subnets,omitempty"`
171+
MapPublicIPs bool `yaml:"mapPublicIPs,omitempty"`
170172
Experimental Experimental `yaml:"experimental"`
171173
providedEncryptService encryptService
172174
}

config/templates/cluster.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ kmsKeyArn: "{{.KMSKeyARN}}"
125125
# IP address of Kubernetes dns service (must be contained by serviceCIDR)
126126
# dnsServiceIP: 10.3.0.10
127127

128+
# Uncomment to provision nodes without a public IP. This assumes your VPC route table is setup to route to the internet via a NAT gateway.
129+
# If you did not set vpcId and routeTableId the cluster will not bootstrap.
130+
# mapPublicIPs: false
131+
128132
# Expiration in days from creation time of TLS assets. By default, the CA will
129133
# expire in 10 years and the server and client certificates will expire in 1
130134
# year.

config/templates/stack-template.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@
341341
"KeyName": "{{$.KeyName}}",
342342
"NetworkInterfaces": [
343343
{
344-
"AssociatePublicIpAddress": true,
344+
"AssociatePublicIpAddress": {{.MapPublicIPs}},
345345
"DeleteOnTermination": true,
346346
"DeviceIndex": "0",
347347
"GroupSet": [
@@ -452,6 +452,11 @@
452452
"Protocol" : "TCP"
453453
}
454454
],
455+
{{if .MapPublicIPs}}
456+
"Scheme": "internet-facing",
457+
{{else}}
458+
"Scheme": "internal",
459+
{{end}}
455460
"SecurityGroups" : [
456461
{ "Ref" : "SecurityGroupElbAPIServer" }
457462
]
@@ -794,7 +799,7 @@
794799
"Properties": {
795800
"AvailabilityZone": "{{$subnet.AvailabilityZone}}",
796801
"CidrBlock": "{{$subnet.InstanceCIDR}}",
797-
"MapPublicIpOnLaunch": true,
802+
"MapPublicIpOnLaunch": {{.MapPublicIPs}},
798803
"Tags": [
799804
{
800805
"Key": "KubernetesCluster",

0 commit comments

Comments
 (0)