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

Commit

Permalink
make flannel subnetLen configurable for big clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
Fsero committed May 1, 2020
1 parent c59afae commit edf6ec1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions builtin/files/cluster.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,14 @@ kubernetes:
# typhaImage:
# repo: quay.io/calico/typha
# tag: v3.9.1
# # By default, flannel assigns a /24 per node for pod's ips, this is effectively limiting your cluster size
# # to 255 nodes since each lease will be preserved for 24h.
# # If you have a bigger cluster you may want to tune this number to assign an smaller block per node.
# # Be aware that network should be able to accomodate at least 4 subnets, and networks smaller than /28
# # will make flannel panic and exit.
# # Ref: https://github.com/coreos/flannel/blob/62a1314e51047e25606b4e4e30bd23d7a8d746bc/subnet/config.go#L69
# flannelConfig:
# subnetLen: 24

# Create MountTargets to subnets managed by kube-aws for a pre-existing Elastic File System (Amazon EFS),
# and then mount to every node.
Expand Down
6 changes: 6 additions & 0 deletions builtin/files/userdata/cloud-config-controller
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,9 @@ write_files:
net-conf.json: |
{
"Network": "{{ .PodCIDR }}",
{{ if gt .Kubernetes.Networking.SelfHosting.FlannelConfig.SubnetLen 0 -}}
"SubnetLen": "{{ .Kubernetes.Networking.SelfHosting.flannelConfig.SubnetLen }}",
{{- end }}
"Backend": {
"Type": "vxlan"
}
Expand Down Expand Up @@ -2348,6 +2351,9 @@ write_files:
net-conf.json: |
{
"Network": "{{ .PodCIDR }}",
{{ if gt .Kubernetes.Networking.SelfHosting.FlannelConfig.SubnetLen 0 -}}
"SubnetLen": "{{ .Kubernetes.Networking.SelfHosting.FlannelConfig.SubnetLen }}",
{{- end }}
"Backend": {
"Type": "vxlan"
}
Expand Down
1 change: 1 addition & 0 deletions pkg/api/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ func NewDefaultCluster() *Cluster {
FlannelImage: Image{Repo: "quay.io/coreos/flannel", Tag: kubeNetworkingSelfHostingDefaultFlannelImageTag, RktPullDocker: false},
FlannelCniImage: Image{Repo: "quay.io/coreos/flannel-cni", Tag: kubeNetworkingSelfHostingDefaultFlannelCniImageTag, RktPullDocker: false},
TyphaImage: Image{Repo: "quay.io/calico/typha", Tag: kubeNetworkingSelfHostingDefaultTyphaImageTag, RktPullDocker: false},
FlannelConfig: FlannelConfig{SubnetLen: int32(0)},
},
},
},
Expand Down
5 changes: 5 additions & 0 deletions pkg/api/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ type SelfHosting struct {
FlannelImage Image `yaml:"flannelImage"`
FlannelCniImage Image `yaml:"flannelCniImage"`
TyphaImage Image `yaml:"typhaImage"`
FlannelConfig FlannelConfig `yaml:"flannelConfig"`
}

type FlannelConfig struct {
SubnetLen int32 `yaml:"subnetLen"`
}

0 comments on commit edf6ec1

Please sign in to comment.