Skip to content

Commit

Permalink
Merge pull request #2143 from hawkowl/hawkowl/muo-m2-default
Browse files Browse the repository at this point in the history
Enable MUO M2 by default
  • Loading branch information
hawkowl authored May 31, 2022
2 parents 5bb1018 + 4b99a89 commit 8753830
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 28 deletions.
6 changes: 3 additions & 3 deletions pkg/operator/controllers/muo/muo_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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

Expand Down
69 changes: 45 additions & 24 deletions pkg/operator/controllers/muo/muo_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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{
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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{
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/version/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 8753830

Please sign in to comment.