Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions pkg/network/kuryr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"))
}

Expand Down Expand Up @@ -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
}
}
2 changes: 0 additions & 2 deletions pkg/network/kuryr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -183,7 +182,6 @@ func TestFillKuryrDefaults(t *testing.T) {
PoolMaxPorts: 0,
PoolMinPorts: 1,
PoolBatchPorts: &batch,
MTU: &mtu,
},
},
}
Expand Down
4 changes: 1 addition & 3 deletions pkg/platform/openstack/kuryr_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down