Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/bminventory/detailed_supported_features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var _ = Describe("GetDetailedSupportedFeatures", func() {
{
OperatorName: "cnv",
FeatureSupportID: models.FeatureSupportLevelIDCNV,
Dependencies: []models.FeatureSupportLevelID{models.FeatureSupportLevelIDLSO, models.FeatureSupportLevelIDLVM},
Dependencies: []models.FeatureSupportLevelID{},
},
}).AnyTimes()
}
Expand Down
23 changes: 7 additions & 16 deletions internal/operators/amdgpu/amd_gpu_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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{},
Expand All @@ -273,7 +265,6 @@ func (o *operator) GetPreflightRequirements(context context.Context,
},
},
}
return
}

func (o *operator) GetFeatureSupportID() models.FeatureSupportLevelID {
Expand Down
7 changes: 3 additions & 4 deletions internal/operators/amdgpu/amd_gpu_operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})
})
Expand Down
4 changes: 2 additions & 2 deletions internal/operators/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 4 additions & 6 deletions internal/operators/api/mock_operator_api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 8 additions & 16 deletions internal/operators/authorino/authorino_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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{},
Expand All @@ -133,7 +126,6 @@ func (o *operator) GetPreflightRequirements(context context.Context,
},
},
}
return
}

func (o *operator) GetFeatureSupportID() models.FeatureSupportLevelID {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
Expand All @@ -38,5 +30,4 @@ func (o *operator) GetPreflightRequirements(context context.Context,
},
},
}
return
}
43 changes: 7 additions & 36 deletions internal/operators/cnv/cnv_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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",
Expand All @@ -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,
Expand All @@ -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) {
Expand Down
Loading