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

Commit

Permalink
Merge pull request #93 from pieterlange/feature/attach-worker-elb
Browse files Browse the repository at this point in the history
Option to automatically assign externally managed ELBs to the worker autoscaling group
  • Loading branch information
mumoshu authored Nov 25, 2016
2 parents faadb70 + b4b1eba commit 347f9de
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 20 deletions.
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

0 comments on commit 347f9de

Please sign in to comment.