diff --git a/pkg/network/kuryr.go b/pkg/network/kuryr.go index 7ca95fcdac..43ab4d78f9 100644 --- a/pkg/network/kuryr.go +++ b/pkg/network/kuryr.go @@ -112,6 +112,7 @@ func renderKuryr(conf *operv1.NetworkSpec, bootstrapResult *bootstrap.BootstrapR // Pods Network MTU data.Data["PodsNetworkMTU"] = b.PodsNetworkMTU + c.MTU = &b.PodsNetworkMTU manifests, err := render.RenderDir(filepath.Join(manifestDir, "network/kuryr"), &data) if err != nil { @@ -218,7 +219,7 @@ func isKuryrChangeSafe(prev, next *operv1.NetworkSpec) []error { errs = append(errs, errors.Errorf("cannot change kuryr openStackServiceNetwork")) } - if pn.MTU != nil && *pn.MTU != 0 && !reflect.DeepEqual(pn.MTU, nn.MTU) { + if !reflect.DeepEqual(pn.MTU, nn.MTU) { errs = append(errs, errors.Errorf("cannot change mtu for the Pods Network")) } @@ -256,15 +257,12 @@ func fillKuryrDefaults(conf, previous *operv1.NetworkSpec) { var batchPorts uint = 3 kc.PoolBatchPorts = &batchPorts } - // MTU is currently the only field we pull from previous. + // MTU is currently the only field we pull from previous. if kc.MTU == nil { if previous != nil && previous.DefaultNetwork.KuryrConfig != nil && previous.DefaultNetwork.KuryrConfig.MTU != nil { mtu := *previous.DefaultNetwork.KuryrConfig.MTU kc.MTU = &mtu } - // if it wasn't set, let's make sure we set something - var mtu uint32 = 0 - kc.MTU = &mtu } } diff --git a/pkg/network/kuryr_test.go b/pkg/network/kuryr_test.go index df5679060f..95c911af32 100644 --- a/pkg/network/kuryr_test.go +++ b/pkg/network/kuryr_test.go @@ -164,7 +164,6 @@ func TestFillKuryrDefaults(t *testing.T) { c := uint32(8091) d := uint32(8090) batch := uint(3) - mtu := uint32(0) expected := operv1.NetworkSpec{ ServiceNetwork: []string{"172.30.0.0/16"}, ClusterNetwork: []operv1.ClusterNetworkEntry{ @@ -183,7 +182,6 @@ func TestFillKuryrDefaults(t *testing.T) { PoolMaxPorts: 0, PoolMinPorts: 1, PoolBatchPorts: &batch, - MTU: &mtu, }, }, } diff --git a/pkg/platform/openstack/kuryr_bootstrap.go b/pkg/platform/openstack/kuryr_bootstrap.go index b57d938108..9819093536 100644 --- a/pkg/platform/openstack/kuryr_bootstrap.go +++ b/pkg/platform/openstack/kuryr_bootstrap.go @@ -417,14 +417,12 @@ func BootstrapKuryr(conf *operv1.NetworkSpec, kubeClient crclient.Client) (*boot // Check the MTU. Basically if MTU is configured on KuryrConfig, then we need it to be lower or equal to nodes // network MTU. Use configured value if it is, error out if it isn't. - if kc.MTU != nil && *kc.MTU != 0 { + if kc.MTU != nil { if mtu >= *kc.MTU { mtu = *kc.MTU } else { return nil, errors.Errorf("Configured MTU (%d) is incompatible with OpenShift nodes network MTU (%d).", *kc.MTU, mtu) } - } else { - kc.MTU = &mtu } log.Print("Ensuring services network")