Skip to content

Commit

Permalink
MGMT-19860: Add OpenShift AI dependencies for UI 2.37
Browse files Browse the repository at this point in the history
Version 2.37 of the UI doesn't support the concept of operator bundles
yet, and we need to coexist with it for a while, as it may take up to
one week till it is deployed to production. During that time the
OpenShift AI operator won't work correctly because it won't
automatically add the dependencies that it needs. On the other hand
wwhen the new UI is deployed we will need to disable that. To make that
possible this patch adds a new `OPENSHIFT_AI_SUPPORT_UI_2_37`
environment variable that will be set to `true` go support the old
version of the UI, or to `false` to support the new version. By defalt
it is set to `true`, so initially nothing needs to be changed. But when
the new version of the UI is deployed the configuration will need to be
changed.

Related: https://issues.redhat.com/browse/MGMT-19860
Signed-off-by: Juan Hernandez <juan.hernandez@redhat.com>
  • Loading branch information
jhernand committed Feb 24, 2025
1 parent 8d63fbb commit f8e5de6
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 8 deletions.
5 changes: 5 additions & 0 deletions internal/operators/openshiftai/openshift_ai_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ type Config struct {
// support for NVIDIA and Virtio GPUS the value should be `10de,1af4`. By default only NVIDIA GPUs are
// supported.
SupportedGPUs []string `envconfig:"OPENSHIFT_AI_SUPPORTED_GPUS" default:"10de"`

// SupportUI_2_37 indicates if the operator will work in a way that supports the old 2.37 version of the UI
// whilch doesn't understand operator bundles yet. When this is set to true the dependencies of the operator
// will be installed automatically.
SupportUI_2_37 bool `envconfig:"OPENSHIFT_AI_SUPPORT_UI_2_37" default:"true"`
}
18 changes: 10 additions & 8 deletions internal/operators/openshiftai/openshift_ai_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ func (o *operator) GetDependencies(c *common.Cluster) (result []string, err erro
// NVIDIA GPU in the cluster, but unfortunatelly this is calculated and saved to the database only when the
// cluster is created or updated via the API, and at that point we don't have the host inventory yet to
// determine if there are NVIDIA GPU.
result = []string{
authorino.Operator.Name,
nvidiagpu.Operator.Name,
odf.Operator.Name,
pipelines.Operator.Name,
serverless.Operator.Name,
servicemesh.Operator.Name,
if o.config.SupportUI_2_37 {
result = []string{
authorino.Operator.Name,
nvidiagpu.Operator.Name,
odf.Operator.Name,
pipelines.Operator.Name,
serverless.Operator.Name,
servicemesh.Operator.Name,
}
}
return result, nil
}
Expand Down Expand Up @@ -113,7 +115,7 @@ func (o *operator) ValidateCluster(ctx context.Context, cluster *common.Cluster)
}

// Check that there is at least one supported GPU:
if o.config.RequireGPU {
if o.config.SupportUI_2_37 && o.config.RequireGPU {
var gpuList []*models.Gpu
gpuList, err = o.gpusInCluster(cluster)
if err != nil {
Expand Down
50 changes: 50 additions & 0 deletions internal/operators/openshiftai/openshift_ai_operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import (
. "github.com/onsi/gomega"
"github.com/openshift/assisted-service/internal/common"
"github.com/openshift/assisted-service/internal/operators/api"
"github.com/openshift/assisted-service/internal/operators/authorino"
"github.com/openshift/assisted-service/internal/operators/nvidiagpu"
"github.com/openshift/assisted-service/internal/operators/odf"
"github.com/openshift/assisted-service/internal/operators/pipelines"
"github.com/openshift/assisted-service/internal/operators/serverless"
"github.com/openshift/assisted-service/internal/operators/servicemesh"
"github.com/openshift/assisted-service/models"
"github.com/openshift/assisted-service/pkg/conversions"
)
Expand Down Expand Up @@ -172,4 +178,48 @@ var _ = Describe("Operator", func() {
true,
),
)

Describe("Get dependencies", func() {
const flagEnvVar = "OPENSHIFT_AI_SUPPORT_UI_2_37"

It("Returns the dependencies when compatibility with old UI is explicitly enabled", func() {
os.Setenv(flagEnvVar, "true")
defer os.Unsetenv(flagEnvVar)
operator := NewOpenShiftAIOperator(common.GetTestLog())
dependencies, err := operator.GetDependencies(nil)
Expect(err).ToNot(HaveOccurred())
Expect(dependencies).To(ConsistOf(
authorino.Operator.Name,
nvidiagpu.Operator.Name,
odf.Operator.Name,
pipelines.Operator.Name,
serverless.Operator.Name,
servicemesh.Operator.Name,
))
})

It("Returns the dependencies when compatibility with the old UI isn't explicitly enabled or disabled", func() {
operator := NewOpenShiftAIOperator(common.GetTestLog())
dependencies, err := operator.GetDependencies(nil)
Expect(err).ToNot(HaveOccurred())
Expect(dependencies).To(ConsistOf(
authorino.Operator.Name,
nvidiagpu.Operator.Name,
odf.Operator.Name,
pipelines.Operator.Name,
serverless.Operator.Name,
servicemesh.Operator.Name,
))
})

It("Doesn't return the dependencies when compatibility with the old UI is explicitly disabled", func() {
os.Setenv(flagEnvVar, "false")
defer os.Unsetenv(flagEnvVar)
operator := NewOpenShiftAIOperator(common.GetTestLog())
dependencies, err := operator.GetDependencies(nil)
Expect(err).ToNot(HaveOccurred())
Expect(dependencies).To(BeEmpty())
})

})
})
4 changes: 4 additions & 0 deletions openshift/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ parameters:
value: assisted-service-envoy-config
- name: OPENSHIFT_AI_SUPPORTED_GPUS
value: "10de"
- name: OPENSHIFT_AI_SUPPORT_UI_2_37
value: "true"
apiVersion: v1
kind: Template
metadata:
Expand Down Expand Up @@ -504,6 +506,8 @@ objects:
value: ${IGNORED_OPENSHIFT_VERSIONS}
- name: OPENSHIFT_AI_SUPPORTED_GPUS
value: ${OPENSHIFT_AI_SUPPORTED_GPUS}
- name: OPENSHIFT_AI_SUPPORT_UI_2_37
value: ${OPENSHIFT_AI_SUPPORT_UI_2_37}
volumeMounts:
- name: route53-creds
mountPath: "/etc/.aws"
Expand Down

0 comments on commit f8e5de6

Please sign in to comment.