Skip to content

Commit

Permalink
change error
Browse files Browse the repository at this point in the history
Signed-off-by: xiangchun Fu <xfu@redhat.com>
  • Loading branch information
xiangchunfu committed Nov 24, 2024
1 parent 9081769 commit ffa89b9
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 121 deletions.

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

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

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

2 changes: 1 addition & 1 deletion internal/featuresupport/feature_support_level.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var featuresList = map[models.FeatureSupportLevelID]SupportLevelFeature{
models.FeatureSupportLevelIDMCE: (&MceFeature{}).New(),
models.FeatureSupportLevelIDODF: (&OdfFeature{}).New(),
models.FeatureSupportLevelIDMTV: (&MtvFeature{}).New(),
models.FeatureSupportLevelIDOSC: (&OSCFeature{}).New(),
models.FeatureSupportLevelIDOSC: (&OscFeature{}).New(),
models.FeatureSupportLevelIDNODEFEATUREDISCOVERY: (&NodeFeatureDiscoveryFeature{}).New(),
models.FeatureSupportLevelIDNVIDIAGPU: (&NvidiaGPUFeature{}).New(),
models.FeatureSupportLevelIDPIPELINES: (&PipelinesFeature{}).New(),
Expand Down
6 changes: 3 additions & 3 deletions internal/featuresupport/feature_support_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,19 +269,19 @@ var _ = Describe("V2ListFeatureSupportLevels API", func() {
When("GetFeatureSupportList 4.12 with Platform", func() {
It(string(*filters.PlatformType)+" "+swag.StringValue(filters.ExternalPlatformName), func() {
list := GetFeatureSupportList("dummy", nil, filters.PlatformType, filters.ExternalPlatformName)
Expect(len(list)).To(Equal(26))
Expect(len(list)).To(Equal(27))
})
})
}

It("GetFeatureSupportList 4.12", func() {
list := GetFeatureSupportList("4.12", nil, nil, nil)
Expect(len(list)).To(Equal(31))
Expect(len(list)).To(Equal(32))
})

It("GetFeatureSupportList 4.13", func() {
list := GetFeatureSupportList("4.13", nil, nil, nil)
Expect(len(list)).To(Equal(31))
Expect(len(list)).To(Equal(32))
})

It("GetCpuArchitectureSupportList 4.12", func() {
Expand Down
28 changes: 14 additions & 14 deletions internal/featuresupport/features_olm_operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,38 +591,38 @@ func (f *OpenShiftAIFeature) getFeatureActiveLevel(cluster *common.Cluster, _ *m
return activeLevelNotActive
}

// OSCFeature
type OSCFeature struct{}
// OscFeature
type OscFeature struct{}

func (feature *OSCFeature) New() SupportLevelFeature {
return &OSCFeature{}
func (feature *OscFeature) New() SupportLevelFeature {
return &OscFeature{}
}

func (feature *OSCFeature) getId() models.FeatureSupportLevelID {
func (feature *OscFeature) getId() models.FeatureSupportLevelID {
return models.FeatureSupportLevelIDOSC
}

func (feature *OSCFeature) GetName() string {
return "OpenShift Sandboxed Containers"
func (feature *OscFeature) GetName() string {
return "OpenShift sandboxed containers"
}

func (feature *OSCFeature) getSupportLevel(filters SupportLevelFilters) models.SupportLevel {
func (feature *OscFeature) getSupportLevel(filters SupportLevelFilters) models.SupportLevel {
if !isFeatureCompatibleWithArchitecture(feature, filters.OpenshiftVersion, swag.StringValue(filters.CPUArchitecture)) {
return models.SupportLevelUnavailable
}

if filters.PlatformType != nil && (*filters.PlatformType == models.PlatformTypeVsphere || *filters.PlatformType == models.PlatformTypeNutanix || *filters.PlatformType == models.PlatformTypeNone) {
if filters.PlatformType != nil && (*filters.PlatformType == models.PlatformTypeVsphere || *filters.PlatformType == models.PlatformTypeNutanix) {
return models.SupportLevelUnavailable
}

if isNotSupported, err := common.BaseVersionLessThan("4.17", filters.OpenshiftVersion); isNotSupported || err != nil {
if isNotSupported, err := common.BaseVersionLessThan("4.10", filters.OpenshiftVersion); isNotSupported || err != nil {
return models.SupportLevelUnavailable
}

return models.SupportLevelSupported
}

func (feature *OSCFeature) getIncompatibleArchitectures(_ *string) *[]models.ArchitectureSupportLevelID {
func (feature *OscFeature) getIncompatibleArchitectures(_ *string) *[]models.ArchitectureSupportLevelID {
incompatibleArchitecture := []models.ArchitectureSupportLevelID{
models.ArchitectureSupportLevelIDARM64ARCHITECTURE,
models.ArchitectureSupportLevelIDS390XARCHITECTURE,
Expand All @@ -631,15 +631,15 @@ func (feature *OSCFeature) getIncompatibleArchitectures(_ *string) *[]models.Arc
return &incompatibleArchitecture
}

func (feature *OSCFeature) getIncompatibleFeatures(string) *[]models.FeatureSupportLevelID {
func (feature *OscFeature) getIncompatibleFeatures(string) *[]models.FeatureSupportLevelID {
return &[]models.FeatureSupportLevelID{
models.FeatureSupportLevelIDNUTANIXINTEGRATION,
models.FeatureSupportLevelIDVSPHEREINTEGRATION,
}
}

func (feature *OSCFeature) getFeatureActiveLevel(cluster *common.Cluster, _ *models.InfraEnv, clusterUpdateParams *models.V2ClusterUpdateParams, _ *models.InfraEnvUpdateParams) featureActiveLevel {
if isOperatorActivated("OSC", cluster, clusterUpdateParams) && isOperatorActivated("cnv", cluster, clusterUpdateParams) {
func (feature *OscFeature) getFeatureActiveLevel(cluster *common.Cluster, _ *models.InfraEnv, clusterUpdateParams *models.V2ClusterUpdateParams, _ *models.InfraEnvUpdateParams) featureActiveLevel {
if isOperatorActivated("osc", cluster, clusterUpdateParams) {
return activeLevelActive
}
return activeLevelNotActive
Expand Down
31 changes: 31 additions & 0 deletions internal/featuresupport/features_olm_operators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,35 @@ var _ = Describe("V2ListFeatureSupportLevels API", func() {
Entry("on baremetal", "4.13", common.X86CPUArchitecture, models.PlatformTypeBaremetal, models.SupportLevelUnavailable),
)
})

Context("Test OSC feature", func() {
DescribeTable("Validate OSC on Architecture", func(ocpVersion []string, cpuArch string, expectedResult bool) {
for _, v := range ocpVersion {
version := v
result := IsFeatureAvailable(models.FeatureSupportLevelIDOSC, version, swag.String(cpuArch))
Expect(result).Should(Equal(expectedResult),
fmt.Sprintf("Feature: %s, OCP version: %s, CpuArch: %s, should be %v", models.FeatureSupportLevelIDOSC, v, cpuArch, expectedResult))
}
},
Entry("on X86 is supported above 4.10", []string{"4.15", "4.16", "4.17", "4.21"}, models.ClusterCPUArchitectureX8664, true),
Entry("on arm64 is NOT supported", []string{"4.8", "4.11", "4.14", "4.21"}, models.ClusterCPUArchitectureArm64, false),
Entry("on S390x is NOT supported", []string{"4.11", "4.13", "4.14", "4.21"}, models.ClusterCPUArchitectureS390x, false),
Entry("on ppc64le is NOT supported", []string{"4.11", "4.13", "4.14", "4.21"}, models.ClusterCPUArchitecturePpc64le, false),
)

DescribeTable("Validate OSC on platform", func(ocpVersion string, cpuArch string, platformType models.PlatformType, expectedResult models.SupportLevel) {
featureSupportLevels := GetFeatureSupportList(
ocpVersion,
swag.String(cpuArch),
common.PlatformTypePtr(platformType),
nil,
)
Expect(featureSupportLevels[string(models.FeatureSupportLevelIDOSC)]).To(Equal(expectedResult))
},
Entry("on Vsphere", "4.10", common.X86CPUArchitecture, models.PlatformTypeVsphere, models.SupportLevelUnavailable),
Entry("on Nutanix", "4.10", common.X86CPUArchitecture, models.PlatformTypeNutanix, models.SupportLevelUnavailable),
Entry("on none", "4.10", common.X86CPUArchitecture, models.PlatformTypeNone, models.SupportLevelSupported),
Entry("on baremetal", "4.10", common.X86CPUArchitecture, models.PlatformTypeBaremetal, models.SupportLevelSupported),
)
})
})
13 changes: 4 additions & 9 deletions internal/operators/osc/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@ package osc

const (
Name = "osc"
FullName = "OpenShift Sandboxed Containers"
FullName = "OpenShift sandboxed containers"
Namespace = "openshift-sandboxed-containers-operator"
Subscription = "osc-operator"
SubscriptionName = "osc-operator"
Source = "redhat-operators"
SourceName = "osc-operator"
OscMinOpenshiftVersion = "4.17.0"
LayeredImageDeployment = "true"
LayeredImageUrl = "quay.io/fidencio/rhcos-layer/ocp-4.16:tdx-20241003-1327"
KernelArgs = "kvm_intel.tdx=1"
OscMinOpenshiftVersion = "4.10.0"

// Memory value provided in GiB
MasterMemory int64 = 1
MasterCPU int64 = 1
// Memory value provided in GIB
WorkerMemory int64 = 1
WorkerCPU int64 = 1
)

type Config struct {
Expand Down
Loading

0 comments on commit ffa89b9

Please sign in to comment.