Repository: Azure/ARO-RP
Pull request #2090 (2022-04-26 22:33:01)

Remove ACR Image Override for Geneva
### Which issue this PR addresses:

Going forward, we will not override the Geneva images in FF Prod, but instead sync the images between gov cloud and public cloud.  

### What this PR does / why we need it:

Removes unnecessary environment variable as we will now sync them.  

### Test plan for issue:

N/A

### Is there any documentation that needs to be updated for this PR?
Yes, docs have been updated
https://msazure.visualstudio.com/AzureRedHatOpenShift/_wiki/wikis/ARO.wiki?wikiVersion=GBmaster&_a=edit&pagePath=/ARO%20MAG/How%20To/Mirroring&pageId=174102


Patch:
diff --git a/pkg/api/admin/openshiftcluster.go b/pkg/api/admin/openshiftcluster.go
index bac3029a4..ad65544d4 100644
--- a/pkg/api/admin/openshiftcluster.go
+++ b/pkg/api/admin/openshiftcluster.go
@@ -119,13 +119,23 @@ const (
 	SoftwareDefinedNetworkOpenShiftSDN  SoftwareDefinedNetwork = "OpenShiftSDN"
 )
 
+// MTUSize represents the MTU size of a cluster (Maximum transmission unit)
+type MTUSize int
+
+// MTUSize constants
+const (
+	MTU1500 MTUSize = 1500
+	MTU3900 MTUSize = 3900
+)
+
 // NetworkProfile represents a network profile.
 type NetworkProfile struct {
 	// The software defined network (SDN) to use when installing the cluster.
 	SoftwareDefinedNetwork SoftwareDefinedNetwork `json:"softwareDefinedNetwork,omitempty"`
 
-	PodCIDR     string `json:"podCidr,omitempty"`
-	ServiceCIDR string `json:"serviceCidr,omitempty"`
+	PodCIDR     string  `json:"podCidr,omitempty"`
+	ServiceCIDR string  `json:"serviceCidr,omitempty"`
+	MTUSize     MTUSize `json:"mtuSize,omitempty"`
 
 	APIServerPrivateEndpointIP string `json:"privateEndpointIp,omitempty"`
 	GatewayPrivateEndpointIP   string `json:"gatewayPrivateEndpointIp,omitempty"`
diff --git a/pkg/api/admin/openshiftcluster_convert.go b/pkg/api/admin/openshiftcluster_convert.go
index bf7844777..0686c060a 100644
--- a/pkg/api/admin/openshiftcluster_convert.go
+++ b/pkg/api/admin/openshiftcluster_convert.go
@@ -50,6 +50,7 @@ func (c *openShiftClusterConverter) ToExternal(oc *api.OpenShiftCluster) interfa
 				SoftwareDefinedNetwork:     SoftwareDefinedNetwork(oc.Properties.NetworkProfile.SoftwareDefinedNetwork),
 				PodCIDR:                    oc.Properties.NetworkProfile.PodCIDR,
 				ServiceCIDR:                oc.Properties.NetworkProfile.ServiceCIDR,
+				MTUSize:                    MTUSize(oc.Properties.NetworkProfile.MTUSize),
 				APIServerPrivateEndpointIP: oc.Properties.NetworkProfile.APIServerPrivateEndpointIP,
 				GatewayPrivateEndpointIP:   oc.Properties.NetworkProfile.GatewayPrivateEndpointIP,
 				GatewayPrivateLinkID:       oc.Properties.NetworkProfile.GatewayPrivateLinkID,
@@ -185,6 +186,7 @@ func (c *openShiftClusterConverter) ToInternal(_oc interface{}, out *api.OpenShi
 	out.Properties.ServicePrincipalProfile.SPObjectID = oc.Properties.ServicePrincipalProfile.SPObjectID
 	out.Properties.NetworkProfile.PodCIDR = oc.Properties.NetworkProfile.PodCIDR
 	out.Properties.NetworkProfile.ServiceCIDR = oc.Properties.NetworkProfile.ServiceCIDR
+	out.Properties.NetworkProfile.MTUSize = api.MTUSize(oc.Properties.NetworkProfile.MTUSize)
 	out.Properties.NetworkProfile.SoftwareDefinedNetwork = api.SoftwareDefinedNetwork(oc.Properties.NetworkProfile.SoftwareDefinedNetwork)
 	out.Properties.NetworkProfile.APIServerPrivateEndpointIP = oc.Properties.NetworkProfile.APIServerPrivateEndpointIP
 	out.Properties.NetworkProfile.GatewayPrivateEndpointIP = oc.Properties.NetworkProfile.GatewayPrivateEndpointIP
diff --git a/pkg/api/openshiftcluster.go b/pkg/api/openshiftcluster.go
index 7c8636b3a..5635fae8b 100644
--- a/pkg/api/openshiftcluster.go
+++ b/pkg/api/openshiftcluster.go
@@ -234,6 +234,15 @@ const (
 	SoftwareDefinedNetworkOpenShiftSDN  SoftwareDefinedNetwork = "OpenShiftSDN"
 )
 
+// MTUSize represents the MTU size of a cluster
+type MTUSize int
+
+// MTUSize constants
+const (
+	MTU1500 MTUSize = 1500
+	MTU3900 MTUSize = 3900
+)
+
 // NetworkProfile represents a network profile
 type NetworkProfile struct {
 	MissingFields
@@ -241,6 +250,7 @@ type NetworkProfile struct {
 	PodCIDR                string                 `json:"podCidr,omitempty"`
 	ServiceCIDR            string                 `json:"serviceCidr,omitempty"`
 	SoftwareDefinedNetwork SoftwareDefinedNetwork `json:"softwareDefinedNetwork,omitempty"`
+	MTUSize                MTUSize                `json:"mtuSize,omitempty"`
 
 	APIServerPrivateEndpointIP string `json:"privateEndpointIp,omitempty"`
 	GatewayPrivateEndpointIP   string `json:"gatewayPrivateEndpointIp,omitempty"`
diff --git a/pkg/cluster/deploystorage.go b/pkg/cluster/deploystorage.go
index db14aa07d..cb0e4a923 100644
--- a/pkg/cluster/deploystorage.go
+++ b/pkg/cluster/deploystorage.go
@@ -28,7 +28,6 @@ import (
 	"github.com/Azure/ARO-RP/pkg/cluster/graph"
 	"github.com/Azure/ARO-RP/pkg/env"
 	"github.com/Azure/ARO-RP/pkg/util/arm"
-	"github.com/Azure/ARO-RP/pkg/util/feature"
 	"github.com/Azure/ARO-RP/pkg/util/stringutils"
 	"github.com/Azure/ARO-RP/pkg/util/subnet"
 )
@@ -224,15 +223,14 @@ func (m *manager) ensureGraph(ctx context.Context, installConfig *installconfig.
 	}
 
 	// Handle MTU3900 feature flag
-	subProperties := m.subscriptionDoc.Subscription.Properties
-	if feature.IsRegisteredForFeature(subProperties, api.FeatureFlagMTU3900) {
+	if m.doc.OpenShiftCluster.Properties.NetworkProfile.MTUSize == api.MTU3900 {
 		m.log.Printf("applying feature flag %s", api.FeatureFlagMTU3900)
 		if err = m.overrideEthernetMTU(g); err != nil {
 			return err
 		}
 	}
 
-	// the graph is quite big so we store it in a storage account instead of in cosmosdb
+	// the graph is quite big, so we store it in a storage account instead of in cosmosdb
 	return m.graph.Save(ctx, resourceGroup, clusterStorageAccountName, g)
 }
 
diff --git a/pkg/cluster/install.go b/pkg/cluster/install.go
index e50ad64e0..4eb178d36 100644
--- a/pkg/cluster/install.go
+++ b/pkg/cluster/install.go
@@ -81,6 +81,7 @@ func (m *manager) adminUpdate() []steps.Step {
 			steps.Action(m.configureAPIServerCertificate),
 			steps.Action(m.configureIngressCertificate),
 			steps.Action(m.populateRegistryStorageAccountName),
+			steps.Action(m.ensureMTUSize),
 			steps.Action(m.populateCreatedAt), // TODO(mikalai): Remove after a round of admin updates
 
 		)
@@ -134,6 +135,7 @@ func (m *manager) Install(ctx context.Context) error {
 			steps.AuthorizationRefreshingAction(m.fpAuthorizer, steps.Action(m.validateResources)),
 			steps.Action(m.ensureACRToken),
 			steps.Action(m.generateSSHKey),
+			steps.Action(m.populateMTUSize),
 			steps.Action(func(ctx context.Context) error {
 				var err error
 				installConfig, image, err = m.generateInstallConfig(ctx)
diff --git a/pkg/cluster/networkprofile.go b/pkg/cluster/networkprofile.go
new file mode 100644
index 000000000..9e1878037
--- /dev/null
+++ b/pkg/cluster/networkprofile.go
@@ -0,0 +1,62 @@
+package cluster
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the Apache License 2.0.
+
+import (
+	"context"
+
+	kerrors "k8s.io/apimachinery/pkg/api/errors"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	"github.com/Azure/ARO-RP/pkg/api"
+	"github.com/Azure/ARO-RP/pkg/util/feature"
+)
+
+// populateMTUSize ensures that every new cluster object has the MTUSize field defined
+func (m *manager) populateMTUSize(ctx context.Context) error {
+	// Get appropriate MTU size
+	mtuSize := api.MTU1500
+	subProperties := m.subscriptionDoc.Subscription.Properties
+	if feature.IsRegisteredForFeature(subProperties, api.FeatureFlagMTU3900) {
+		mtuSize = api.MTU3900
+	}
+
+	// Patch the cluster object with correct MTU size
+	return patchMTUSize(m, ctx, mtuSize)
+}
+
+// ensureMTUSize ensures that an existing cluster object has the MTUSize field defined
+func (m *manager) ensureMTUSize(ctx context.Context) error {
+	var err error
+	// Cluster needs MTUSize field patched
+	if m.doc.OpenShiftCluster.Properties.NetworkProfile.MTUSize == 0 {
+		// Get appropriate MTU size
+		mtuSize := api.MTU3900
+
+		// If a single MachineConfig is present we know the cluster has a custom MTU
+		_, err = m.mcocli.MachineconfigurationV1().MachineConfigs().Get(ctx, "99-master-mtu", metav1.GetOptions{})
+		if err != nil {
+			// If we can't find a MachineConfig this cluster never had a custom MTU on install, set to default
+			if kerrors.IsNotFound(err) {
+				mtuSize = api.MTU1500
+			} else {
+				return err
+			}
+		}
+
+		// Patch the cluster object with correct MTU size
+		err = patchMTUSize(m, ctx, mtuSize)
+	}
+	return err
+}
+
+func patchMTUSize(m *manager, ctx context.Context, mtuSize api.MTUSize) error {
+	// Patch the cluster object with correct MTU size
+	var err error
+	m.doc, err = m.db.PatchWithLease(ctx, m.doc.Key, func(doc *api.OpenShiftClusterDocument) error {
+		doc.OpenShiftCluster.Properties.NetworkProfile.MTUSize = mtuSize
+		return nil
+	})
+	return err
+}
diff --git a/pkg/deploy/predeploy.go b/pkg/deploy/predeploy.go
index 03b79d7e9..8d11943d2 100644
--- a/pkg/deploy/predeploy.go
+++ b/pkg/deploy/predeploy.go
@@ -25,9 +25,9 @@ import (
 	"github.com/Azure/ARO-RP/pkg/util/keyvault"
 )
 
-// Rotate the secret on every deploy of the RP iff the most recent
-// secret is less than 3 days old
-const rotateSecretAfter = time.Hour * 72
+// Rotate the secret on every deploy of the RP if the most recent
+// secret is greater than 7 days old
+const rotateSecretAfter = time.Hour * 168
 
 // PreDeploy deploys managed identity, NSGs and keyvaults, needed for main
 // deployment
diff --git a/pkg/mirror/graph.go b/pkg/mirror/graph.go
index f02154344..9cfd04717 100644
--- a/pkg/mirror/graph.go
+++ b/pkg/mirror/graph.go
@@ -57,13 +57,7 @@ func AddFromGraph(min *version.Version) ([]Node, error) {
 	}
 
 	releases := make([]Node, 0, len(g.Nodes))
-loop:
 	for _, node := range g.Nodes {
-		switch node.Version {
-		case "4.3.20":
-			continue loop
-		}
-
 		vsn, err := version.ParseVersion(node.Version)
 		if err != nil {
 			return nil, err
diff --git a/pkg/util/version/const.go b/pkg/util/version/const.go
index 661ff62d5..4d53141b1 100644
--- a/pkg/util/version/const.go
+++ b/pkg/util/version/const.go
@@ -4,8 +4,6 @@ package version
 // Licensed under the Apache License 2.0.
 
 import (
-	"os"
-
 	"github.com/Azure/ARO-RP/pkg/api"
 )
 
@@ -67,21 +65,11 @@ func FluentbitImage(acrDomain string) string {
 
 // MdmImage contains the location of the MDM container image
 func MdmImage(acrDomain string) string {
-	// for the latest version see https://genevamondocs.azurewebsites.net/collect/references/linuxcontainers.html?q=container
-	if os.Getenv("GENEVA_MDM_IMAGE_OVERRIDE") != "" {
-		return os.Getenv("GENEVA_MDM_IMAGE_OVERRIDE")
-	}
-
 	return acrDomain + "/genevamdm:master_20220419.1"
 }
 
 // MdsdImage contains the location of the MDSD container image
 func MdsdImage(acrDomain string) string {
-	// for the latest version see https://genevamondocs.azurewebsites.net/collect/references/linuxcontainers.html?q=container
-	if os.Getenv("GENEVA_MDSD_IMAGE_OVERRIDE") != "" {
-		return os.Getenv("GENEVA_MDSD_IMAGE_OVERRIDE")
-	}
-
 	return acrDomain + "/genevamdsd:master_20220419.1"
 }
 
diff --git a/portal/v2/package-lock.json b/portal/v2/package-lock.json
index d7c7b8648..25f5a2c94 100644
--- a/portal/v2/package-lock.json
+++ b/portal/v2/package-lock.json
@@ -4065,9 +4065,9 @@
       }
     },
     "node_modules/async": {
-      "version": "2.6.3",
-      "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
-      "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==",
+      "version": "2.6.4",
+      "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
+      "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
       "dependencies": {
         "lodash": "^4.17.14"
       }
@@ -23582,9 +23582,9 @@
       "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ=="
     },
     "async": {
-      "version": "2.6.3",
-      "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
-      "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==",
+      "version": "2.6.4",
+      "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
+      "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
       "requires": {
         "lodash": "^4.17.14"
       }


Test patch:
diff --git a/pkg/cluster/adminupdate_test.go b/pkg/cluster/adminupdate_test.go
index 52fc01893..2f3fc4212 100644
--- a/pkg/cluster/adminupdate_test.go
+++ b/pkg/cluster/adminupdate_test.go
@@ -85,6 +85,7 @@ func TestAdminUpdateSteps(t *testing.T) {
 				"[Action configureAPIServerCertificate-fm]",
 				"[Action configureIngressCertificate-fm]",
 				"[Action populateRegistryStorageAccountName-fm]",
+				"[Action ensureMTUSize-fm]",
 				"[Action populateCreatedAt-fm]",
 				"[Action ensureAROOperator-fm]",
 				"[Condition aroDeploymentReady-fm, timeout 20m0s]",
@@ -124,6 +125,7 @@ func TestAdminUpdateSteps(t *testing.T) {
 				"[Action configureAPIServerCertificate-fm]",
 				"[Action configureIngressCertificate-fm]",
 				"[Action populateRegistryStorageAccountName-fm]",
+				"[Action ensureMTUSize-fm]",
 				"[Action populateCreatedAt-fm]",
 				"[Action ensureAROOperator-fm]",
 				"[Condition aroDeploymentReady-fm, timeout 20m0s]",
diff --git a/pkg/cluster/networkprofile_test.go b/pkg/cluster/networkprofile_test.go
new file mode 100644
index 000000000..1bfc14ce9
--- /dev/null
+++ b/pkg/cluster/networkprofile_test.go
@@ -0,0 +1,298 @@
+package cluster
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the Apache License 2.0.
+
+import (
+	"context"
+	"strings"
+	"testing"
+
+	mcv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
+	mcofake "github.com/openshift/machine-config-operator/pkg/generated/clientset/versioned/fake"
+	"github.com/stretchr/testify/assert"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	"github.com/Azure/ARO-RP/pkg/api"
+	testdatabase "github.com/Azure/ARO-RP/test/database"
+)
+
+// TestPopulateMTUSize will test our populate MTUSize function
+func TestPopulateMTUSize(t *testing.T) {
+	ctx := context.Background()
+
+	// Define the DB instance we will use to run the PatchWithLease function
+	key := "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resourceGroup/providers/Microsoft.RedHatOpenShift/openShiftClusters/resourceName"
+
+	// Run tests
+	for _, tt := range []struct {
+		name        string
+		m           manager
+		expectedMTU api.MTUSize
+		expectedErr error
+	}{
+		{
+			name: "No MTU size defined, MTU3900 flag",
+			m: manager{
+				doc: &api.OpenShiftClusterDocument{
+					Key: strings.ToLower(key),
+					OpenShiftCluster: &api.OpenShiftCluster{
+						ID: key,
+						Properties: api.OpenShiftClusterProperties{
+							ProvisioningState: api.ProvisioningStateSucceeded,
+						},
+					},
+				},
+				subscriptionDoc: &api.SubscriptionDocument{
+					Subscription: &api.Subscription{
+						Properties: &api.SubscriptionProperties{
+							RegisteredFeatures: []api.RegisteredFeatureProfile{
+								{
+									Name:  api.FeatureFlagMTU3900,
+									State: "Registered",
+								},
+							},
+						},
+					},
+				},
+			},
+			expectedMTU: api.MTU3900,
+			expectedErr: nil,
+		},
+		{
+			name: "No MTU size defined, No MTU flag",
+			m: manager{
+				doc: &api.OpenShiftClusterDocument{
+					Key: strings.ToLower(key),
+					OpenShiftCluster: &api.OpenShiftCluster{
+						ID: key,
+						Properties: api.OpenShiftClusterProperties{
+							ProvisioningState: api.ProvisioningStateSucceeded,
+						},
+					},
+				},
+				subscriptionDoc: &api.SubscriptionDocument{
+					Subscription: &api.Subscription{
+						Properties: &api.SubscriptionProperties{
+							RegisteredFeatures: []api.RegisteredFeatureProfile{},
+						},
+					},
+				},
+			},
+			expectedMTU: api.MTU1500,
+			expectedErr: nil,
+		},
+		{
+			name: "MTU1500 defined, MTU3900 flag",
+			m: manager{
+				doc: &api.OpenShiftClusterDocument{
+					Key: strings.ToLower(key),
+					OpenShiftCluster: &api.OpenShiftCluster{
+						ID: key,
+						Properties: api.OpenShiftClusterProperties{
+							ProvisioningState: api.ProvisioningStateSucceeded,
+							NetworkProfile: api.NetworkProfile{
+								MTUSize: api.MTU1500,
+							},
+						},
+					},
+				},
+				subscriptionDoc: &api.SubscriptionDocument{
+					Subscription: &api.Subscription{
+						Properties: &api.SubscriptionProperties{
+							RegisteredFeatures: []api.RegisteredFeatureProfile{
+								{
+									Name:  api.FeatureFlagMTU3900,
+									State: "Registered",
+								},
+							},
+						},
+					},
+				},
+			},
+			expectedMTU: api.MTU3900,
+			expectedErr: nil,
+		},
+	} {
+		t.Run(tt.name, func(t *testing.T) {
+			// Create the DB to test the cluster
+			openShiftClustersDatabase, _ := testdatabase.NewFakeOpenShiftClusters()
+			fixture := testdatabase.NewFixture().WithOpenShiftClusters(openShiftClustersDatabase)
+			fixture.AddOpenShiftClusterDocuments(tt.m.doc)
+			err := fixture.Create()
+			if err != nil {
+				t.Fatal(err)
+			}
+			tt.m.db = openShiftClustersDatabase
+
+			// Run populateMTUSize and assert the correct results
+			err = tt.m.populateMTUSize(ctx)
+			assert.Equal(t, tt.expectedErr, err, "Unexpected error exception")
+			assert.Equal(t, tt.expectedMTU, tt.m.doc.OpenShiftCluster.Properties.NetworkProfile.MTUSize, "MTUSize was not updated as expected exception")
+		})
+	}
+}
+
+// TestEnsureMTUSize will test our ensureMTUSize function
+func TestEnsureMTUSize(t *testing.T) {
+	ctx := context.Background()
+
+	// Define the DB instance we will use to run the PatchWithLease function
+	key := "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resourceGroup/providers/Microsoft.RedHatOpenShift/openShiftClusters/resourceName"
+
+	// Run tests
+	for _, tt := range []struct {
+		name        string
+		m           manager
+		expectedMTU api.MTUSize
+		expectedErr error
+	}{
+		{
+			name: "MTUSize set to 1500",
+			m: manager{
+				doc: &api.OpenShiftClusterDocument{
+					Key: strings.ToLower(key),
+					OpenShiftCluster: &api.OpenShiftCluster{
+						ID: key,
+						Properties: api.OpenShiftClusterProperties{
+							ProvisioningState: api.ProvisioningStateSucceeded,
+							NetworkProfile: api.NetworkProfile{
+								MTUSize: api.MTU1500,
+							},
+						},
+					},
+				},
+				mcocli: mcofake.NewSimpleClientset(
+					&mcv1.MachineConfig{
+						ObjectMeta: metav1.ObjectMeta{
+							Name: "master",
+						},
+					}),
+				subscriptionDoc: &api.SubscriptionDocument{
+					Subscription: &api.Subscription{
+						Properties: &api.SubscriptionProperties{
+							RegisteredFeatures: []api.RegisteredFeatureProfile{
+								{},
+							},
+						},
+					},
+				},
+			},
+			expectedMTU: api.MTU1500,
+			expectedErr: nil,
+		},
+		{
+			name: "MTUSize set to 3900",
+			m: manager{
+				doc: &api.OpenShiftClusterDocument{
+					Key: strings.ToLower(key),
+					OpenShiftCluster: &api.OpenShiftCluster{
+						ID: key,
+						Properties: api.OpenShiftClusterProperties{
+							ProvisioningState: api.ProvisioningStateSucceeded,
+							NetworkProfile: api.NetworkProfile{
+								MTUSize: api.MTU3900,
+							},
+						},
+					},
+				},
+				mcocli: mcofake.NewSimpleClientset(
+					&mcv1.MachineConfig{
+						ObjectMeta: metav1.ObjectMeta{
+							Name: "master",
+						},
+					}),
+				subscriptionDoc: &api.SubscriptionDocument{
+					Subscription: &api.Subscription{
+						Properties: &api.SubscriptionProperties{
+							RegisteredFeatures: []api.RegisteredFeatureProfile{
+								{},
+							},
+						},
+					},
+				},
+			},
+			expectedMTU: api.MTU3900,
+			expectedErr: nil,
+		},
+		{
+			name: "No MTUSize & MachineConfig found",
+			m: manager{
+				doc: &api.OpenShiftClusterDocument{
+					Key: strings.ToLower(key),
+					OpenShiftCluster: &api.OpenShiftCluster{
+						ID: key,
+						Properties: api.OpenShiftClusterProperties{
+							ProvisioningState: api.ProvisioningStateSucceeded,
+						},
+					},
+				},
+				mcocli: mcofake.NewSimpleClientset(
+					&mcv1.MachineConfig{
+						ObjectMeta: metav1.ObjectMeta{
+							Name: "99-master-mtu",
+						},
+					}),
+				subscriptionDoc: &api.SubscriptionDocument{
+					Subscription: &api.Subscription{
+						Properties: &api.SubscriptionProperties{
+							RegisteredFeatures: []api.RegisteredFeatureProfile{
+								{},
+							},
+						},
+					},
+				},
+			},
+			expectedMTU: api.MTU3900,
+			expectedErr: nil,
+		},
+		{
+			name: "No MTUSize & MachineConfig not found",
+			m: manager{
+				doc: &api.OpenShiftClusterDocument{
+					Key: strings.ToLower(key),
+					OpenShiftCluster: &api.OpenShiftCluster{
+						ID: key,
+						Properties: api.OpenShiftClusterProperties{
+							ProvisioningState: api.ProvisioningStateSucceeded,
+						},
+					},
+				},
+				mcocli: mcofake.NewSimpleClientset(
+					&mcv1.MachineConfig{
+						ObjectMeta: metav1.ObjectMeta{
+							Name: "master",
+						},
+					}),
+				subscriptionDoc: &api.SubscriptionDocument{
+					Subscription: &api.Subscription{
+						Properties: &api.SubscriptionProperties{
+							RegisteredFeatures: []api.RegisteredFeatureProfile{
+								{},
+							},
+						},
+					},
+				},
+			},
+			expectedMTU: api.MTU1500,
+			expectedErr: nil,
+		},
+	} {
+		t.Run(tt.name, func(t *testing.T) {
+			// Create the DB to test the cluster
+			openShiftClustersDatabase, _ := testdatabase.NewFakeOpenShiftClusters()
+			fixture := testdatabase.NewFixture().WithOpenShiftClusters(openShiftClustersDatabase)
+			fixture.AddOpenShiftClusterDocuments(tt.m.doc)
+			err := fixture.Create()
+			if err != nil {
+				t.Fatal(err)
+			}
+			tt.m.db = openShiftClustersDatabase
+
+			err = tt.m.ensureMTUSize(ctx)
+
+			assert.Equal(t, tt.expectedErr, err, "Unexpected error exception")
+			assert.Equal(t, tt.expectedMTU, tt.m.doc.OpenShiftCluster.Properties.NetworkProfile.MTUSize, "MTUSize was not updated as expected exception")
+		})
+	}
+}