Skip to content

Commit

Permalink
Make DSC's component conditions user friendly (#1451)
Browse files Browse the repository at this point in the history
* Make DSC's component conditions user friendly

1. Use Components Kind as a prefix for the Ready condition so instead of
   having someting like odh-model-controllerReady we now have a more
   friendly ModeControllerReady
2. Make sure that the DVK defined in the gvk packages uses constants
   from components to avoid discrepancies

* Fix dsp e2e tests

* Fix Kueue GVK variable
  • Loading branch information
lburgazzoli authored Dec 19, 2024
1 parent d564e94 commit c31a85b
Show file tree
Hide file tree
Showing 36 changed files with 154 additions and 84 deletions.
2 changes: 1 addition & 1 deletion controllers/components/codeflare/codeflare.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.Components.CodeFlare.CodeFlareCommonStatus = nil

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Type: ReadyConditionType,
Status: corev1.ConditionFalse,
Reason: "Unknown",
Message: "Not Available",
Expand Down
5 changes: 5 additions & 0 deletions controllers/components/codeflare/codeflare_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ package codeflare
import (
"path"

conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"

componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
odhtypes "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/types"
odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
)

const (
ComponentName = componentApi.CodeFlareComponentName

ReadyConditionType = conditionsv1.ConditionType(componentApi.CodeFlareKind + status.ReadySuffix)

// LegacyComponentName is the name of the component that is assigned to deployments
// via Kustomize. Since a deployment selector is immutable, we can't upgrade existing
// deployment to the new component name, so keep it around till we figure out a solution.
Expand Down
2 changes: 1 addition & 1 deletion controllers/components/dashboard/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.Components.Dashboard.DashboardCommonStatus = nil

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Type: ReadyConditionType,
Status: corev1.ConditionFalse,
Reason: "Unknown",
Message: "Not Available",
Expand Down
8 changes: 6 additions & 2 deletions controllers/components/dashboard/dashboard_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ import (
"context"
"fmt"

conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

componentsApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1"
componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1"
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"
odhtypes "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/types"
odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
)

const (
ComponentName = componentsApi.DashboardComponentName
ComponentName = componentApi.DashboardComponentName

ReadyConditionType = conditionsv1.ConditionType(componentApi.DashboardKind + status.ReadySuffix)

// Legacy component names are the name of the component that is assigned to deployments
// via Kustomize. Since a deployment selector is immutable, we can't upgrade existing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.Components.DataSciencePipelines.DataSciencePipelinesCommonStatus = nil

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Type: ReadyConditionType,
Status: corev1.ConditionFalse,
Reason: "Unknown",
Message: "Not Available",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package datasciencepipelines

import (
conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"

componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1"
"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/controller/types"
odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
Expand All @@ -11,6 +14,8 @@ const (
ArgoWorkflowCRD = "workflows.argoproj.io"
ComponentName = componentApi.DataSciencePipelinesComponentName

ReadyConditionType = conditionsv1.ConditionType(componentApi.DataSciencePipelinesKind + status.ReadySuffix)

// LegacyComponentName is the name of the component that is assigned to deployments
// via Kustomize. Since a deployment selector is immutable, we can't upgrade existing
// deployment to the new component name, so keep it around till we figure out a solution.
Expand Down
4 changes: 3 additions & 1 deletion controllers/components/kserve/kserve.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const (
// via Kustomize. Since a deployment selector is immutable, we can't upgrade existing
// deployment to the new component name, so keep it around till we figure out a solution.
LegacyComponentName = "kserve"

ReadyConditionType = conditionsv1.ConditionType(componentApi.KserveKind + status.ReadySuffix)
)

type componentHandler struct{}
Expand Down Expand Up @@ -85,7 +87,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.Components.Kserve.KserveCommonStatus = nil

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Type: ReadyConditionType,
Status: corev1.ConditionFalse,
Reason: "Unknown",
Message: "Not Available",
Expand Down
2 changes: 1 addition & 1 deletion controllers/components/kueue/kueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.Components.Kueue.KueueCommonStatus = nil

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Type: ReadyConditionType,
Status: corev1.ConditionFalse,
Reason: "Unknown",
Message: "Not Available",
Expand Down
5 changes: 5 additions & 0 deletions controllers/components/kueue/kueue_support.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package kueue

import (
conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"

componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
odhtypes "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/types"
odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
)

const (
ComponentName = componentApi.KueueComponentName

ReadyConditionType = conditionsv1.ConditionType(componentApi.KueueKind + status.ReadySuffix)

// LegacyComponentName is the name of the component that is assigned to deployments
// via Kustomize. Since a deployment selector is immutable, we can't upgrade existing
// deployment to the new component name, so keep it around till we figure out a solution.
Expand Down
2 changes: 1 addition & 1 deletion controllers/components/modelcontroller/modelcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
}

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Type: ReadyConditionType,
Status: corev1.ConditionFalse,
Reason: "Unknown",
Message: "Not Available",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package modelcontroller

import (
conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"

componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1"
"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/controller/types"
odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
Expand All @@ -10,6 +13,8 @@ import (
const (
ComponentName = componentApi.ModelControllerComponentName

ReadyConditionType = conditionsv1.ConditionType(componentApi.ModelControllerKind + status.ReadySuffix)

// LegacyComponentName is the name of the component that is assigned to deployments
// via Kustomize. Since a deployment selector is immutable, we can't upgrade existing
// deployment to the new component name, so keep it around till we figure out a solution.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.Components.ModelMeshServing.ModelMeshServingCommonStatus = nil

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Type: ReadyConditionType,
Status: corev1.ConditionFalse,
Reason: "Unknown",
Message: "Not Available",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package modelmeshserving

import (
conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"

componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
odhtypes "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/types"
odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
Expand All @@ -10,6 +13,8 @@ import (
const (
ComponentName = componentApi.ModelMeshServingComponentName

ReadyConditionType = conditionsv1.ConditionType(componentApi.ModelMeshServingKind + status.ReadySuffix)

// LegacyComponentName is the name of the component that is assigned to deployments
// via Kustomize. Since a deployment selector is immutable, we can't upgrade existing
// deployment to the new component name, so keep it around till we figure out a solution.
Expand Down
2 changes: 1 addition & 1 deletion controllers/components/modelregistry/modelregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.Components.ModelRegistry.ModelRegistryCommonStatus = nil

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Type: ReadyConditionType,
Status: corev1.ConditionFalse,
Reason: "Unknown",
Message: "Not Available",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ import (
"embed"
"path"

conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"

componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
odhtypes "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/types"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
)

const (
ComponentName = componentApi.ModelRegistryComponentName
ComponentName = componentApi.ModelRegistryComponentName

ReadyConditionType = conditionsv1.ConditionType(componentApi.ModelRegistryKind + status.ReadySuffix)

DefaultModelRegistriesNamespace = "odh-model-registries"
DefaultModelRegistryCert = "default-modelregistry-cert"
BaseManifestsSourcePath = "overlays/odh"
Expand Down
2 changes: 1 addition & 1 deletion controllers/components/ray/ray.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.Components.Ray.RayCommonStatus = nil

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Type: ReadyConditionType,
Status: corev1.ConditionFalse,
Reason: "Unknown",
Message: "Not Available",
Expand Down
5 changes: 5 additions & 0 deletions controllers/components/ray/ray_support.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package ray

import (
conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"

componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/types"
odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
)

const (
ComponentName = componentApi.RayComponentName

ReadyConditionType = conditionsv1.ConditionType(componentApi.RayKind + status.ReadySuffix)

// LegacyComponentName is the name of the component that is assigned to deployments
// via Kustomize. Since a deployment selector is immutable, we can't upgrade existing
// deployment to the new component name, so keep it around till we figure out a solution.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.Components.TrainingOperator.TrainingOperatorCommonStatus = nil

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Type: ReadyConditionType,
Status: corev1.ConditionFalse,
Reason: "Unknown",
Message: "Not Available",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package trainingoperator

import (
conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"

componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/types"
odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
)

const (
ComponentName = componentApi.TrainingOperatorComponentName

ReadyConditionType = conditionsv1.ConditionType(componentApi.TrainingOperatorKind + status.ReadySuffix)

// LegacyComponentName is the name of the component that is assigned to deployments
// via Kustomize. Since a deployment selector is immutable, we can't upgrade existing
// deployment to the new component name, so keep it around till we figure out a solution.
Expand Down
2 changes: 1 addition & 1 deletion controllers/components/trustyai/trustyai.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.Components.TrustyAI.TrustyAICommonStatus = nil

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Type: ReadyConditionType,
Status: corev1.ConditionFalse,
Reason: "Unknown",
Message: "Not Available",
Expand Down
5 changes: 5 additions & 0 deletions controllers/components/trustyai/trustyai_support.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package trustyai

import (
conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"

componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1"
"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/controller/types"
odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
Expand All @@ -10,6 +13,8 @@ import (
const (
ComponentName = componentApi.TrustyAIComponentName

ReadyConditionType = conditionsv1.ConditionType(componentApi.TrustyAIKind + status.ReadySuffix)

// LegacyComponentName is the name of the component that is assigned to deployments
// via Kustomize. Since a deployment selector is immutable, we can't upgrade existing
// deployment to the new component name, so keep it around till we figure out a solution.
Expand Down
2 changes: 1 addition & 1 deletion controllers/components/workbenches/workbenches.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (s *componentHandler) UpdateDSCStatus(dsc *dscv1.DataScienceCluster, obj cl
dsc.Status.Components.Workbenches.WorkbenchesCommonStatus = nil

nc := conditionsv1.Condition{
Type: conditionsv1.ConditionType(s.GetName() + status.ReadySuffix),
Type: ReadyConditionType,
Status: corev1.ConditionFalse,
Reason: "Unknown",
Message: "Not Available",
Expand Down
5 changes: 5 additions & 0 deletions controllers/components/workbenches/workbenches_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ package workbenches
import (
"path"

conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"

componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
odhtypes "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/types"
odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
Expand All @@ -12,6 +15,8 @@ import (
const (
ComponentName = componentApi.WorkbenchesComponentName

ReadyConditionType = conditionsv1.ConditionType(componentApi.WorkbenchesKind + status.ReadySuffix)

notebooksPath = "notebooks"
notebookImagesManifestSourcePath = "overlays/additional"

Expand Down
Loading

0 comments on commit c31a85b

Please sign in to comment.