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

Option to automatically assign externally managed ELBs to the worker autoscaling group #93

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 27 additions & 17 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ const (

func newDefaultCluster() *Cluster {
experimental := Experimental{
NodeDrainer{
Enabled: false,
},
NodeLabel{
Enabled: false,
},
AwsEnvironment{
Enabled: false,
},
Expand All @@ -45,6 +39,15 @@ func newDefaultCluster() *Cluster {
Disk: "xvdb",
Filesystem: "xfs",
},
LoadBalancer{
Enabled: false,
},
NodeDrainer{
Enabled: false,
},
NodeLabel{
Enabled: false,
},
WaitSignal{
Enabled: false,
MaxBatchSize: 1,
Expand Down Expand Up @@ -208,13 +211,25 @@ type Subnet struct {
}

type Experimental struct {
NodeDrainer NodeDrainer `yaml:"nodeDrainer"`
NodeLabel NodeLabel `yaml:"nodeLabel"`
AwsEnvironment AwsEnvironment `yaml:"awsEnvironment"`
EphemeralImageStorage EphemeralImageStorage `yaml:"ephemeralImageStorage"`
LoadBalancer LoadBalancer `yaml:"loadBalancer"`
NodeDrainer NodeDrainer `yaml:"nodeDrainer"`
NodeLabel NodeLabel `yaml:"nodeLabel"`
WaitSignal WaitSignal `yaml:"waitSignal"`
}

type AwsEnvironment struct {
Enabled bool `yaml:"enabled"`
Environment map[string]string `yaml:"environment"`
}

type EphemeralImageStorage struct {
Enabled bool `yaml:"enabled"`
Disk string `yaml:"disk"`
Filesystem string `yaml:"filesystem"`
}

type NodeDrainer struct {
Enabled bool `yaml:"enabled"`
}
Expand All @@ -223,22 +238,17 @@ type NodeLabel struct {
Enabled bool `yaml:"enabled"`
}

type AwsEnvironment struct {
Enabled bool `yaml:"enabled"`
Environment map[string]string `yaml:"environment"`
type LoadBalancer struct {
Enabled bool `yaml:"enabled"`
Names []string `yaml:"names"`
SecurityGroupIds []string `yaml:"securityGroupIds"`
}

type WaitSignal struct {
Enabled bool `yaml:"enabled"`
MaxBatchSize int `yaml:"maxBatchSize"`
}

type EphemeralImageStorage struct {
Enabled bool `yaml:"enabled"`
Disk string `yaml:"disk"`
Filesystem string `yaml:"filesystem"`
}

const (
vpcLogicalName = "VPC"
)
Expand Down
4 changes: 4 additions & 0 deletions config/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ kmsKeyArn: "{{.KMSKeyARN}}"
# # This option has not yet been tested with rkt as container runtime
# ephemeralImageStorage:
# enabled: true
# loadBalancer:
# enabled: true
# names: [ "manuallymanagedelb" ]
# securityGroupIds: [ "sg-87654321" ]

# AWS Tags for cloudformation stack resources
#stackTags:
Expand Down
19 changes: 16 additions & 3 deletions config/templates/stack-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
"Value": "{{.ClusterName}}-kube-aws-worker"
}
],
{{if .Experimental.LoadBalancer.Enabled}}
"LoadBalancerNames" : [
{{range $index, $elb := .Experimental.LoadBalancer.Names}}
{{if $index}},{{end}}
"{{$elb}}"
{{end}}
],
{{end}}
"VPCZoneIdentifier": [
{{range $index, $subnet := .Subnets}}
{{with $subnetLogicalName := printf "Subnet%d" $index}}
Expand Down Expand Up @@ -116,9 +124,9 @@
{{end}}
{{end}}
],
"LoadBalancerNames" : [
{ "Ref" : "ElbAPIServer" }
]
"LoadBalancerNames" : [
{ "Ref" : "ElbAPIServer" }
]
},
{{if .Experimental.WaitSignal.Enabled}}
"CreationPolicy" : {
Expand Down Expand Up @@ -477,6 +485,11 @@
"InstanceType": "{{.WorkerInstanceType}}",
"KeyName": "{{.KeyName}}",
"SecurityGroups": [
{{if .Experimental.LoadBalancer.Enabled}}
{{range $elbsg := .Experimental.LoadBalancer.SecurityGroupIds}}
"{{$elbsg}}",
{{end}}
{{end}}
{
"Ref": "SecurityGroupWorker"
}
Expand Down