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 10 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.

14 changes: 14 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,19 @@ func (c *CodeFlare) GetComponentName() string {
return ComponentName
}

func (c *CodeFlare) UpdateStatus(in *status.ComponentsStatus) {
enabled := c.GetManagementState() == operatorv1.Managed
if enabled {
codeFlareStatus := status.GetReleaseVersion(deploy.DefaultManifestPath, ComponentName)

in.CodeFlare = &status.CodeFlareStatus{
ComponentStatus: codeFlareStatus,
}
} else {
in.CodeFlare = nil
}
grdryn marked this conversation as resolved.
Show resolved Hide resolved
}

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)
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
11 changes: 11 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,16 @@ func (d *Dashboard) GetComponentName() string {
return ComponentNameUpstream
}

func (d *Dashboard) UpdateStatus(in *status.ComponentsStatus) {
enabled := d.GetManagementState() == operatorv1.Managed

if enabled {
in.Dashboard = &status.DashboardStatus{}
} else {
in.Dashboard = nil
}
}

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

func (d *DataSciencePipelines) UpdateStatus(in *status.ComponentsStatus) {
enabled := d.GetManagementState() == operatorv1.Managed
if enabled {
dataSciencePipelinesStatus := status.GetReleaseVersion(deploy.DefaultManifestPath, ComponentName)

in.DataSciencePipelines = &status.DataSciencePipelinesStatus{
ComponentStatus: dataSciencePipelinesStatus,
}
} else {
in.DataSciencePipelines = nil
}
}

func (d *DataSciencePipelines) ReconcileComponent(ctx context.Context,
cli client.Client,
owner metav1.Object,
Expand Down
14 changes: 14 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,19 @@ func (k *Kserve) GetComponentName() string {
return ComponentName
}

func (k *Kserve) UpdateStatus(in *status.ComponentsStatus) {
enabled := k.GetManagementState() == operatorv1.Managed
if enabled {
kserveStatus := status.GetReleaseVersion(deploy.DefaultManifestPath, ComponentName)

in.Kserve = &status.KserveStatus{
ComponentStatus: kserveStatus,
}
} else {
in.Kserve = 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
14 changes: 14 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,19 @@ func (k *Kueue) GetComponentName() string {
return ComponentName
}

func (k *Kueue) UpdateStatus(in *status.ComponentsStatus) {
enabled := k.GetManagementState() == operatorv1.Managed
if enabled {
kueueStatus := status.GetReleaseVersion(deploy.DefaultManifestPath, ComponentName)

in.Kueue = &status.KueueStatus{
ComponentStatus: kueueStatus,
}
} else {
in.Kueue = 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
14 changes: 14 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,19 @@ func (m *ModelMeshServing) GetComponentName() string {
return ComponentName
}

func (m *ModelMeshServing) UpdateStatus(in *status.ComponentsStatus) {
enabled := m.GetManagementState() == operatorv1.Managed
if enabled {
modelMeshServingStatus := status.GetReleaseVersion(deploy.DefaultManifestPath, ComponentName)

in.ModelMeshServing = &status.ModelMeshServingStatus{
ComponentStatus: modelMeshServingStatus,
}
} else {
in.ModelMeshServing = nil
}
}

func (m *ModelMeshServing) ReconcileComponent(ctx context.Context,
cli client.Client,
owner metav1.Object,
Expand Down
14 changes: 14 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,19 @@ func (m *ModelRegistry) GetComponentName() string {
return ComponentName
}

func (m *ModelRegistry) UpdateStatus(in *status.ComponentsStatus) {
enabled := m.GetManagementState() == operatorv1.Managed
if enabled {
modelRegistryStatus := status.GetReleaseVersion(deploy.DefaultManifestPath, ComponentName)

in.ModelRegistry = &status.ModelRegistryStatus{
ComponentStatus: modelRegistryStatus,
}
} else {
in.ModelRegistry = &status.ModelRegistryStatus{}
}
}

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
14 changes: 14 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,19 @@ func (r *Ray) GetComponentName() string {
return ComponentName
}

func (r *Ray) UpdateStatus(in *status.ComponentsStatus) {
enabled := r.GetManagementState() == operatorv1.Managed
if enabled {
rayStatus := status.GetReleaseVersion(deploy.DefaultManifestPath, ComponentName)

in.Ray = &status.RayStatus{
ComponentStatus: rayStatus,
}
} else {
in.Ray = 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
14 changes: 14 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,19 @@ func (r *TrainingOperator) GetComponentName() string {
return ComponentName
}

func (r *TrainingOperator) UpdateStatus(in *status.ComponentsStatus) {
enabled := r.GetManagementState() == operatorv1.Managed
if enabled {
trainingOperatorStatus := status.GetReleaseVersion(deploy.DefaultManifestPath, ComponentName)

in.TrainingOperator = &status.TrainingOperatorStatus{
ComponentStatus: trainingOperatorStatus,
}
} else {
in.TrainingOperator = 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
14 changes: 14 additions & 0 deletions components/trustyai/trustyai.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,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 @@ -78,6 +79,19 @@ func (t *TrustyAI) GetComponentName() string {
return ComponentName
}

func (t *TrustyAI) UpdateStatus(in *status.ComponentsStatus) {
enabled := t.GetManagementState() == operatorv1.Managed
if enabled {
trustyAIStatus := status.GetReleaseVersion(deploy.DefaultManifestPath, ComponentName)

in.TrustyAI = &status.TrustyAIStatus{
ComponentStatus: trustyAIStatus,
}
} else {
in.TrustyAI = nil
}
}

func (t *TrustyAI) ReconcileComponent(ctx context.Context, cli client.Client,
owner metav1.Object, dscispec *dsciv1.DSCInitializationSpec, platform cluster.Platform, _ bool) error {
l := logf.FromContext(ctx)
Expand Down
14 changes: 14 additions & 0 deletions components/workbenches/workbenches.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"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/labels"
Expand Down Expand Up @@ -110,6 +111,19 @@ func (w *Workbenches) GetComponentName() string {
return ComponentName
}

func (w *Workbenches) UpdateStatus(in *status.ComponentsStatus) {
enabled := w.GetManagementState() == operatorv1.Managed
if enabled {
workbenchesStatus := status.GetReleaseVersion(deploy.DefaultManifestPath, ComponentName)

in.Workbenches = &status.WorkbenchesStatus{
ComponentStatus: workbenchesStatus,
}
} else {
in.Workbenches = nil
}
}

func (w *Workbenches) 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