Skip to content

Commit

Permalink
feat:Mapping component versions to RHOAI releases
Browse files Browse the repository at this point in the history
  • Loading branch information
Sara4994 committed Jan 9, 2025
1 parent 817b465 commit cdf6137
Show file tree
Hide file tree
Showing 25 changed files with 193 additions and 2 deletions.
3 changes: 3 additions & 0 deletions apis/components/v1alpha1/codeflare_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/common"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -36,6 +37,7 @@ type CodeFlareCommonStatus struct {
type CodeFlareStatus struct {
common.Status `json:",inline"`
CodeFlareCommonStatus `json:",inline"`
Releases []status.ComponentReleaseStatus `json:"releases,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -96,4 +98,5 @@ type DSCCodeFlare struct {
type DSCCodeFlareStatus struct {
common.ManagementSpec `json:",inline"`
*CodeFlareCommonStatus `json:",inline"`
Releases []status.ComponentReleaseStatus `json:"releases,omitempty"`
}
2 changes: 2 additions & 0 deletions apis/components/v1alpha1/dashboard_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/common"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -104,4 +105,5 @@ type DSCDashboard struct {
type DSCDashboardStatus struct {
common.ManagementSpec `json:",inline"`
*DashboardCommonStatus `json:",inline"`
Releases []status.ComponentReleaseStatus `json:"releases,omitempty"`
}
2 changes: 2 additions & 0 deletions apis/components/v1alpha1/datasciencepipelines_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/common"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -94,4 +95,5 @@ type DSCDataSciencePipelines struct {
type DSCDataSciencePipelinesStatus struct {
common.ManagementSpec `json:",inline"`
*DataSciencePipelinesCommonStatus `json:",inline"`
Releases []status.ComponentReleaseStatus `json:"releases,omitempty"`
}
2 changes: 2 additions & 0 deletions apis/components/v1alpha1/kserve_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/opendatahub-io/opendatahub-operator/v2/apis/common"
infrav1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/infrastructure/v1"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
)

const (
Expand Down Expand Up @@ -132,4 +133,5 @@ type DSCKserve struct {
type DSCKserveStatus struct {
common.ManagementSpec `json:",inline"`
*KserveCommonStatus `json:",inline"`
Releases []status.ComponentReleaseStatus `json:"releases,omitempty"`
}
2 changes: 2 additions & 0 deletions apis/components/v1alpha1/kueue_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/common"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -95,4 +96,5 @@ type DSCKueue struct {
type DSCKueueStatus struct {
common.ManagementSpec `json:",inline"`
*KueueCommonStatus `json:",inline"`
Releases []status.ComponentReleaseStatus `json:"releases,omitempty"`
}
2 changes: 2 additions & 0 deletions apis/components/v1alpha1/modelcontroller_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/common"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
operatorv1 "github.com/openshift/api/operator/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -79,6 +80,7 @@ func (s *ModelControllerMMSpec) GetDevFlags() *common.DevFlags {
// ModelControllerStatus defines the observed state of ModelController
type ModelControllerStatus struct {
common.Status `json:",inline"`
Releases []status.ComponentReleaseStatus `json:"releases,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
2 changes: 2 additions & 0 deletions apis/components/v1alpha1/modelmeshserving_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/common"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -95,4 +96,5 @@ type DSCModelMeshServing struct {
type DSCModelMeshServingStatus struct {
common.ManagementSpec `json:",inline"`
*ModelMeshServingCommonStatus `json:",inline"`
Releases []status.ComponentReleaseStatus `json:"releases,omitempty"`
}
2 changes: 2 additions & 0 deletions apis/components/v1alpha1/modelregistry_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/common"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -112,4 +113,5 @@ type DSCModelRegistry struct {
type DSCModelRegistryStatus struct {
common.ManagementSpec `json:",inline"`
*ModelRegistryCommonStatus `json:",inline"`
Releases []status.ComponentReleaseStatus `json:"releases,omitempty"`
}
2 changes: 2 additions & 0 deletions apis/components/v1alpha1/ray_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/common"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -95,4 +96,5 @@ type DSCRay struct {
type DSCRayStatus struct {
common.ManagementSpec `json:",inline"`
*RayCommonStatus `json:",inline"`
Releases []status.ComponentReleaseStatus `json:"releases,omitempty"`
}
2 changes: 2 additions & 0 deletions apis/components/v1alpha1/trainingoperator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/common"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -95,4 +96,5 @@ type DSCTrainingOperator struct {
type DSCTrainingOperatorStatus struct {
common.ManagementSpec `json:",inline"`
*TrainingOperatorCommonStatus `json:",inline"`
Releases []status.ComponentReleaseStatus `json:"releases,omitempty"`
}
2 changes: 2 additions & 0 deletions apis/components/v1alpha1/trustyai_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/common"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -95,4 +96,5 @@ type DSCTrustyAI struct {
type DSCTrustyAIStatus struct {
common.ManagementSpec `json:",inline"`
*TrustyAICommonStatus `json:",inline"`
Releases []status.ComponentReleaseStatus `json:"releases,omitempty"`
}
2 changes: 2 additions & 0 deletions apis/components/v1alpha1/workbenches_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/common"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -101,4 +102,5 @@ type DSCWorkbenches struct {
type DSCWorkbenchesStatus struct {
common.ManagementSpec `json:",inline"`
*WorkbenchesCommonStatus `json:",inline"`
Releases []status.ComponentReleaseStatus `json:"releases,omitempty"`
}
8 changes: 8 additions & 0 deletions controllers/components/codeflare/codeflare.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.InstalledComponents[s.GetName()] = false
dsc.Status.Components.CodeFlare.ManagementSpec.ManagementState = s.GetManagementState(dsc)
dsc.Status.Components.CodeFlare.CodeFlareCommonStatus = nil
dsc.Status.Components.CodeFlare.Releases = nil

releases, err := status.GetReleaseStatus(odhdeploy.DefaultManifestPath, ComponentName)

if err != nil {
return err
}

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Expand All @@ -97,6 +104,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
case operatorv1.Managed:
dsc.Status.InstalledComponents[s.GetName()] = true
dsc.Status.Components.CodeFlare.CodeFlareCommonStatus = c.Status.CodeFlareCommonStatus.DeepCopy()
dsc.Status.Components.CodeFlare.Releases = releases

if rc := meta.FindStatusCondition(c.Status.Conditions, status.ConditionTypeReady); rc != nil {
nc.Status = corev1.ConditionStatus(rc.Status)
Expand Down
8 changes: 8 additions & 0 deletions controllers/components/dashboard/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.InstalledComponents[s.GetName()] = false
dsc.Status.Components.Dashboard.ManagementSpec.ManagementState = s.GetManagementState(dsc)
dsc.Status.Components.Dashboard.DashboardCommonStatus = nil
dsc.Status.Components.Dashboard.Releases = nil

releases, err := status.GetReleaseStatus(odhdeploy.DefaultManifestPath, ComponentName)

if err != nil {
return err
}

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Expand All @@ -87,6 +94,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
case operatorv1.Managed:
dsc.Status.InstalledComponents[s.GetName()] = true
dsc.Status.Components.Dashboard.DashboardCommonStatus = c.Status.DashboardCommonStatus.DeepCopy()
dsc.Status.Components.Dashboard.Releases = releases

if rc := meta.FindStatusCondition(c.Status.Conditions, status.ConditionTypeReady); rc != nil {
nc.Status = corev1.ConditionStatus(rc.Status)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
cr "github.com/opendatahub-io/opendatahub-operator/v2/pkg/componentsregistry"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/annotations"
)

Expand Down Expand Up @@ -63,7 +63,7 @@ func (s *componentHandler) Init(platform cluster.Platform) error {
"IMAGESV2_ARGO_MLMDGRPC": "RELATED_IMAGE_ODH_MLMD_GRPC_SERVER_IMAGE",
}

if err := deploy.ApplyParams(defaultPath.String(), imageParamMap); err != nil {
if err := odhdeploy.ApplyParams(defaultPath.String(), imageParamMap); err != nil {
return fmt.Errorf("failed to update images on path %s: %w", defaultPath.String(), err)
}

Expand Down Expand Up @@ -97,6 +97,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.InstalledComponents[s.GetName()] = false
dsc.Status.Components.DataSciencePipelines.ManagementSpec.ManagementState = s.GetManagementState(dsc)
dsc.Status.Components.DataSciencePipelines.DataSciencePipelinesCommonStatus = nil
dsc.Status.Components.DataSciencePipelines.Releases = nil

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Expand All @@ -105,10 +106,17 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
Message: "Not Available",
}

releases, err := status.GetReleaseStatus(odhdeploy.DefaultManifestPath, ComponentName)

if err != nil {
return err
}

switch s.GetManagementState(dsc) {
case operatorv1.Managed:
dsc.Status.InstalledComponents[s.GetName()] = true
dsc.Status.Components.DataSciencePipelines.DataSciencePipelinesCommonStatus = c.Status.DataSciencePipelinesCommonStatus.DeepCopy()
dsc.Status.Components.DataSciencePipelines.Releases = releases

if rc := meta.FindStatusCondition(c.Status.Conditions, status.ConditionTypeReady); rc != nil {
nc.Status = corev1.ConditionStatus(rc.Status)
Expand Down
9 changes: 9 additions & 0 deletions controllers/components/kserve/kserve.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
cr "github.com/opendatahub-io/opendatahub-operator/v2/pkg/componentsregistry"
odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/annotations"
)

Expand Down Expand Up @@ -83,6 +84,13 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.InstalledComponents[s.GetName()] = false
dsc.Status.Components.Kserve.ManagementSpec.ManagementState = s.GetManagementState(dsc)
dsc.Status.Components.Kserve.KserveCommonStatus = nil
dsc.Status.Components.Kserve.Releases = nil

releases, err := status.GetReleaseStatus(odhdeploy.DefaultManifestPath, componentName)

if err != nil {
return err
}

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Expand All @@ -95,6 +103,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
case operatorv1.Managed:
dsc.Status.InstalledComponents[s.GetName()] = true
dsc.Status.Components.Kserve.KserveCommonStatus = c.Status.KserveCommonStatus.DeepCopy()
dsc.Status.Components.Kserve.Releases = releases

if rc := meta.FindStatusCondition(c.Status.Conditions, status.ConditionTypeReady); rc != nil {
nc.Status = corev1.ConditionStatus(rc.Status)
Expand Down
8 changes: 8 additions & 0 deletions controllers/components/kueue/kueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.InstalledComponents[s.GetName()] = false
dsc.Status.Components.Kueue.ManagementSpec.ManagementState = s.GetManagementState(dsc)
dsc.Status.Components.Kueue.KueueCommonStatus = nil
dsc.Status.Components.Kueue.Releases = nil

releases, err := status.GetReleaseStatus(odhdeploy.DefaultManifestPath, ComponentName)

if err != nil {
return err
}

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Expand All @@ -97,6 +104,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
case operatorv1.Managed:
dsc.Status.InstalledComponents[s.GetName()] = true
dsc.Status.Components.Kueue.KueueCommonStatus = c.Status.KueueCommonStatus.DeepCopy()
dsc.Status.Components.Kueue.Releases = releases

if rc := meta.FindStatusCondition(c.Status.Conditions, status.ConditionTypeReady); rc != nil {
nc.Status = corev1.ConditionStatus(rc.Status)
Expand Down
8 changes: 8 additions & 0 deletions controllers/components/modelmeshserving/modelmeshserving.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.InstalledComponents[s.GetName()] = false
dsc.Status.Components.ModelMeshServing.ManagementSpec.ManagementState = s.GetManagementState(dsc)
dsc.Status.Components.ModelMeshServing.ModelMeshServingCommonStatus = nil
dsc.Status.Components.ModelMeshServing.Releases = nil

releases, err := status.GetReleaseStatus(odhdeploy.DefaultManifestPath, ComponentName)

if err != nil {
return err
}

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Expand All @@ -98,6 +105,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
case operatorv1.Managed:
dsc.Status.InstalledComponents[s.GetName()] = true
dsc.Status.Components.ModelMeshServing.ModelMeshServingCommonStatus = c.Status.ModelMeshServingCommonStatus.DeepCopy()
dsc.Status.Components.ModelMeshServing.Releases = releases

if rc := meta.FindStatusCondition(c.Status.Conditions, status.ConditionTypeReady); rc != nil {
nc.Status = corev1.ConditionStatus(rc.Status)
Expand Down
8 changes: 8 additions & 0 deletions controllers/components/modelregistry/modelregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.InstalledComponents[s.GetName()] = false
dsc.Status.Components.ModelRegistry.ManagementSpec.ManagementState = s.GetManagementState(dsc)
dsc.Status.Components.ModelRegistry.ModelRegistryCommonStatus = nil
dsc.Status.Components.ModelRegistry.Releases = nil

releases, err := status.GetReleaseStatus(odhdeploy.DefaultManifestPath, ComponentName)

if err != nil {
return err
}

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Expand All @@ -95,6 +102,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
case operatorv1.Managed:
dsc.Status.InstalledComponents[s.GetName()] = true
dsc.Status.Components.ModelRegistry.ModelRegistryCommonStatus = c.Status.ModelRegistryCommonStatus.DeepCopy()
dsc.Status.Components.ModelRegistry.Releases = releases

if rc := meta.FindStatusCondition(c.Status.Conditions, status.ConditionTypeReady); rc != nil {
nc.Status = corev1.ConditionStatus(rc.Status)
Expand Down
8 changes: 8 additions & 0 deletions controllers/components/ray/ray.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.InstalledComponents[s.GetName()] = false
dsc.Status.Components.Ray.ManagementSpec.ManagementState = s.GetManagementState(dsc)
dsc.Status.Components.Ray.RayCommonStatus = nil
dsc.Status.Components.Ray.Releases = nil

releases, err := status.GetReleaseStatus(odhdeploy.DefaultManifestPath, ComponentName)

if err != nil {
return err
}

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Expand All @@ -96,6 +103,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
case operatorv1.Managed:
dsc.Status.InstalledComponents[s.GetName()] = true
dsc.Status.Components.Ray.RayCommonStatus = c.Status.RayCommonStatus.DeepCopy()
dsc.Status.Components.Ray.Releases = releases

if rc := meta.FindStatusCondition(c.Status.Conditions, status.ConditionTypeReady); rc != nil {
nc.Status = corev1.ConditionStatus(rc.Status)
Expand Down
Loading

0 comments on commit cdf6137

Please sign in to comment.