Repository: Azure/ARO-RP
Pull request #2143 (2022-05-27 03:47:32)

Enable MUO M2 by default
### Which issue this PR addresses:

Fixes https://dev.azure.com/msazure/AzureRedHatOpenShift/_workitems/edit/14536879

### What this PR does / why we need it:

Enables MUO M2 by default.

### Test plan for issue:

Unit tests

### Is there any documentation that needs to be updated for this PR?

N/A



Patch:
diff --git a/pkg/operator/controllers/muo/muo_controller.go b/pkg/operator/controllers/muo/muo_controller.go
index 9cef6d5a0..ca0b9da52 100644
--- a/pkg/operator/controllers/muo/muo_controller.go
+++ b/pkg/operator/controllers/muo/muo_controller.go
@@ -34,7 +34,7 @@ const (
 	controllerEnabled                = "rh.srep.muo.enabled"
 	controllerManaged                = "rh.srep.muo.managed"
 	controllerPullSpec               = "rh.srep.muo.deploy.pullspec"
-	controllerAllowOCM               = "rh.srep.muo.deploy.allowOCM"
+	controllerForceLocalOnly         = "rh.srep.muo.deploy.forceLocalOnly"
 	controllerOcmBaseURL             = "rh.srep.muo.deploy.ocmBaseUrl"
 	controllerOcmBaseURLDefaultValue = "https://api.openshift.com"
 
@@ -96,8 +96,8 @@ func (r *Reconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.
 			Pullspec: pullSpec,
 		}
 
-		allowOCM := instance.Spec.OperatorFlags.GetSimpleBoolean(controllerAllowOCM)
-		if allowOCM {
+		disableOCM := instance.Spec.OperatorFlags.GetSimpleBoolean(controllerForceLocalOnly)
+		if !disableOCM {
 			useOCM := func() bool {
 				var userSecret *corev1.Secret
 
diff --git a/pkg/util/version/const.go b/pkg/util/version/const.go
index a391c004f..8fe049889 100644
--- a/pkg/util/version/const.go
+++ b/pkg/util/version/const.go
@@ -79,5 +79,5 @@ func MdsdImage(acrDomain string) string {
 
 // MUOImage contains the location of the Managed Upgrade Operator container image
 func MUOImage(acrDomain string) string {
-	return acrDomain + "/managed-upgrade-operator:aro-b1"
+	return acrDomain + "/managed-upgrade-operator:aro-b4"
 }


Test patch:
diff --git a/pkg/operator/controllers/muo/muo_controller_test.go b/pkg/operator/controllers/muo/muo_controller_test.go
index e88119496..2d577cd65 100644
--- a/pkg/operator/controllers/muo/muo_controller_test.go
+++ b/pkg/operator/controllers/muo/muo_controller_test.go
@@ -48,7 +48,8 @@ func TestMUOReconciler(t *testing.T) {
 			},
 			mocks: func(md *mock_muo.MockDeployer, cluster *arov1alpha1.Cluster) {
 				expectedConfig := &config.MUODeploymentConfig{
-					Pullspec: "wonderfulPullspec",
+					Pullspec:        "wonderfulPullspec",
+					EnableConnected: false,
 				}
 				md.EXPECT().CreateOrUpdate(gomock.Any(), cluster, expectedConfig).Return(nil)
 				md.EXPECT().IsReady(gomock.Any()).Return(true, nil)
@@ -62,7 +63,8 @@ func TestMUOReconciler(t *testing.T) {
 			},
 			mocks: func(md *mock_muo.MockDeployer, cluster *arov1alpha1.Cluster) {
 				expectedConfig := &config.MUODeploymentConfig{
-					Pullspec: "acrtest.example.com/managed-upgrade-operator:aro-b1",
+					Pullspec:        "acrtest.example.com/managed-upgrade-operator:aro-b4",
+					EnableConnected: false,
 				}
 				md.EXPECT().CreateOrUpdate(gomock.Any(), cluster, expectedConfig).Return(nil)
 				md.EXPECT().IsReady(gomock.Any()).Return(true, nil)
@@ -71,10 +73,10 @@ func TestMUOReconciler(t *testing.T) {
 		{
 			name: "managed, OCM allowed but pull secret entirely missing",
 			flags: arov1alpha1.OperatorFlags{
-				controllerEnabled:  "true",
-				controllerManaged:  "true",
-				controllerAllowOCM: "true",
-				controllerPullSpec: "wonderfulPullspec",
+				controllerEnabled:        "true",
+				controllerManaged:        "true",
+				controllerForceLocalOnly: "false",
+				controllerPullSpec:       "wonderfulPullspec",
 			},
 			mocks: func(md *mock_muo.MockDeployer, cluster *arov1alpha1.Cluster) {
 				expectedConfig := &config.MUODeploymentConfig{
@@ -88,10 +90,10 @@ func TestMUOReconciler(t *testing.T) {
 		{
 			name: "managed, OCM allowed but empty pullsecret",
 			flags: arov1alpha1.OperatorFlags{
-				controllerEnabled:  "true",
-				controllerManaged:  "true",
-				controllerAllowOCM: "true",
-				controllerPullSpec: "wonderfulPullspec",
+				controllerEnabled:        "true",
+				controllerManaged:        "true",
+				controllerForceLocalOnly: "false",
+				controllerPullSpec:       "wonderfulPullspec",
 			},
 			pullsecret: "{\"auths\": {}}",
 			mocks: func(md *mock_muo.MockDeployer, cluster *arov1alpha1.Cluster) {
@@ -106,10 +108,10 @@ func TestMUOReconciler(t *testing.T) {
 		{
 			name: "managed, OCM allowed but mangled pullsecret",
 			flags: arov1alpha1.OperatorFlags{
-				controllerEnabled:  "true",
-				controllerManaged:  "true",
-				controllerAllowOCM: "true",
-				controllerPullSpec: "wonderfulPullspec",
+				controllerEnabled:        "true",
+				controllerManaged:        "true",
+				controllerForceLocalOnly: "false",
+				controllerPullSpec:       "wonderfulPullspec",
 			},
 			pullsecret: "i'm a little json, short and stout",
 			mocks: func(md *mock_muo.MockDeployer, cluster *arov1alpha1.Cluster) {
@@ -124,10 +126,10 @@ func TestMUOReconciler(t *testing.T) {
 		{
 			name: "managed, OCM connected mode",
 			flags: arov1alpha1.OperatorFlags{
-				controllerEnabled:  "true",
-				controllerManaged:  "true",
-				controllerAllowOCM: "true",
-				controllerPullSpec: "wonderfulPullspec",
+				controllerEnabled:        "true",
+				controllerManaged:        "true",
+				controllerForceLocalOnly: "false",
+				controllerPullSpec:       "wonderfulPullspec",
 			},
 			pullsecret: "{\"auths\": {\"" + pullSecretOCMKey + "\": {\"auth\": \"secret value\"}}}",
 			mocks: func(md *mock_muo.MockDeployer, cluster *arov1alpha1.Cluster) {
@@ -143,11 +145,11 @@ func TestMUOReconciler(t *testing.T) {
 		{
 			name: "managed, OCM connected mode, custom OCM URL",
 			flags: arov1alpha1.OperatorFlags{
-				controllerEnabled:    "true",
-				controllerManaged:    "true",
-				controllerAllowOCM:   "true",
-				controllerOcmBaseURL: "https://example.com",
-				controllerPullSpec:   "wonderfulPullspec",
+				controllerEnabled:        "true",
+				controllerManaged:        "true",
+				controllerForceLocalOnly: "false",
+				controllerOcmBaseURL:     "https://example.com",
+				controllerPullSpec:       "wonderfulPullspec",
 			},
 			pullsecret: "{\"auths\": {\"" + pullSecretOCMKey + "\": {\"auth\": \"secret value\"}}}",
 			mocks: func(md *mock_muo.MockDeployer, cluster *arov1alpha1.Cluster) {
@@ -160,6 +162,24 @@ func TestMUOReconciler(t *testing.T) {
 				md.EXPECT().IsReady(gomock.Any()).Return(true, nil)
 			},
 		},
+		{
+			name: "managed, pull secret exists, OCM disabled",
+			flags: arov1alpha1.OperatorFlags{
+				controllerEnabled:        "true",
+				controllerManaged:        "true",
+				controllerForceLocalOnly: "true",
+				controllerPullSpec:       "wonderfulPullspec",
+			},
+			pullsecret: "{\"auths\": {\"" + pullSecretOCMKey + "\": {\"auth\": \"secret value\"}}}",
+			mocks: func(md *mock_muo.MockDeployer, cluster *arov1alpha1.Cluster) {
+				expectedConfig := &config.MUODeploymentConfig{
+					Pullspec:        "wonderfulPullspec",
+					EnableConnected: false,
+				}
+				md.EXPECT().CreateOrUpdate(gomock.Any(), cluster, expectedConfig).Return(nil)
+				md.EXPECT().IsReady(gomock.Any()).Return(true, nil)
+			},
+		},
 		{
 			name: "managed, MUO does not become ready",
 			flags: arov1alpha1.OperatorFlags{
@@ -169,7 +189,8 @@ func TestMUOReconciler(t *testing.T) {
 			},
 			mocks: func(md *mock_muo.MockDeployer, cluster *arov1alpha1.Cluster) {
 				expectedConfig := &config.MUODeploymentConfig{
-					Pullspec: "wonderfulPullspec",
+					Pullspec:        "wonderfulPullspec",
+					EnableConnected: false,
 				}
 				md.EXPECT().CreateOrUpdate(gomock.Any(), cluster, expectedConfig).Return(nil)
 				md.EXPECT().IsReady(gomock.Any()).Return(false, nil)