diff --git a/internal/bminventory/detailed_supported_features_test.go b/internal/bminventory/detailed_supported_features_test.go index c87df4230277..d8751fdc1f4f 100644 --- a/internal/bminventory/detailed_supported_features_test.go +++ b/internal/bminventory/detailed_supported_features_test.go @@ -43,7 +43,7 @@ var _ = Describe("GetDetailedSupportedFeatures", func() { { OperatorName: "cnv", FeatureSupportID: models.FeatureSupportLevelIDCNV, - Dependencies: []models.FeatureSupportLevelID{models.FeatureSupportLevelIDLSO, models.FeatureSupportLevelIDLVM}, + Dependencies: []models.FeatureSupportLevelID{}, }, }).AnyTimes() } diff --git a/internal/operators/amdgpu/amd_gpu_operator.go b/internal/operators/amdgpu/amd_gpu_operator.go index 9bbf88e58023..8c8f28d7a358 100644 --- a/internal/operators/amdgpu/amd_gpu_operator.go +++ b/internal/operators/amdgpu/amd_gpu_operator.go @@ -72,11 +72,11 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(c *common.Cluster) ([]string, error) { +func (o *operator) GetDependencies(c *common.Cluster) []string { return []string{ nodefeaturediscovery.Operator.Name, kmm.Operator.Name, - }, nil + } } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { @@ -246,24 +246,16 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -273,7 +265,6 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } func (o *operator) GetFeatureSupportID() models.FeatureSupportLevelID { diff --git a/internal/operators/amdgpu/amd_gpu_operator_test.go b/internal/operators/amdgpu/amd_gpu_operator_test.go index 708483be4cc9..5c9dff988ce2 100644 --- a/internal/operators/amdgpu/amd_gpu_operator_test.go +++ b/internal/operators/amdgpu/amd_gpu_operator_test.go @@ -282,14 +282,13 @@ var _ = Describe("Operator", func() { Context("Dependencies", func() { It("Depends on the node feature discovery operator", func() { - deps, err := operator.GetDependencies(&common.Cluster{}) - Expect(err).ToNot(HaveOccurred()) + deps := operator.GetDependencies(&common.Cluster{}) Expect(deps).To(ContainElement(nodefeaturediscovery.Operator.Name)) + }) It("Depends on the kmm operator", func() { - deps, err := operator.GetDependencies(&common.Cluster{}) - Expect(err).ToNot(HaveOccurred()) + deps := operator.GetDependencies(&common.Cluster{}) Expect(deps).To(ContainElement(kmm.Operator.Name)) }) }) diff --git a/internal/operators/api/api.go b/internal/operators/api/api.go index ec76fce63f42..9ee117a5714e 100644 --- a/internal/operators/api/api.go +++ b/internal/operators/api/api.go @@ -34,7 +34,7 @@ type Operator interface { // GetFullName reports the full name of the specified Operator GetFullName() string // GetDependencies provides a list of dependencies of the Operator - GetDependencies(cluster *common.Cluster) ([]string, error) + GetDependencies(cluster *common.Cluster) []string // GetDependenciesFeatureSupportID provides a list of all feature ids that are potential dependencies GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID // ValidateCluster verifies whether this operator is valid for given cluster @@ -54,7 +54,7 @@ type Operator interface { // GetMonitoredOperator returns MonitoredOperator corresponding to the Operator implementation GetMonitoredOperator() *models.MonitoredOperator // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only - GetPreflightRequirements(ctx context.Context, cluster *common.Cluster) (*models.OperatorHardwareRequirements, error) + GetPreflightRequirements(ctx context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements // GetFeatureSupportID returns the operator unique feature-support ID GetFeatureSupportID() models.FeatureSupportLevelID // GetBundleLabels returns the list of bundles names associated with the operator based on the given feature IDs diff --git a/internal/operators/api/mock_operator_api.go b/internal/operators/api/mock_operator_api.go index e978b965d18c..08120e0bc412 100644 --- a/internal/operators/api/mock_operator_api.go +++ b/internal/operators/api/mock_operator_api.go @@ -87,12 +87,11 @@ func (mr *MockOperatorMockRecorder) GetClusterValidationIDs() *gomock.Call { } // GetDependencies mocks base method. -func (m *MockOperator) GetDependencies(cluster *common.Cluster) ([]string, error) { +func (m *MockOperator) GetDependencies(cluster *common.Cluster) []string { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetDependencies", cluster) ret0, _ := ret[0].([]string) - ret1, _ := ret[1].(error) - return ret0, ret1 + return ret0 } // GetDependencies indicates an expected call of GetDependencies. @@ -201,12 +200,11 @@ func (mr *MockOperatorMockRecorder) GetName() *gomock.Call { } // GetPreflightRequirements mocks base method. -func (m *MockOperator) GetPreflightRequirements(ctx context.Context, cluster *common.Cluster) (*models.OperatorHardwareRequirements, error) { +func (m *MockOperator) GetPreflightRequirements(ctx context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetPreflightRequirements", ctx, cluster) ret0, _ := ret[0].(*models.OperatorHardwareRequirements) - ret1, _ := ret[1].(error) - return ret0, ret1 + return ret0 } // GetPreflightRequirements indicates an expected call of GetPreflightRequirements. diff --git a/internal/operators/authorino/authorino_operator.go b/internal/operators/authorino/authorino_operator.go index 1cc2e63d4df6..2fb32975fb10 100644 --- a/internal/operators/authorino/authorino_operator.go +++ b/internal/operators/authorino/authorino_operator.go @@ -58,12 +58,12 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(c *common.Cluster) (result []string, err error) { - return +func (o *operator) GetDependencies(c *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the operator. @@ -106,24 +106,17 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (result *models.ClusterHostRequirementsDetails, err error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - return - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + result = preflightRequirements.Requirements.Worker.Quantitative return } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -133,7 +126,6 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } func (o *operator) GetFeatureSupportID() models.FeatureSupportLevelID { diff --git a/internal/operators/clusterobservability/cluster_observability_operator.go b/internal/operators/clusterobservability/cluster_observability_operator.go index 95f00c6a4114..f9abbbfd7070 100644 --- a/internal/operators/clusterobservability/cluster_observability_operator.go +++ b/internal/operators/clusterobservability/cluster_observability_operator.go @@ -6,6 +6,7 @@ import ( "github.com/lib/pq" "github.com/openshift/assisted-service/internal/common" operatorscommon "github.com/openshift/assisted-service/internal/operators/common" + "github.com/openshift/assisted-service/internal/operators/openshiftlogging" "github.com/openshift/assisted-service/internal/templating" "github.com/openshift/assisted-service/models" "github.com/sirupsen/logrus" @@ -50,8 +51,8 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return []string{"openshift-logging"}, nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{openshiftlogging.Operator.Name} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { diff --git a/internal/operators/clusterobservability/cluster_observability_requirements.go b/internal/operators/clusterobservability/cluster_observability_requirements.go index 14c035464171..299951e77851 100644 --- a/internal/operators/clusterobservability/cluster_observability_requirements.go +++ b/internal/operators/clusterobservability/cluster_observability_requirements.go @@ -11,24 +11,16 @@ import ( // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -38,5 +30,4 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } diff --git a/internal/operators/cnv/cnv_operator.go b/internal/operators/cnv/cnv_operator.go index 8fb19f52e5b4..eff12d5a11f7 100644 --- a/internal/operators/cnv/cnv_operator.go +++ b/internal/operators/cnv/cnv_operator.go @@ -11,8 +11,6 @@ import ( "github.com/openshift/assisted-service/internal/hardware/virt" "github.com/openshift/assisted-service/internal/operators/api" operatorscommon "github.com/openshift/assisted-service/internal/operators/common" - "github.com/openshift/assisted-service/internal/operators/lso" - "github.com/openshift/assisted-service/internal/operators/lvm" "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/conversions" logutil "github.com/openshift/assisted-service/pkg/log" @@ -66,31 +64,12 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - lsoOperator := []string{lso.Operator.Name} - lvmOperator := []string{lvm.Operator.Name} - - // Disable lso for ARM deployment as it's not supported - // to allow CNV ARM operator - if cluster.CPUArchitecture == common.ARM64CPUArchitecture || cluster.CPUArchitecture == common.MultiCPUArchitecture { - return make([]string, 0), nil - } - - if cluster.OpenshiftVersion == "" { - return lsoOperator, nil - } - - // SNO - if common.IsSingleNodeCluster(cluster) { - if isGreaterOrEqual, _ := common.BaseVersionGreaterOrEqual(lvm.LvmsMinOpenshiftVersion4_12, cluster.OpenshiftVersion); isGreaterOrEqual { - return lvmOperator, nil - } - } - return lsoOperator, nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return []models.FeatureSupportLevelID{models.FeatureSupportLevelIDLSO, models.FeatureSupportLevelIDLVM} + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the Operator @@ -199,11 +178,7 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // GetHostRequirements provides operator's requirements towards the host func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { log := logutil.FromContext(ctx, o.log) - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - log.WithError(err).Errorf("Cannot Retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) if common.IsSingleNodeCluster(cluster) { overhead, err := o.getDevicesMemoryOverhead(host) @@ -242,7 +217,7 @@ func (o *operator) getWorkerRequirements(ctx context.Context, cluster *common.Cl } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only -func (o *operator) GetPreflightRequirements(_ context.Context, cluster *common.Cluster) (*models.OperatorHardwareRequirements, error) { +func (o *operator) GetPreflightRequirements(_ context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { qualitativeRequirements := []string{ "Additional 1GiB of RAM per each supported GPU", "Additional 1GiB of RAM per each supported SR-IOV NIC", @@ -252,13 +227,9 @@ func (o *operator) GetPreflightRequirements(_ context.Context, cluster *common.C qualitativeRequirements = append(qualitativeRequirements, fmt.Sprintf("Additional disk with %d Gi", o.config.SNOPoolSizeRequestHPPGib)) } - cnvODependencies, err := o.GetDependencies(cluster) - if err != nil { - return &models.OperatorHardwareRequirements{}, err - } requirements := models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: cnvODependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Qualitative: qualitativeRequirements, @@ -282,7 +253,7 @@ func (o *operator) GetPreflightRequirements(_ context.Context, cluster *common.C requirements.Requirements.Master.Quantitative.RAMMib += WorkerMemory } - return &requirements, nil + return &requirements } func (o *operator) getDevicesMemoryOverhead(host *models.Host) (int64, error) { diff --git a/internal/operators/cnv/cnv_operator_test.go b/internal/operators/cnv/cnv_operator_test.go index 4dbd5e5a0d25..981ddaa78d32 100644 --- a/internal/operators/cnv/cnv_operator_test.go +++ b/internal/operators/cnv/cnv_operator_test.go @@ -10,8 +10,6 @@ import ( "github.com/openshift/assisted-service/internal/common" "github.com/openshift/assisted-service/internal/operators/api" "github.com/openshift/assisted-service/internal/operators/cnv" - "github.com/openshift/assisted-service/internal/operators/lso" - "github.com/openshift/assisted-service/internal/operators/lvm" "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/conversions" "github.com/sirupsen/logrus" @@ -37,24 +35,19 @@ var _ = Describe("CNV operator", func() { operator = cnv.NewCNVOperator(log, cfg) }) - DescribeTable("getDependencies", func(ocpVersion string, haMode int64, expectedOperator string) { - cluster := common.Cluster{ - Cluster: models.Cluster{ControlPlaneCount: haMode, OpenshiftVersion: ocpVersion}, - } - - requirements, err := operator.GetDependencies(&cluster) - Expect(err).ToNot(HaveOccurred()) - Expect(requirements).ToNot(BeNil()) - - Expect(requirements[0]).To(BeEquivalentTo(expectedOperator)) - }, + Context("GetDependencies", func() { + It("should return no dependencies", func() { + dependencies := operator.GetDependencies(&common.Cluster{}) + Expect(dependencies).To(BeEmpty()) + }) + }) - Entry("LVM, Single node 4.12", "4.12", int64(1), lvm.Operator.Name), - Entry("LSO, Multi node 4.15", "4.15", int64(common.MinMasterHostsNeededForInstallationInHaMode), lso.Operator.Name), - Entry("LSO, Multi node 4.21", "4.21", int64(common.MinMasterHostsNeededForInstallationInHaMode), lso.Operator.Name), - Entry("LSO, Multi node 4.12", "4.12", int64(common.MinMasterHostsNeededForInstallationInHaMode), lso.Operator.Name), - Entry("LSO, Single node 4.11", "4.11", int64(1), lso.Operator.Name), - ) + Context("GetDependenciesFeatureSupportID", func() { + It("should return no dependencies", func() { + dependencies := operator.GetDependenciesFeatureSupportID() + Expect(dependencies).To(BeEmpty()) + }) + }) Context("host requirements", func() { @@ -62,7 +55,7 @@ var _ = Describe("CNV operator", func() { BeforeEach(func() { cluster = common.Cluster{ - Cluster: models.Cluster{ControlPlaneCount: common.MinMasterHostsNeededForInstallationInHaMode, OpenshiftVersion: lvm.LvmsMinOpenshiftVersion4_12}, + Cluster: models.Cluster{ControlPlaneCount: common.MinMasterHostsNeededForInstallationInHaMode, OpenshiftVersion: "4.12.0"}, } }) @@ -227,7 +220,7 @@ var _ = Describe("CNV operator", func() { It("should return reqs for SNO", func() { host := models.Host{Role: models.HostRoleMaster} cluster = common.Cluster{ - Cluster: models.Cluster{ControlPlaneCount: 1, OpenshiftVersion: lvm.LvmsMinOpenshiftVersion4_12}, + Cluster: models.Cluster{ControlPlaneCount: 1, OpenshiftVersion: "4.12.0"}, } requirements, err := operator.GetHostRequirements(context.TODO(), &cluster, &host) @@ -299,9 +292,7 @@ var _ = Describe("CNV operator", func() { DescribeTable("GetPreflightRequirements, should be returned", func(cfg cnv.Config, cluster common.Cluster) { cnvOperator := cnv.NewCNVOperator(log, cfg) - requirements, err := cnvOperator.GetPreflightRequirements(context.TODO(), &cluster) - Expect(err).ToNot(HaveOccurred()) - Expect(requirements.Dependencies).To(ConsistOf(lso.Operator.Name)) + requirements := cnvOperator.GetPreflightRequirements(context.TODO(), &cluster) Expect(requirements.OperatorName).To(BeEquivalentTo(cnv.Operator.Name)) numQualitative := 3 workerRequirements := newRequirements(cnv.WorkerCPU, cnv.WorkerMemory) diff --git a/internal/operators/fenceagentsremediation/fence_agents_remediation_operator.go b/internal/operators/fenceagentsremediation/fence_agents_remediation_operator.go index b7894746088a..968030f348db 100644 --- a/internal/operators/fenceagentsremediation/fence_agents_remediation_operator.go +++ b/internal/operators/fenceagentsremediation/fence_agents_remediation_operator.go @@ -50,8 +50,8 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return []string{operatorsCommon.NodeHealthcheckOperatorName}, nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{operatorsCommon.NodeHealthcheckOperatorName} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { diff --git a/internal/operators/fenceagentsremediation/fence_agents_remediation_requirements.go b/internal/operators/fenceagentsremediation/fence_agents_remediation_requirements.go index 9ad2731cc8f4..c4ddd5b70a84 100644 --- a/internal/operators/fenceagentsremediation/fence_agents_remediation_requirements.go +++ b/internal/operators/fenceagentsremediation/fence_agents_remediation_requirements.go @@ -11,24 +11,16 @@ import ( // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -38,5 +30,4 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } diff --git a/internal/operators/kmm/kmm_operator.go b/internal/operators/kmm/kmm_operator.go index d2944830afb3..c8945f9aa7c8 100644 --- a/internal/operators/kmm/kmm_operator.go +++ b/internal/operators/kmm/kmm_operator.go @@ -60,13 +60,12 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(c *common.Cluster) ([]string, error) { - result := []string{} - return result, nil +func (o *operator) GetDependencies(c *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the operator. @@ -143,24 +142,16 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -170,7 +161,6 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } func (o *operator) GetFeatureSupportID() models.FeatureSupportLevelID { diff --git a/internal/operators/kubedescheduler/kube_descheduler_operator.go b/internal/operators/kubedescheduler/kube_descheduler_operator.go index 80e72f3bb019..4a3914280591 100644 --- a/internal/operators/kubedescheduler/kube_descheduler_operator.go +++ b/internal/operators/kubedescheduler/kube_descheduler_operator.go @@ -50,12 +50,12 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return []string{}, nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the Operator diff --git a/internal/operators/kubedescheduler/kube_descheduler_requirements.go b/internal/operators/kubedescheduler/kube_descheduler_requirements.go index 9575c824e7d1..638edd77ebcb 100644 --- a/internal/operators/kubedescheduler/kube_descheduler_requirements.go +++ b/internal/operators/kubedescheduler/kube_descheduler_requirements.go @@ -11,24 +11,16 @@ import ( // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -38,5 +30,4 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } diff --git a/internal/operators/loki/loki_operator.go b/internal/operators/loki/loki_operator.go index 7b1290ea116e..1dceca7c01f8 100644 --- a/internal/operators/loki/loki_operator.go +++ b/internal/operators/loki/loki_operator.go @@ -59,12 +59,12 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return []string{}, nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the Operator @@ -121,24 +121,16 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // GetHostRequirements provides the requirements that the host needs to satisfy func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{ @@ -154,7 +146,6 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } // GetFeatureSupportID returns the operator unique feature-support ID diff --git a/internal/operators/loki/loki_operator_test.go b/internal/operators/loki/loki_operator_test.go index ace957727ead..9583d8fa46de 100644 --- a/internal/operators/loki/loki_operator_test.go +++ b/internal/operators/loki/loki_operator_test.go @@ -40,16 +40,15 @@ var _ = Describe("Loki Operator", func() { Context("GetDependencies", func() { It("should return no dependencies", func() { - deps, err := operator.GetDependencies(cluster) - Expect(err).ToNot(HaveOccurred()) + deps := operator.GetDependencies(cluster) Expect(deps).To(BeEmpty()) }) }) Context("GetDependenciesFeatureSupportID", func() { - It("should return nil for no dependencies", func() { + It("should return no dependencies", func() { deps := operator.GetDependenciesFeatureSupportID() - Expect(deps).To(BeNil()) + Expect(deps).To(BeEmpty()) }) }) @@ -73,8 +72,7 @@ var _ = Describe("Loki Operator", func() { Context("GetPreflightRequirements", func() { It("should return zero requirements", func() { - reqs, err := operator.GetPreflightRequirements(ctx, cluster) - Expect(err).ToNot(HaveOccurred()) + reqs := operator.GetPreflightRequirements(ctx, cluster) Expect(reqs.OperatorName).To(Equal("loki")) Expect(reqs.Requirements.Master.Quantitative.CPUCores).To(Equal(int64(0))) Expect(reqs.Requirements.Master.Quantitative.RAMMib).To(Equal(int64(0))) diff --git a/internal/operators/lso/ls_operator.go b/internal/operators/lso/ls_operator.go index 0263dd6c0554..82800e00c033 100644 --- a/internal/operators/lso/ls_operator.go +++ b/internal/operators/lso/ls_operator.go @@ -40,12 +40,12 @@ func (l *lsOperator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (l *lsOperator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return make([]string, 0), nil +func (l *lsOperator) GetDependencies(cluster *common.Cluster) []string { + return []string{} } func (o *lsOperator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the Operator @@ -93,14 +93,10 @@ func (l *lsOperator) GetHostRequirements(context.Context, *common.Cluster, *mode } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only -func (l *lsOperator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) (*models.OperatorHardwareRequirements, error) { - dependecies, err := l.GetDependencies(cluster) - if err != nil { - return &models.OperatorHardwareRequirements{}, err - } +func (l *lsOperator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { return &models.OperatorHardwareRequirements{ OperatorName: l.GetName(), - Dependencies: dependecies, + Dependencies: l.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -109,7 +105,7 @@ func (l *lsOperator) GetPreflightRequirements(context context.Context, cluster * Quantitative: &models.ClusterHostRequirementsDetails{}, }, }, - }, nil + } } func (l *lsOperator) GetFeatureSupportID() models.FeatureSupportLevelID { diff --git a/internal/operators/lvm/lvm_operator.go b/internal/operators/lvm/lvm_operator.go index aee82c2d19f3..29e98ba1dead 100644 --- a/internal/operators/lvm/lvm_operator.go +++ b/internal/operators/lvm/lvm_operator.go @@ -10,7 +10,6 @@ import ( "github.com/openshift/assisted-service/internal/operators/api" operatorscommon "github.com/openshift/assisted-service/internal/operators/common" "github.com/openshift/assisted-service/models" - logutil "github.com/openshift/assisted-service/pkg/log" "github.com/sirupsen/logrus" ) @@ -67,12 +66,12 @@ func (o *operator) StorageClassName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return make([]string, 0), nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the Operator @@ -172,12 +171,7 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // GetHostRequirements provides operator's requirements towards the host func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - log := logutil.FromContext(ctx, o.log) - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - log.WithError(err).Errorf("Cannot retrieve preflight requirements for host %s", host.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) role := common.GetEffectiveRole(host) areSchedulable := common.ShouldMastersBeSchedulable(&cluster.Cluster) @@ -193,12 +187,7 @@ func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Clus } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only -func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) (*models.OperatorHardwareRequirements, error) { - dependecies, err := o.GetDependencies(cluster) - if err != nil { - return &models.OperatorHardwareRequirements{}, err - } - +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { memoryRequirements := o.Config.LvmMemoryPerHostMiB if ok, _ := common.BaseVersionLessThan(LvmsMinOpenshiftVersion_ForNewResourceRequirements, cluster.OpenshiftVersion); ok { memoryRequirements = o.Config.LvmMemoryPerHostMiBBefore4_13 @@ -215,7 +204,7 @@ func (o *operator) GetPreflightRequirements(context context.Context, cluster *co return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependecies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Qualitative: requirementMessage, @@ -232,7 +221,7 @@ func (o *operator) GetPreflightRequirements(context context.Context, cluster *co }, }, }, - }, nil + } } func (o *operator) GetFeatureSupportID() models.FeatureSupportLevelID { diff --git a/internal/operators/manager.go b/internal/operators/manager.go index 4f6bbbaa837b..dc55eb3dd0e1 100644 --- a/internal/operators/manager.go +++ b/internal/operators/manager.go @@ -112,17 +112,13 @@ type API interface { // GetPreflightRequirementsBreakdownForCluster provides host requirements breakdown for each supported OLM operator func (mgr Manager) GetPreflightRequirementsBreakdownForCluster(ctx context.Context, cluster *common.Cluster) ([]*models.OperatorHardwareRequirements, error) { - logger := logutil.FromContext(ctx, mgr.log) var requirements []*models.OperatorHardwareRequirements if common.IsDay2Cluster(cluster) { return requirements, nil } - for operatorName, operator := range mgr.olmOperators { - reqs, err := operator.GetPreflightRequirements(ctx, cluster) - if err != nil { - logger.WithError(err).Errorf("Cannot get preflight requirements for %s operator", operatorName) - return nil, err - } + for _, operator := range mgr.olmOperators { + reqs := operator.GetPreflightRequirements(ctx, cluster) + requirements = append(requirements, reqs) } return requirements, nil @@ -534,10 +530,7 @@ func (mgr *Manager) ResolveDependencies(cluster *common.Cluster, operators []*mo } // Get dependent operators - allDependentOperators, err := mgr.getDependencies(cluster, ret) - if err != nil { - return nil, err - } + allDependentOperators := mgr.getDependencies(cluster, ret) for operatorName := range allDependentOperators { if funk.Contains(alreadyPresent, operatorName) { @@ -566,7 +559,7 @@ func (mgr *Manager) getDependency(name string, definitions map[string]*models.Mo return mgr.GetOperatorByName(name) } -func (mgr *Manager) getDependencies(cluster *common.Cluster, operators []*models.MonitoredOperator) (map[string]bool, error) { +func (mgr *Manager) getDependencies(cluster *common.Cluster, operators []*models.MonitoredOperator) map[string]bool { fifo := list.New() visited := make(map[string]bool) for _, op := range operators { @@ -574,10 +567,8 @@ func (mgr *Manager) getDependencies(cluster *common.Cluster, operators []*models continue } mgr.log.Debugf("Attempting to resolve %s operator dependencies", op.Name) - deps, err := mgr.olmOperators[op.Name].GetDependencies(cluster) - if err != nil { - return map[string]bool{}, err - } + deps := mgr.olmOperators[op.Name].GetDependencies(cluster) + visited[op.Name] = true mgr.log.Debugf("Dependencies found for %s operator: %+v ", op.Name, deps) for _, dep := range deps { @@ -587,10 +578,8 @@ func (mgr *Manager) getDependencies(cluster *common.Cluster, operators []*models for fifo.Len() > 0 { first := fifo.Front() op := first.Value.(string) - deps, err := mgr.olmOperators[op].GetDependencies(cluster) - if err != nil { - return map[string]bool{}, err - } + deps := mgr.olmOperators[op].GetDependencies(cluster) + for _, dep := range deps { if !visited[dep] { fifo.PushBack(dep) @@ -600,7 +589,7 @@ func (mgr *Manager) getDependencies(cluster *common.Cluster, operators []*models fifo.Remove(first) } - return visited, nil + return visited } func (mgr *Manager) GetMonitoredOperatorsList() map[string]*models.MonitoredOperator { diff --git a/internal/operators/manager_test.go b/internal/operators/manager_test.go index 57af1fe83357..359f81749aaf 100644 --- a/internal/operators/manager_test.go +++ b/internal/operators/manager_test.go @@ -892,7 +892,7 @@ var _ = Describe("Operators manager", func() { ), Entry("when only CNV is specified", []*models.MonitoredOperator{&cnv.Operator}, - []*models.MonitoredOperator{&cnv.Operator, &lsoDependency}, + []*models.MonitoredOperator{&cnv.Operator}, ), Entry("when CNV, ODF and LSO are specified", []*models.MonitoredOperator{&cnv.Operator, &odf.Operator, &lso.Operator}, @@ -1012,9 +1012,9 @@ var _ = Describe("Operators manager", func() { }) It("should be provided for configured operators", func() { requirements1 := models.OperatorHardwareRequirements{OperatorName: operatorName1} - operator1.EXPECT().GetPreflightRequirements(gomock.Any(), gomock.Eq(cluster)).Return(&requirements1, nil) + operator1.EXPECT().GetPreflightRequirements(gomock.Any(), gomock.Eq(cluster)).Return(&requirements1) requirements2 := models.OperatorHardwareRequirements{OperatorName: operatorName2} - operator2.EXPECT().GetPreflightRequirements(gomock.Any(), gomock.Eq(cluster)).Return(&requirements2, nil) + operator2.EXPECT().GetPreflightRequirements(gomock.Any(), gomock.Eq(cluster)).Return(&requirements2) reqBreakdown, err := manager.GetPreflightRequirementsBreakdownForCluster(context.TODO(), cluster) @@ -1025,17 +1025,6 @@ var _ = Describe("Operators manager", func() { &models.OperatorHardwareRequirements{OperatorName: operatorName2}, )) }) - - It("should return error", func() { - theError := errors.New("boom") - operator1.EXPECT().GetPreflightRequirements(gomock.Any(), gomock.Eq(cluster)).Return(nil, theError).AnyTimes() - operator2.EXPECT().GetPreflightRequirements(gomock.Any(), gomock.Eq(cluster)).Return(nil, theError).AnyTimes() - - _, err := manager.GetPreflightRequirementsBreakdownForCluster(context.TODO(), cluster) - - Expect(err).To(HaveOccurred()) - Expect(err).To(BeEquivalentTo(theError)) - }) }) Context("Bundles", func() { diff --git a/internal/operators/mce/mce_operator.go b/internal/operators/mce/mce_operator.go index 74b19682b9da..aedf018d6d53 100644 --- a/internal/operators/mce/mce_operator.go +++ b/internal/operators/mce/mce_operator.go @@ -10,7 +10,6 @@ import ( "github.com/openshift/assisted-service/internal/operators/api" "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/conversions" - logutil "github.com/openshift/assisted-service/pkg/log" "github.com/samber/lo" "github.com/sirupsen/logrus" ) @@ -64,12 +63,12 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return make([]string, 0), nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the operator. @@ -167,12 +166,7 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // GetHostRequirements provides the requirements that the host needs to satisfy in order to be able to install the operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - log := logutil.FromContext(ctx, o.log) - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) if common.IsSingleNodeCluster(cluster) { // SNO req @@ -190,14 +184,10 @@ func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Clus } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only -func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) (*models.OperatorHardwareRequirements, error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return &models.OperatorHardwareRequirements{}, err - } +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Qualitative: []string{}, @@ -214,7 +204,7 @@ func (o *operator) GetPreflightRequirements(context context.Context, cluster *co }, }, }, - }, nil + } } func (o *operator) GetSupportedArchitectures() []string { diff --git a/internal/operators/metallb/metallb_operator.go b/internal/operators/metallb/metallb_operator.go index f81b432f5a22..6174ae532eda 100644 --- a/internal/operators/metallb/metallb_operator.go +++ b/internal/operators/metallb/metallb_operator.go @@ -62,15 +62,13 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return make([]string, 0), nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{} } // GetDependenciesFeatureSupportID returns feature support level IDs for the Operator func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return []models.FeatureSupportLevelID{ - models.FeatureSupportLevelIDMETALLB, - } + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the Operator @@ -115,15 +113,10 @@ func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Clus } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only -func (o *operator) GetPreflightRequirements(ctx context.Context, cluster *common.Cluster) (*models.OperatorHardwareRequirements, error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return &models.OperatorHardwareRequirements{}, err - } - +func (o *operator) GetPreflightRequirements(ctx context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Qualitative: []string{}, @@ -134,7 +127,7 @@ func (o *operator) GetPreflightRequirements(ctx context.Context, cluster *common Quantitative: &models.ClusterHostRequirementsDetails{}, }, }, - }, nil + } } // GetFeatureSupportID returns the feature support level ID for MetalLB diff --git a/internal/operators/metallb/metallb_operator_test.go b/internal/operators/metallb/metallb_operator_test.go index c096360195d1..108c40ffcacd 100644 --- a/internal/operators/metallb/metallb_operator_test.go +++ b/internal/operators/metallb/metallb_operator_test.go @@ -30,8 +30,7 @@ var _ = Describe("MetalLB operator", func() { It("GetDependencies", func() { cluster := common.Cluster{} - dependencies, err := metalLBOp.GetDependencies(&cluster) - Expect(err).To(Not(HaveOccurred())) + dependencies := metalLBOp.GetDependencies(&cluster) Expect(dependencies).To(BeEmpty()) }) diff --git a/internal/operators/mtv/operator.go b/internal/operators/mtv/operator.go index 49964ddc6b5d..5eba4e63c76d 100644 --- a/internal/operators/mtv/operator.go +++ b/internal/operators/mtv/operator.go @@ -13,7 +13,6 @@ import ( operatorscommon "github.com/openshift/assisted-service/internal/operators/common" "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/conversions" - logutil "github.com/openshift/assisted-service/pkg/log" "github.com/sirupsen/logrus" ) @@ -54,8 +53,8 @@ func (o *operator) GetFullName() string { return FullName } -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return []string{cnv.Operator.Name}, nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{cnv.Operator.Name} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { @@ -141,30 +140,20 @@ func (o *operator) ValidateHost(ctx context.Context, cluster *common.Cluster, ho // GetHostRequirements provides operator's requirements towards the host func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - log := logutil.FromContext(ctx, o.log) - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - log.WithError(err).Errorf("Cannot retrieve preflight requirements for host %s", host.ID) - return nil, err - } - if host.Role == models.HostRoleArbiter { return &models.ClusterHostRequirementsDetails{}, nil } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Master.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only -func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) (*models.OperatorHardwareRequirements, error) { - dependecies, err := o.GetDependencies(cluster) - if err != nil { - return &models.OperatorHardwareRequirements{}, err - } - +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependecies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Qualitative: []string{ @@ -187,7 +176,7 @@ func (o *operator) GetPreflightRequirements(context context.Context, cluster *co }, }, }, - }, nil + } } // GetProperties provides description of operator properties: none required diff --git a/internal/operators/mtv/operator_test.go b/internal/operators/mtv/operator_test.go index 18fe13508a80..113ff4f3e000 100644 --- a/internal/operators/mtv/operator_test.go +++ b/internal/operators/mtv/operator_test.go @@ -72,8 +72,7 @@ var _ = Describe("MTV Operator", func() { ) It("should return the dependencies", func() { - preflightRequirements, err := operator.GetPreflightRequirements(context.TODO(), &cluster) - Expect(err).To(BeNil()) + preflightRequirements := operator.GetPreflightRequirements(context.TODO(), &cluster) Expect(preflightRequirements.Dependencies).To(Equal([]string{cnv.Operator.Name})) }) }) diff --git a/internal/operators/nmstate/operator.go b/internal/operators/nmstate/operator.go index 13c8c7dbe28e..b9a078260483 100644 --- a/internal/operators/nmstate/operator.go +++ b/internal/operators/nmstate/operator.go @@ -10,7 +10,6 @@ import ( "github.com/openshift/assisted-service/internal/operators/api" operatorscommon "github.com/openshift/assisted-service/internal/operators/common" "github.com/openshift/assisted-service/models" - logutil "github.com/openshift/assisted-service/pkg/log" "github.com/sirupsen/logrus" ) @@ -51,12 +50,12 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return make([]string, 0), nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the Operator @@ -120,25 +119,16 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // GetHostRequirements provides operator's requirements towards the host func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - log := logutil.FromContext(ctx, o.log) - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - log.WithError(err).Errorf("Cannot retrieve preflight requirements for host %s", host.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only -func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) (*models.OperatorHardwareRequirements, error) { - dependecies, err := o.GetDependencies(cluster) - if err != nil { - return &models.OperatorHardwareRequirements{}, err - } - +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependecies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -147,7 +137,7 @@ func (o *operator) GetPreflightRequirements(context context.Context, cluster *co Quantitative: &models.ClusterHostRequirementsDetails{}, }, }, - }, nil + } } func (o *operator) GetFeatureSupportID() models.FeatureSupportLevelID { diff --git a/internal/operators/nodefeaturediscovery/node_feature_discovery_operator.go b/internal/operators/nodefeaturediscovery/node_feature_discovery_operator.go index b7d6286e62fb..de16e1e20030 100644 --- a/internal/operators/nodefeaturediscovery/node_feature_discovery_operator.go +++ b/internal/operators/nodefeaturediscovery/node_feature_discovery_operator.go @@ -60,12 +60,12 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(c *common.Cluster) ([]string, error) { - return make([]string, 0), nil +func (o *operator) GetDependencies(c *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the operator. @@ -110,24 +110,16 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -137,7 +129,6 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } func (o *operator) GetFeatureSupportID() models.FeatureSupportLevelID { diff --git a/internal/operators/nodehealthcheck/node_healthcheck_operator.go b/internal/operators/nodehealthcheck/node_healthcheck_operator.go index b9f8e671a030..ad38971a327b 100644 --- a/internal/operators/nodehealthcheck/node_healthcheck_operator.go +++ b/internal/operators/nodehealthcheck/node_healthcheck_operator.go @@ -58,8 +58,8 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return []string{}, nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { diff --git a/internal/operators/nodehealthcheck/node_healthcheck_requirements.go b/internal/operators/nodehealthcheck/node_healthcheck_requirements.go index dec9c98c84de..7a4f947d5827 100644 --- a/internal/operators/nodehealthcheck/node_healthcheck_requirements.go +++ b/internal/operators/nodehealthcheck/node_healthcheck_requirements.go @@ -11,24 +11,16 @@ import ( // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -38,5 +30,4 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } diff --git a/internal/operators/nodemaintenance/node_maintenance_operator.go b/internal/operators/nodemaintenance/node_maintenance_operator.go index f774c587a4c7..9792c0d5ed30 100644 --- a/internal/operators/nodemaintenance/node_maintenance_operator.go +++ b/internal/operators/nodemaintenance/node_maintenance_operator.go @@ -50,12 +50,12 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return []string{}, nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the Operator diff --git a/internal/operators/nodemaintenance/node_maintenance_requirements.go b/internal/operators/nodemaintenance/node_maintenance_requirements.go index c3cd1fccccdd..646d2563794a 100644 --- a/internal/operators/nodemaintenance/node_maintenance_requirements.go +++ b/internal/operators/nodemaintenance/node_maintenance_requirements.go @@ -11,24 +11,16 @@ import ( // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -38,5 +30,4 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } diff --git a/internal/operators/numaresources/numaresources_operator.go b/internal/operators/numaresources/numaresources_operator.go index c7bf379a73cf..709ad1066966 100644 --- a/internal/operators/numaresources/numaresources_operator.go +++ b/internal/operators/numaresources/numaresources_operator.go @@ -50,12 +50,12 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return []string{}, nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the Operator diff --git a/internal/operators/numaresources/numaresources_requirements.go b/internal/operators/numaresources/numaresources_requirements.go index 6e3d64220b1a..78ea50811ae8 100644 --- a/internal/operators/numaresources/numaresources_requirements.go +++ b/internal/operators/numaresources/numaresources_requirements.go @@ -11,24 +11,16 @@ import ( // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -38,5 +30,4 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } diff --git a/internal/operators/nvidiagpu/nvidia_gpu_operator.go b/internal/operators/nvidiagpu/nvidia_gpu_operator.go index 6b39f108c71f..dfc5341e6abf 100644 --- a/internal/operators/nvidiagpu/nvidia_gpu_operator.go +++ b/internal/operators/nvidiagpu/nvidia_gpu_operator.go @@ -71,11 +71,8 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(c *common.Cluster) ([]string, error) { - result := []string{ - nodefeaturediscovery.Operator.Name, - } - return result, nil +func (o *operator) GetDependencies(c *common.Cluster) []string { + return []string{nodefeaturediscovery.Operator.Name} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { @@ -244,24 +241,16 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -271,7 +260,6 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } func (o *operator) GetFeatureSupportID() models.FeatureSupportLevelID { diff --git a/internal/operators/nvidiagpu/nvidia_gpu_operator_test.go b/internal/operators/nvidiagpu/nvidia_gpu_operator_test.go index 60787d8b84a9..21e48b8b7282 100644 --- a/internal/operators/nvidiagpu/nvidia_gpu_operator_test.go +++ b/internal/operators/nvidiagpu/nvidia_gpu_operator_test.go @@ -301,8 +301,7 @@ var _ = Describe("Operator", func() { }) It("Depends on the node feature discovery operator", func() { - deps, err := operator.GetDependencies(&common.Cluster{}) - Expect(err).ToNot(HaveOccurred()) + deps := operator.GetDependencies(&common.Cluster{}) Expect(deps).To(ContainElement(nodefeaturediscovery.Operator.Name)) }) }) diff --git a/internal/operators/oadp/oadp_operator.go b/internal/operators/oadp/oadp_operator.go index 38c6b15b90cc..2725a97d34be 100644 --- a/internal/operators/oadp/oadp_operator.go +++ b/internal/operators/oadp/oadp_operator.go @@ -50,12 +50,12 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return []string{}, nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the Operator diff --git a/internal/operators/oadp/oadp_requirements.go b/internal/operators/oadp/oadp_requirements.go index 2051b6af9bbf..7644bca92fc1 100644 --- a/internal/operators/oadp/oadp_requirements.go +++ b/internal/operators/oadp/oadp_requirements.go @@ -11,24 +11,16 @@ import ( // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -38,5 +30,4 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } diff --git a/internal/operators/odf/odf_operator.go b/internal/operators/odf/odf_operator.go index 97613322ec23..894a4d06f552 100644 --- a/internal/operators/odf/odf_operator.go +++ b/internal/operators/odf/odf_operator.go @@ -80,8 +80,8 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return []string{lso.Operator.Name}, nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{lso.Operator.Name} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { @@ -287,14 +287,10 @@ func (o *operator) GetHostRequirements(_ context.Context, cluster *common.Cluste } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only -func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) (*models.OperatorHardwareRequirements, error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return &models.OperatorHardwareRequirements{}, err - } +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{ @@ -321,7 +317,7 @@ func (o *operator) GetPreflightRequirements(context context.Context, cluster *co }, }, }, - }, nil + } } func (o *operator) GetFeatureSupportID() models.FeatureSupportLevelID { diff --git a/internal/operators/openshiftai/openshift_ai_operator.go b/internal/operators/openshiftai/openshift_ai_operator.go index 7be9fb5f990f..e069525636f8 100644 --- a/internal/operators/openshiftai/openshift_ai_operator.go +++ b/internal/operators/openshiftai/openshift_ai_operator.go @@ -73,11 +73,12 @@ func (o *operator) GetFullName() string { // GetDependencies provides a list of dependencies of the Operator. // GPU vendors (NVIDIA, AMD) are no longer auto-selected as dependencies — users // must explicitly choose them via the bundle's optional_operators. -func (o *operator) GetDependencies(c *common.Cluster) ([]string, error) { +func (o *operator) GetDependencies(c *common.Cluster) []string { if common.IsSingleNodeCluster(c) { - return []string{lvm.Operator.Name}, nil + return []string{lvm.Operator.Name} } - return []string{}, nil + + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { @@ -231,11 +232,8 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (result *models.ClusterHostRequirementsDetails, err error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + switch common.GetEffectiveRole(host) { case models.HostRoleMaster: result = preflightRequirements.Requirements.Master.Quantitative @@ -248,15 +246,10 @@ func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Clus } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Qualitative: []string{}, @@ -274,7 +267,6 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } func (o *operator) GetSupportedArchitectures() []string { diff --git a/internal/operators/openshiftai/openshift_ai_operator_test.go b/internal/operators/openshiftai/openshift_ai_operator_test.go index c4b98b4d9183..1df0ed4e2d8c 100644 --- a/internal/operators/openshiftai/openshift_ai_operator_test.go +++ b/internal/operators/openshiftai/openshift_ai_operator_test.go @@ -114,15 +114,13 @@ var _ = Describe("GetDependencies", func() { Hosts: []*models.Host{{}}, }, } - dependencies, err := operator.GetDependencies(cluster) - Expect(err).ToNot(HaveOccurred()) + dependencies := operator.GetDependencies(cluster) Expect(dependencies).To(BeEmpty()) }) It("should return no dependencies for a cluster without hosts", func() { cluster := &common.Cluster{} - dependencies, err := operator.GetDependencies(cluster) - Expect(err).ToNot(HaveOccurred()) + dependencies := operator.GetDependencies(cluster) Expect(dependencies).To(BeEmpty()) }) @@ -132,8 +130,7 @@ var _ = Describe("GetDependencies", func() { ControlPlaneCount: 1, }, } - dependencies, err := operator.GetDependencies(cluster) - Expect(err).ToNot(HaveOccurred()) + dependencies := operator.GetDependencies(cluster) Expect(dependencies).To(ConsistOf(lvm.Operator.Name)) }) }) diff --git a/internal/operators/openshiftlogging/openshift_logging_operator.go b/internal/operators/openshiftlogging/openshift_logging_operator.go index 1296b7a434ca..0984f833b83f 100644 --- a/internal/operators/openshiftlogging/openshift_logging_operator.go +++ b/internal/operators/openshiftlogging/openshift_logging_operator.go @@ -9,6 +9,7 @@ import ( "github.com/openshift/assisted-service/internal/common" "github.com/openshift/assisted-service/internal/operators/api" operatorscommon "github.com/openshift/assisted-service/internal/operators/common" + "github.com/openshift/assisted-service/internal/operators/loki" "github.com/openshift/assisted-service/internal/templating" "github.com/openshift/assisted-service/models" "github.com/sirupsen/logrus" @@ -59,9 +60,9 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { +func (o *operator) GetDependencies(cluster *common.Cluster) []string { // OpenShift Logging depends on Loki Operator - return []string{"loki"}, nil + return []string{loki.Operator.Name} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { @@ -122,24 +123,16 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // GetHostRequirements provides the requirements that the host needs to satisfy func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{ @@ -155,7 +148,6 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } // GetFeatureSupportID returns the operator unique feature-support ID diff --git a/internal/operators/openshiftlogging/openshift_logging_operator_test.go b/internal/operators/openshiftlogging/openshift_logging_operator_test.go index 34603625c703..2c05d2a63603 100644 --- a/internal/operators/openshiftlogging/openshift_logging_operator_test.go +++ b/internal/operators/openshiftlogging/openshift_logging_operator_test.go @@ -40,8 +40,7 @@ var _ = Describe("OpenShift Logging Operator", func() { Context("GetDependencies", func() { It("should return Loki as dependency", func() { - deps, err := operator.GetDependencies(cluster) - Expect(err).ToNot(HaveOccurred()) + deps := operator.GetDependencies(cluster) Expect(deps).To(ContainElement("loki")) }) }) @@ -73,8 +72,7 @@ var _ = Describe("OpenShift Logging Operator", func() { Context("GetPreflightRequirements", func() { It("should return zero requirements", func() { - reqs, err := operator.GetPreflightRequirements(ctx, cluster) - Expect(err).ToNot(HaveOccurred()) + reqs := operator.GetPreflightRequirements(ctx, cluster) Expect(reqs.OperatorName).To(Equal("openshift-logging")) Expect(reqs.Requirements.Master.Quantitative.CPUCores).To(Equal(int64(0))) Expect(reqs.Requirements.Master.Quantitative.RAMMib).To(Equal(int64(0))) diff --git a/internal/operators/osc/operator.go b/internal/operators/osc/operator.go index fe7be730c445..60916047e04b 100644 --- a/internal/operators/osc/operator.go +++ b/internal/operators/osc/operator.go @@ -11,7 +11,6 @@ import ( "github.com/openshift/assisted-service/internal/operators/nodefeaturediscovery" "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/conversions" - logutil "github.com/openshift/assisted-service/pkg/log" "github.com/sirupsen/logrus" ) @@ -54,12 +53,12 @@ func (o *operator) GetFullName() string { return FullName } -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return []string{nodefeaturediscovery.Operator.Name}, nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{nodefeaturediscovery.Operator.Name} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{models.FeatureSupportLevelIDNODEFEATUREDISCOVERY} } // GetClusterValidationIDs returns cluster validation IDs for the Operator @@ -141,12 +140,8 @@ func (o *operator) ValidateHost(ctx context.Context, cluster *common.Cluster, ho // GetHostRequirements provides operator's requirements towards the host func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - log := logutil.FromContext(ctx, o.log) - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - log.WithError(err).Errorf("Cannot retrieve preflight requirements for host %s", host.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + role := common.GetEffectiveRole(host) switch role { case models.HostRoleMaster: @@ -160,15 +155,10 @@ func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Clus } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only -func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) (*models.OperatorHardwareRequirements, error) { - dependecies, err := o.GetDependencies(cluster) - if err != nil { - return &models.OperatorHardwareRequirements{}, err - } - +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependecies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Qualitative: []string{ @@ -191,7 +181,7 @@ func (o *operator) GetPreflightRequirements(context context.Context, cluster *co }, }, }, - }, nil + } } // GetProperties provides description of operator properties: none required diff --git a/internal/operators/osc/operator_test.go b/internal/operators/osc/operator_test.go index 881d46412a2f..1aaf89c7a893 100644 --- a/internal/operators/osc/operator_test.go +++ b/internal/operators/osc/operator_test.go @@ -44,10 +44,13 @@ var _ = Describe("OSC Operator", func() { Cluster: models.Cluster{ControlPlaneCount: common.MinMasterHostsNeededForInstallationInHaMode}, } - deps, err := operator.GetDependencies(&cluster) - Expect(err).ToNot(HaveOccurred()) + deps := operator.GetDependencies(&cluster) Expect(deps).To(HaveLen(1)) Expect(deps[0]).To(Equal(nodefeaturediscovery.Operator.Name)) + + depIDs := operator.GetDependenciesFeatureSupportID() + Expect(depIDs).To(HaveLen(1)) + Expect(depIDs[0]).To(Equal(models.FeatureSupportLevelIDNODEFEATUREDISCOVERY)) }) }) diff --git a/internal/operators/pipelines/pipelines_operator.go b/internal/operators/pipelines/pipelines_operator.go index 70ebdfb6d0a8..1ed8f2e54356 100644 --- a/internal/operators/pipelines/pipelines_operator.go +++ b/internal/operators/pipelines/pipelines_operator.go @@ -66,13 +66,12 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(c *common.Cluster) ([]string, error) { - result := []string{} - return result, nil +func (o *operator) GetDependencies(c *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the operator. @@ -117,24 +116,16 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -144,7 +135,6 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } func (o *operator) GetFeatureSupportID() models.FeatureSupportLevelID { diff --git a/internal/operators/selfnoderemediation/self_node_remediation_operator.go b/internal/operators/selfnoderemediation/self_node_remediation_operator.go index 03a42fa35f1b..b00edd284c2f 100644 --- a/internal/operators/selfnoderemediation/self_node_remediation_operator.go +++ b/internal/operators/selfnoderemediation/self_node_remediation_operator.go @@ -48,8 +48,8 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(cluster *common.Cluster) ([]string, error) { - return []string{operatorsCommon.NodeHealthcheckOperatorName}, nil +func (o *operator) GetDependencies(cluster *common.Cluster) []string { + return []string{operatorsCommon.NodeHealthcheckOperatorName} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { diff --git a/internal/operators/selfnoderemediation/self_node_remediation_requirements.go b/internal/operators/selfnoderemediation/self_node_remediation_requirements.go index 27bea325e145..31033816cc7a 100644 --- a/internal/operators/selfnoderemediation/self_node_remediation_requirements.go +++ b/internal/operators/selfnoderemediation/self_node_remediation_requirements.go @@ -11,24 +11,16 @@ import ( // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -38,5 +30,4 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } diff --git a/internal/operators/serverless/serverless_operator.go b/internal/operators/serverless/serverless_operator.go index ee94ac85d016..ce0a92e1d545 100644 --- a/internal/operators/serverless/serverless_operator.go +++ b/internal/operators/serverless/serverless_operator.go @@ -66,13 +66,12 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(c *common.Cluster) ([]string, error) { - result := []string{} - return result, nil +func (o *operator) GetDependencies(c *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the operator. @@ -117,24 +116,16 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -144,7 +135,6 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } func (o *operator) GetFeatureSupportID() models.FeatureSupportLevelID { diff --git a/internal/operators/servicemesh/servicemesh_operator.go b/internal/operators/servicemesh/servicemesh_operator.go index 433516e9af6a..db684e843f13 100644 --- a/internal/operators/servicemesh/servicemesh_operator.go +++ b/internal/operators/servicemesh/servicemesh_operator.go @@ -66,12 +66,12 @@ func (o *operator) GetFullName() string { } // GetDependencies provides a list of dependencies of the Operator -func (o *operator) GetDependencies(c *common.Cluster) ([]string, error) { - return make([]string, 0), nil +func (o *operator) GetDependencies(c *common.Cluster) []string { + return []string{} } func (o *operator) GetDependenciesFeatureSupportID() []models.FeatureSupportLevelID { - return nil + return []models.FeatureSupportLevelID{} } // GetClusterValidationIDs returns cluster validation IDs for the operator. @@ -116,24 +116,16 @@ func (o *operator) GetMonitoredOperator() *models.MonitoredOperator { // operator. func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirementsDetails, error) { - preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster) - if err != nil { - o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID) - return nil, err - } + preflightRequirements := o.GetPreflightRequirements(ctx, cluster) + return preflightRequirements.Requirements.Worker.Quantitative, nil } // GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only. -func (o *operator) GetPreflightRequirements(context context.Context, - cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) { - dependencies, err := o.GetDependencies(cluster) - if err != nil { - return - } - result = &models.OperatorHardwareRequirements{ +func (o *operator) GetPreflightRequirements(context context.Context, cluster *common.Cluster) *models.OperatorHardwareRequirements { + return &models.OperatorHardwareRequirements{ OperatorName: o.GetName(), - Dependencies: dependencies, + Dependencies: o.GetDependencies(cluster), Requirements: &models.HostTypeHardwareRequirementsWrapper{ Master: &models.HostTypeHardwareRequirements{ Quantitative: &models.ClusterHostRequirementsDetails{}, @@ -143,7 +135,6 @@ func (o *operator) GetPreflightRequirements(context context.Context, }, }, } - return } func (o *operator) GetFeatureSupportID() models.FeatureSupportLevelID { diff --git a/skipper.yaml b/skipper.yaml index c836f8ca0653..2d303a989c5f 100644 --- a/skipper.yaml +++ b/skipper.yaml @@ -19,6 +19,7 @@ volumes: # cache - $HOME/.cache/go-build:/go/pkg/mod - $HOME/.cache/golangci-lint:$HOME/.cache/golangci-lint + - $HOME/.cache/goimports:$HOME/.cache/goimports # libvirt - /var/run/libvirt/libvirt-sock:/var/run/libvirt/libvirt-sock diff --git a/subsystem/operators_test.go b/subsystem/operators_test.go index cbd6b9c77d8b..193ffe1207c7 100644 --- a/subsystem/operators_test.go +++ b/subsystem/operators_test.go @@ -399,42 +399,12 @@ var _ = Describe("Operators endpoint tests", func() { Expect(*reason).To(ContainSubstring(fmt.Sprintf("cannot use Local Storage Operator because it's not compatible with the arm64 architecture on version %s", common.TestVersion().ForArch("arm64").Version()))) }) - It("should lvm installed as cnv dependency", func() { - cluster := registerNewCluster( - common.TestVersion().GreaterThanOrEqual("4.12").Version(), - int64(1), - []*models.OperatorCreateParams{{Name: cnv.Operator.Name}}, - nil, - nil, - ) - ops, err := utils_test.TestContext.Agent2BMClient.Operators.V2ListOfClusterOperators(ctx, opclient.NewV2ListOfClusterOperatorsParams().WithClusterID(*cluster.Payload.ID)) - - Expect(err).ToNot(HaveOccurred()) - Expect(len(ops.GetPayload())).To(BeNumerically(">=", 3)) - - var operatorNames []string - for _, op := range ops.GetPayload() { - operatorNames = append(operatorNames, op.Name) - } - - // Builtin - for _, builtinOperator := range operators.NewManager(log, nil, operators.Options{}, nil).GetSupportedOperatorsByType(models.OperatorTypeBuiltin) { - Expect(operatorNames).To(ContainElements(builtinOperator.Name)) - } - - // OLM - Expect(operatorNames).To(ContainElements( - cnv.Operator.Name, - lvm.Operator.Name, - )) - }) - // LVM subscription name changed at 4.12: lvmo (<4.12) -> lvms (>=4.12) It("should lvm have right subscription name on version >= 4.12", func() { cluster := registerNewCluster( common.TestVersion().GreaterThanOrEqual("4.12").Version(), int64(1), - []*models.OperatorCreateParams{{Name: cnv.Operator.Name}}, + []*models.OperatorCreateParams{{Name: lvm.Operator.Name}}, nil, nil, )