Merge pull request #2143 from hawkowl/hawkowl/muo-m2-default

Enable MUO M2 by default
This commit is contained in:
Amber Brown 2022-05-31 23:31:58 +10:00 коммит произвёл GitHub
Родитель 5bb1018ad4 4b99a89f92
Коммит 8753830fda
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 49 добавлений и 28 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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)

Просмотреть файл

@ -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"
}