Skip to content

Commit

Permalink
Merge pull request #244 from weaveworks/fix-243
Browse files Browse the repository at this point in the history
Update `--node-type` to `--max-pods` mapping
  • Loading branch information
errordeveloper authored Oct 10, 2018
2 parents 35f6901 + d853151 commit 70c379f
Show file tree
Hide file tree
Showing 20 changed files with 4,248 additions and 56 deletions.
8 changes: 7 additions & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,7 @@ required = [
source = "https://github.com/errordeveloper/goformation"
# revision = "1358de5008ca15a213cc432549977e09cd4d2beb"
branch = "pin-eksctl"

[[constraint]]
name = "github.com/dave/jennifer"
version = "v1.1.0"
196 changes: 141 additions & 55 deletions pkg/nodebootstrap/maxpods.go
Original file line number Diff line number Diff line change
@@ -1,59 +1,145 @@
package nodebootstrap

// Generated from https://raw.github.com/awslabs/amazon-eks-ami/master/files/eni-max-pods.txt
var maxPodsPerNodeType = map[string]int{
"c4.large": 29,
"c4.xlarge": 58,
"c4.2xlarge": 58,
"c4.4xlarge": 234,
"c4.8xlarge": 234,
"c5.large": 29,
"c5.xlarge": 58,
"c5.2xlarge": 58,
"c5.4xlarge": 234,
"c5.9xlarge": 234,
"c5.18xlarge": 737,
"i3.large": 29,
"i3.xlarge": 58,
"i3.2xlarge": 58,
"i3.4xlarge": 234,
"i3.8xlarge": 234,
"i3.16xlarge": 737,
"m3.medium": 12,
"m3.large": 29,
"m3.xlarge": 58,
"m3.2xlarge": 118,
"m4.large": 20,
"m4.xlarge": 58,
"m4.2xlarge": 58,
"m4.4xlarge": 234,
"m4.10xlarge": 234,
"m5.large": 29,
"m5.xlarge": 58,
"m5.2xlarge": 58,
"m5.4xlarge": 234,
"m5.12xlarge": 234,
"m5.24xlarge": 737,
"p2.xlarge": 58,
"p2.8xlarge": 234,
"p2.16xlarge": 234,
"p3.2xlarge": 58,
"p3.8xlarge": 234,
"p3.16xlarge": 234,
"r3.xlarge": 58,
"r3.2xlarge": 58,
"r3.4xlarge": 234,
"r3.8xlarge": 234,
"r4.large": 29,
"r4.xlarge": 58,
"r4.2xlarge": 58,
"r4.4xlarge": 234,
"r4.8xlarge": 234,
"r4.16xlarge": 737,
"t2.small": 8,
"t2.medium": 17,
"t2.large": 35,
"t2.xlarge": 44,
"t2.2xlarge": 44,
"x1.16xlarge": 234,
"x1.32xlarge": 234,
"c1.medium": 12,
"c1.xlarge": 58,
"c3.2xlarge": 58,
"c3.4xlarge": 234,
"c3.8xlarge": 234,
"c3.large": 29,
"c3.xlarge": 58,
"c4.2xlarge": 58,
"c4.4xlarge": 234,
"c4.8xlarge": 234,
"c4.large": 29,
"c4.xlarge": 58,
"c5.18xlarge": 737,
"c5.2xlarge": 58,
"c5.4xlarge": 234,
"c5.9xlarge": 234,
"c5.large": 29,
"c5.xlarge": 58,
"c5d.18xlarge": 737,
"c5d.2xlarge": 58,
"c5d.4xlarge": 234,
"c5d.9xlarge": 234,
"c5d.large": 29,
"c5d.xlarge": 58,
"cc2.8xlarge": 234,
"cr1.8xlarge": 234,
"d2.2xlarge": 58,
"d2.4xlarge": 234,
"d2.8xlarge": 234,
"d2.xlarge": 58,
"f1.16xlarge": 394,
"f1.2xlarge": 58,
"g2.2xlarge": 58,
"g2.8xlarge": 234,
"g3.16xlarge": 737,
"g3.4xlarge": 234,
"g3.8xlarge": 234,
"h1.16xlarge": 737,
"h1.2xlarge": 58,
"h1.4xlarge": 234,
"h1.8xlarge": 234,
"hs1.8xlarge": 234,
"i2.2xlarge": 58,
"i2.4xlarge": 234,
"i2.8xlarge": 234,
"i2.xlarge": 58,
"i3.16xlarge": 737,
"i3.2xlarge": 58,
"i3.4xlarge": 234,
"i3.8xlarge": 234,
"i3.large": 29,
"i3.metal": 737,
"i3.xlarge": 58,
"m1.large": 29,
"m1.medium": 12,
"m1.small": 8,
"m1.xlarge": 58,
"m2.2xlarge": 118,
"m2.4xlarge": 234,
"m2.xlarge": 58,
"m3.2xlarge": 118,
"m3.large": 29,
"m3.medium": 12,
"m3.xlarge": 58,
"m4.10xlarge": 234,
"m4.16xlarge": 234,
"m4.2xlarge": 58,
"m4.4xlarge": 234,
"m4.large": 20,
"m4.xlarge": 58,
"m5.12xlarge": 234,
"m5.24xlarge": 737,
"m5.2xlarge": 58,
"m5.4xlarge": 234,
"m5.large": 29,
"m5.xlarge": 58,
"m5d.12xlarge": 234,
"m5d.24xlarge": 737,
"m5d.2xlarge": 58,
"m5d.4xlarge": 234,
"m5d.large": 29,
"m5d.xlarge": 58,
"p2.16xlarge": 234,
"p2.8xlarge": 234,
"p2.xlarge": 58,
"p3.16xlarge": 234,
"p3.2xlarge": 58,
"p3.8xlarge": 234,
"r3.2xlarge": 58,
"r3.4xlarge": 234,
"r3.8xlarge": 234,
"r3.large": 29,
"r3.xlarge": 58,
"r4.16xlarge": 737,
"r4.2xlarge": 58,
"r4.4xlarge": 234,
"r4.8xlarge": 234,
"r4.large": 29,
"r4.xlarge": 58,
"r5.12xlarge": 234,
"r5.24xlarge": 737,
"r5.2xlarge": 58,
"r5.4xlarge": 234,
"r5.large": 29,
"r5.xlarge": 58,
"r5d.12xlarge": 234,
"r5d.24xlarge": 737,
"r5d.2xlarge": 58,
"r5d.4xlarge": 234,
"r5d.large": 29,
"r5d.xlarge": 58,
"t1.micro": 4,
"t2.2xlarge": 44,
"t2.large": 35,
"t2.medium": 17,
"t2.micro": 4,
"t2.nano": 4,
"t2.small": 8,
"t2.xlarge": 44,
"t3.2xlarge": 44,
"t3.large": 35,
"t3.medium": 17,
"t3.micro": 4,
"t3.nano": 4,
"t3.small": 8,
"t3.xlarge": 44,
"x1.16xlarge": 234,
"x1.32xlarge": 234,
"x1e.16xlarge": 234,
"x1e.2xlarge": 58,
"x1e.32xlarge": 234,
"x1e.4xlarge": 58,
"x1e.8xlarge": 58,
"x1e.xlarge": 29,
"z1d.12xlarge": 737,
"z1d.2xlarge": 58,
"z1d.3xlarge": 234,
"z1d.6xlarge": 234,
"z1d.large": 29,
"z1d.xlarge": 58,
}
55 changes: 55 additions & 0 deletions pkg/nodebootstrap/maxpods_generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//+build ignore

package main

import (
"io/ioutil"
"log"
"strconv"
"strings"

"net/http"

. "github.com/dave/jennifer/jen"
)

const maxPodsPerNodeTypeSourceText = "https://raw.github.com/awslabs/amazon-eks-ami/master/files/eni-max-pods.txt"

func main() {
f := NewFile("nodebootstrap")

f.Comment("Generated from " + maxPodsPerNodeTypeSourceText)

d := Dict{}

resp, err := http.Get(maxPodsPerNodeTypeSourceText)
if err != nil {
log.Fatal(err.Error())
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err.Error())
}

for _, line := range strings.Split(string(body), "\n") {
if !strings.HasPrefix(line, "#") {
parts := strings.Split(line, " ")
if len(parts) == 2 {
k := Lit(parts[0])
v, err := strconv.Atoi(parts[1])
if err != nil {
log.Fatal(err.Error())
}
d[k] = Lit(v)
}
}
}

f.Var().Id("maxPodsPerNodeType").Op("=").
Map(String()).Int().Values(d)

if err := f.Save("maxpods.go"); err != nil {
log.Fatal(err.Error())
}
}
1 change: 1 addition & 0 deletions pkg/nodebootstrap/userdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
)

//go:generate ${GOPATH}/bin/go-bindata -pkg ${GOPACKAGE} -prefix assets -modtime 1 -o assets.go assets
//go:generate go run ./maxpods_generate.go

const (
configDir = "/etc/eksctl/"
Expand Down
21 changes: 21 additions & 0 deletions vendor/github.com/dave/jennifer/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions vendor/github.com/dave/jennifer/jen/add.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 70c379f

Please sign in to comment.