Skip to content

Commit e3a61fc

Browse files
chore: NetworkSpec: Add kubebuilder default of 1460 for MTU if not specified
1 parent b0aaa8f commit e3a61fc

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

api/v1beta1/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ type NetworkSpec struct {
144144
// More info: https://pkg.go.dev/google.golang.org/api/compute/v1#Network
145145
// +kubebuilder:validation:Minimum:=1300
146146
// +kubebuilder:validation:Maximum:=8896
147+
// +kubebuilder:default:=1460
147148
// +optional
148149
Mtu int64 `json:"mtu,omitempty"`
149150
}

cloud/scope/cluster.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,16 @@ func (s *ClusterScope) NetworkName() string {
132132
}
133133

134134
// NetworkMtu returns the Network MTU of 1440 which is the default, otherwise returns back what is being set.
135-
// https://cloud.google.com/vpc/docs/mtu
135+
// Mtu: Maximum Transmission Unit in bytes. The minimum value for this field is
136+
// 1300 and the maximum value is 8896. The suggested value is 1500, which is
137+
// the default MTU used on the Internet, or 8896 if you want to use Jumbo
138+
// frames. If unspecified, the value defaults to 1460.
139+
// More info
140+
// - https://pkg.go.dev/google.golang.org/api/compute/v1#Network
141+
// - https://cloud.google.com/vpc/docs/mtu
136142
func (s *ClusterScope) NetworkMtu() int64 {
137143
if s.GCPCluster.Spec.Network.Mtu == 0 {
138-
return int64(1440)
144+
return int64(1460)
139145
}
140146
return s.GCPCluster.Spec.Network.Mtu
141147
}

config/crd/bases/infrastructure.cluster.x-k8s.io_gcpclusters.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ spec:
169169
format: int32
170170
type: integer
171171
mtu:
172+
default: 1460
172173
description: |-
173174
Mtu: Maximum Transmission Unit in bytes. The minimum value for this field is
174175
1300 and the maximum value is 8896. The suggested value is 1500, which is

config/crd/bases/infrastructure.cluster.x-k8s.io_gcpclustertemplates.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ spec:
186186
format: int32
187187
type: integer
188188
mtu:
189+
default: 1460
189190
description: |-
190191
Mtu: Maximum Transmission Unit in bytes. The minimum value for this field is
191192
1300 and the maximum value is 8896. The suggested value is 1500, which is

config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedclusters.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ spec:
165165
format: int32
166166
type: integer
167167
mtu:
168+
default: 1460
168169
description: |-
169170
Mtu: Maximum Transmission Unit in bytes. The minimum value for this field is
170171
1300 and the maximum value is 8896. The suggested value is 1500, which is

0 commit comments

Comments
 (0)