Skip to content
This repository was archived by the owner on Jun 29, 2022. It is now read-only.

Commit 3215066

Browse files
author
knrt10
committed
Configure network_mtu for platforms
When encrypt_pod_traffic is set to true MTU should be 40 less than the default value because of wireguard overhead. Signed-off-by: knrt10 <kautilya@kinvolk.io>
1 parent 39bfbb6 commit 3215066

File tree

10 files changed

+18
-19
lines changed

10 files changed

+18
-19
lines changed

assets/terraform-modules/aws/flatcar-linux/kubernetes/variables.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ variable "asset_dir" {
113113
variable "network_mtu" {
114114
description = "CNI interface MTU. Use 8981 if using instances types with Jumbo frames."
115115
type = number
116-
default = 1480
117116
}
118117

119118
variable "host_cidr" {

assets/terraform-modules/bare-metal/flatcar-linux/kubernetes/variables.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ variable "asset_dir" {
8585
variable "network_mtu" {
8686
description = "CNI interface MTU"
8787
type = number
88-
default = 1480
8988
}
9089

9190
variable "network_ip_autodetection_method" {

assets/terraform-modules/packet/flatcar-linux/kubernetes/variables.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ variable "asset_dir" {
8888
variable "network_mtu" {
8989
description = "CNI interface MTU"
9090
type = number
91-
default = 1480
9291
}
9392

9493
variable "network_ip_autodetection_method" {

pkg/assets/generated_assets.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/platform/aws/aws.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ func NewConfig() *config {
109109
Region: "eu-central-1",
110110
EnableAggregation: true,
111111
EnableTLSBootstrap: true,
112+
NetworkMTU: 1480, //nolint:gomnd
112113
}
113114
}
114115

pkg/platform/aws/template.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ module "aws-{{.Config.ClusterName}}" {
4242
controller_type = "{{.Config.ControllerType}}"
4343
{{- end }}
4444
45-
{{- if .Config.NetworkMTU }}
46-
network_mtu = {{.Config.NetworkMTU}}
47-
{{- end }}
4845
enable_reporting = {{.Config.EnableReporting}}
4946
{{- if .Config.PodCIDR }}
5047
pod_cidr = "{{.Config.PodCIDR}}"
@@ -100,6 +97,9 @@ module "aws-{{.Config.ClusterName}}" {
10097
10198
{{- if .Config.EncryptPodTraffic }}
10299
encrypt_pod_traffic = {{.Config.EncryptPodTraffic}}
100+
network_mtu = {{ .Config.NetworkMTU }} - 40 # Wireguard overhead
101+
{{- else }}
102+
network_mtu = {{ .Config.NetworkMTU }}
103103
{{- end }}
104104
105105
worker_bootstrap_tokens = [

pkg/platform/baremetal/baremetal.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ func NewConfig() *config {
9090
OSChannel: "flatcar-stable",
9191
OSVersion: "current",
9292
EnableTLSBootstrap: true,
93+
NetworkMTU: 1480, //nolint:gomnd
9394
}
9495
}
9596

pkg/platform/baremetal/template.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ module "bare-metal-{{.ClusterName}}" {
3232
3333
{{- if .EncryptPodTraffic }}
3434
encrypt_pod_traffic = {{ .EncryptPodTraffic }}
35+
network_mtu = {{ .NetworkMTU }} - 40 # Wireguard overhead
36+
{{- else }}
37+
network_mtu = {{ .NetworkMTU }}
3538
{{- end }}
3639
3740
# configuration
@@ -48,10 +51,6 @@ module "bare-metal-{{.ClusterName}}" {
4851
worker_macs = {{.WorkerMacs}}
4952
worker_domains = {{.WorkerDomains}}
5053
51-
{{- if .NetworkMTU }}
52-
network_mtu = {{ .NetworkMTU }}
53-
{{- end }}
54-
5554
{{- if .KubeAPIServerExtraFlags }}
5655
kube_apiserver_extra_flags = [
5756
{{- range .KubeAPIServerExtraFlags }}

pkg/platform/packet/packet.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ func NewConfig() *config {
122122
return &config{
123123
EnableAggregation: true,
124124
EnableTLSBootstrap: true,
125+
NetworkMTU: 1480, //nolint:gomnd
125126
}
126127
}
127128

pkg/platform/packet/template.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ module "packet-{{.Config.ClusterName}}" {
5555
5656
enable_aggregation = {{.Config.EnableAggregation}}
5757
58-
{{- if .Config.NetworkMTU }}
59-
network_mtu = {{.Config.NetworkMTU}}
60-
{{- end }}
6158
enable_reporting = {{.Config.EnableReporting}}
6259
6360
{{- if .Config.PodCIDR }}
@@ -115,6 +112,9 @@ EOF
115112
116113
{{- if .Config.EncryptPodTraffic }}
117114
encrypt_pod_traffic = {{.Config.EncryptPodTraffic}}
115+
network_mtu = {{ .Config.NetworkMTU }} - 40 # Wireguard overhead
116+
{{- else }}
117+
network_mtu = {{ .Config.NetworkMTU }}
118118
{{- end }}
119119
120120
worker_bootstrap_tokens = [

0 commit comments

Comments
 (0)