Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Mapping component versions to RHOAI releases #1299

Open
wants to merge 14 commits into
base: incubation
Choose a base branch
from
Open
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
8 changes: 1 addition & 7 deletions apis/datasciencecluster/v1/datasciencecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ type Components struct {
TrainingOperator trainingoperator.TrainingOperator `json:"trainingoperator,omitempty"`
}

// ComponentsStatus defines the custom status of DataScienceCluster components.
type ComponentsStatus struct {
// ModelRegistry component status
ModelRegistry *status.ModelRegistryStatus `json:"modelregistry,omitempty"`
}

// DataScienceClusterStatus defines the observed state of DataScienceCluster.
type DataScienceClusterStatus struct {
// Phase describes the Phase of DataScienceCluster reconciliation state
Expand All @@ -114,7 +108,7 @@ type DataScienceClusterStatus struct {

// Expose component's specific status
// +optional
Components ComponentsStatus `json:"components,omitempty"`
Components status.ComponentsStatus `json:"components,omitempty"`

// Version and release type
Release cluster.Release `json:"release,omitempty"`
Expand Down
21 changes: 0 additions & 21 deletions apis/datasciencecluster/v1/zz_generated.deepcopy.go

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

21 changes: 21 additions & 0 deletions components/codeflare/codeflare.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

dsciv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/dscinitialization/v1"
"github.com/opendatahub-io/opendatahub-operator/v2/components"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
)
Expand Down Expand Up @@ -71,6 +72,26 @@ func (c *CodeFlare) GetComponentName() string {
return ComponentName
}

func (c *CodeFlare) UpdateStatus(in *status.ComponentsStatus) error {
if c.GetManagementState() != operatorv1.Managed {
in.CodeFlare = nil
return nil
}

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

if err != nil {
return err
}

in.CodeFlare = &status.CodeFlareStatus{
ComponentStatus: status.ComponentStatus{
Sara4994 marked this conversation as resolved.
Show resolved Hide resolved
Releases: releases,
},
}
return nil
}

func (c *CodeFlare) ReconcileComponent(ctx context.Context,
cli client.Client,
owner metav1.Object,
Expand Down
2 changes: 2 additions & 0 deletions components/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"

dsciv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/dscinitialization/v1"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
)

Expand Down Expand Up @@ -86,6 +87,7 @@ type ComponentInterface interface {
owner metav1.Object, DSCISpec *dsciv1.DSCInitializationSpec, platform cluster.Platform, currentComponentStatus bool) error
Cleanup(ctx context.Context, cli client.Client, owner metav1.Object, DSCISpec *dsciv1.DSCInitializationSpec) error
GetComponentName() string
UpdateStatus(status *status.ComponentsStatus) error
GetManagementState() operatorv1.ManagementState
OverrideManifests(ctx context.Context, platform cluster.Platform) error
UpdatePrometheusConfig(cli client.Client, logger logr.Logger, enable bool, component string) error
Expand Down
12 changes: 12 additions & 0 deletions components/dashboard/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

dsciv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/dscinitialization/v1"
"github.com/opendatahub-io/opendatahub-operator/v2/components"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
)
Expand Down Expand Up @@ -82,6 +83,17 @@ func (d *Dashboard) GetComponentName() string {
return ComponentNameUpstream
}

func (d *Dashboard) UpdateStatus(in *status.ComponentsStatus) error {
if d.GetManagementState() != operatorv1.Managed {
in.Dashboard = nil
return nil
}

in.Dashboard = &status.DashboardStatus{}
Sara4994 marked this conversation as resolved.
Show resolved Hide resolved

return nil
}

