File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,15 @@ func (s *ClusterScope) NetworkName() string {
131131 return ptr .Deref (s .GCPCluster .Spec .Network .Name , "default" )
132132}
133133
134+ // 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
136+ func (s * ClusterScope ) NetworkMtu () int64 {
137+ if s .GCPCluster .Spec .Network .Mtu == 0 {
138+ return int64 (1440 )
139+ }
140+ return s .GCPCluster .Spec .Network .Mtu
141+ }
142+
134143// NetworkLink returns the partial URL for the network.
135144func (s * ClusterScope ) NetworkLink () string {
136145 return fmt .Sprintf ("projects/%s/global/networks/%s" , s .NetworkProject (), s .NetworkName ())
@@ -206,6 +215,7 @@ func (s *ClusterScope) NetworkSpec() *compute.Network {
206215 Description : infrav1 .ClusterTagKey (s .Name ()),
207216 AutoCreateSubnetworks : createSubnet ,
208217 ForceSendFields : []string {"AutoCreateSubnetworks" },
218+ Mtu : s .NetworkMtu (),
209219 }
210220
211221 return network
You can’t perform that action at this time.
0 commit comments