func (d *Dashboard) ReconcileComponent(ctx context.Context,
cli client.Client,
owner metav1.Object,
Expand Down
20 changes: 20 additions & 0 deletions components/datasciencepipelines/datasciencepipelines.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,26 @@ func (d *DataSciencePipelines) GetComponentName() string {
return ComponentName
}

func (d *DataSciencePipelines) UpdateStatus(in *status.ComponentsStatus) error {
if d.GetManagementState() != operatorv1.Managed {
in.DataSciencePipelines = nil
return nil
}

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

if err != nil {
return err
}

in.DataSciencePipelines = &status.DataSciencePipelinesStatus{
ComponentStatus: status.ComponentStatus{
Releases: releases,
},
}
return nil
}

func (d *DataSciencePipelines) ReconcileComponent(ctx context.Context,
cli client.Client,
owner metav1.Object,
Expand Down
21 changes: 21 additions & 0 deletions components/kserve/kserve.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
dsciv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/dscinitialization/v1"
infrav1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/infrastructure/v1"
"github.com/opendatahub-io/opendatahub-operator/v2/components"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
)
Expand Down Expand Up @@ -110,6 +111,26 @@ func (k *Kserve) GetComponentName() string {
return ComponentName
}

func (k *Kserve) UpdateStatus(in *status.ComponentsStatus) error {
if k.GetManagementState() != operatorv1.Managed {
in.Kserve = nil
return nil
}

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

if err != nil {
return err
}

in.Kserve = &status.KserveStatus{
ComponentStatus: status.ComponentStatus{
Releases: releases,
},
}
return nil
}

func (k *Kserve) ReconcileComponent(ctx context.Context, cli client.Client,
owner metav1.Object, dscispec *dsciv1.DSCInitializationSpec, platform cluster.Platform, _ bool) error {
l := logf.FromContext(ctx)
Expand Down
21 changes: 21 additions & 0 deletions components/kueue/kueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

dsciv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/dscinitialization/v1"
"github.com/opendatahub-io/opendatahub-operator/v2/components"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
)
Expand Down Expand Up @@ -67,6 +68,26 @@ func (k *Kueue) GetComponentName() string {
return ComponentName
}

func (k *Kueue) UpdateStatus(in *status.ComponentsStatus) error {
if k.GetManagementState() != operatorv1.Managed {
in.Kueue = nil
return nil
}

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

if err != nil {
return err
}

in.Kueue = &status.KueueStatus{
ComponentStatus: status.ComponentStatus{
Releases: releases,
},
}
return nil
}

func (k *Kueue) ReconcileComponent(ctx context.Context, cli client.Client,
owner metav1.Object, dscispec *dsciv1.DSCInitializationSpec, platform cluster.Platform, _ bool) error {
l := logf.FromContext(ctx)
Expand Down
21 changes: 21 additions & 0 deletions components/modelmeshserving/modelmeshserving.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

dsciv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/dscinitialization/v1"
"github.com/opendatahub-io/opendatahub-operator/v2/components"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
)
Expand Down Expand Up @@ -100,6 +101,26 @@ func (m *ModelMeshServing) GetComponentName() string {
return ComponentName
}

func (m *ModelMeshServing) UpdateStatus(in *status.ComponentsStatus) error {
if m.GetManagementState() != operatorv1.Managed {
in.ModelMeshServing = nil
return nil
}

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

if err != nil {
return err
}

in.ModelMeshServing = &status.ModelMeshServingStatus{
ComponentStatus: status.ComponentStatus{
Releases: releases,
},
}
return nil
}

func (m *ModelMeshServing) ReconcileComponent(ctx context.Context,
cli client.Client,
owner metav1.Object,
Expand Down
21 changes: 21 additions & 0 deletions components/modelregistry/modelregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
dsciv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/dscinitialization/v1"
infrav1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/infrastructure/v1"
"github.com/opendatahub-io/opendatahub-operator/v2/components"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/conversion"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
Expand Down Expand Up @@ -96,6 +97,26 @@ func (m *ModelRegistry) GetComponentName() string {
return ComponentName
}

func (m *ModelRegistry) UpdateStatus(in *status.ComponentsStatus) error {
if m.GetManagementState() != operatorv1.Managed {
in.ModelRegistry = nil
return nil
}

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

if err != nil {
return err
}

in.ModelRegistry = &status.ModelRegistryStatus{
ComponentStatus: status.ComponentStatus{
Releases: releases,
},
}
return nil
}

func (m *ModelRegistry) ReconcileComponent(ctx context.Context, cli client.Client,
owner metav1.Object, dscispec *dsciv1.DSCInitializationSpec, platform cluster.Platform, _ bool) error {
l := logf.FromContext(ctx)
Expand Down
21 changes: 21 additions & 0 deletions components/ray/ray.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

dsciv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/dscinitialization/v1"
"github.com/opendatahub-io/opendatahub-operator/v2/components"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
)
Expand Down Expand Up @@ -68,6 +69,26 @@ func (r *Ray) GetComponentName() string {
return ComponentName
}

func (r *Ray) UpdateStatus(in *status.ComponentsStatus) error {
if r.GetManagementState() != operatorv1.Managed {
in.Ray = nil
return nil
}

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

if err != nil {
return err
}

in.Ray = &status.RayStatus{
ComponentStatus: status.ComponentStatus{
Releases: releases,
},
}
return nil
}

func (r *Ray) ReconcileComponent(ctx context.Context, cli client.Client,
owner metav1.Object, dscispec *dsciv1.DSCInitializationSpec, platform cluster.Platform, _ bool) error {
l := logf.FromContext(ctx)
Expand Down
21 changes: 21 additions & 0 deletions components/trainingoperator/trainingoperator.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

dsciv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/dscinitialization/v1"
"github.com/opendatahub-io/opendatahub-operator/v2/components"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
)
Expand Down Expand Up @@ -69,6 +70,26 @@ func (r *TrainingOperator) GetComponentName() string {
return ComponentName
}

func (r *TrainingOperator) UpdateStatus(in *status.ComponentsStatus) error {
if r.GetManagementState() != operatorv1.Managed {
in.TrainingOperator = nil
return nil
}

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

if err != nil {
return err
}

in.TrainingOperator = &status.TrainingOperatorStatus{
ComponentStatus: status.ComponentStatus{
Releases: releases,
},
}
return nil
}

func (r *TrainingOperator) ReconcileComponent(ctx context.Context, cli client.Client,
owner metav1.Object, dscispec *dsciv1.DSCInitializationSpec, platform cluster.Platform, _ bool) error {
l := logf.FromContext(ctx)
Expand Down
Loading