diff --git a/controllers/components/codeflare/codeflare.go b/controllers/components/codeflare/codeflare.go index 5263c73fcc9..0920a8b45b1 100644 --- a/controllers/components/codeflare/codeflare.go +++ b/controllers/components/codeflare/codeflare.go @@ -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", diff --git a/controllers/components/codeflare/codeflare_support.go b/controllers/components/codeflare/codeflare_support.go index 42ecb7ef870..213e0d02fb7 100644 --- a/controllers/components/codeflare/codeflare_support.go +++ b/controllers/components/codeflare/codeflare_support.go @@ -3,7 +3,10 @@ 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" ) @@ -11,6 +14,8 @@ import ( 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. diff --git a/controllers/components/dashboard/dashboard.go b/controllers/components/dashboard/dashboard.go index a0d46f3f7fd..7070c87d489 100644 --- a/controllers/components/dashboard/dashboard.go +++ b/controllers/components/dashboard/dashboard.go @@ -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", diff --git a/controllers/components/dashboard/dashboard_support.go b/controllers/components/dashboard/dashboard_support.go index 280d93a5e6c..fba02f79431 100644 --- a/controllers/components/dashboard/dashboard_support.go +++ b/controllers/components/dashboard/dashboard_support.go @@ -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 diff --git a/controllers/components/datasciencepipelines/datasciencepipelines.go b/controllers/components/datasciencepipelines/datasciencepipelines.go index c1a9d8b7481..7ee17348a28 100644 --- a/controllers/components/datasciencepipelines/datasciencepipelines.go +++ b/controllers/components/datasciencepipelines/datasciencepipelines.go @@ -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", diff --git a/controllers/components/datasciencepipelines/datasciencepipelines_support.go b/controllers/components/datasciencepipelines/datasciencepipelines_support.go index 704c94ffcf1..985721eb866 100644 --- a/controllers/components/datasciencepipelines/datasciencepipelines_support.go +++ b/controllers/components/datasciencepipelines/datasciencepipelines_support.go @@ -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" @@ -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. diff --git a/controllers/components/kserve/kserve.go b/controllers/components/kserve/kserve.go index cc14a68bcb9..8c1ddb51bc8 100644 --- a/controllers/components/kserve/kserve.go +++ b/controllers/components/kserve/kserve.go @@ -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{} @@ -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", diff --git a/controllers/components/kueue/kueue.go b/controllers/components/kueue/kueue.go index 693f8b82ff7..23287e9898f 100644 --- a/controllers/components/kueue/kueue.go +++ b/controllers/components/kueue/kueue.go @@ -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", diff --git a/controllers/components/kueue/kueue_support.go b/controllers/components/kueue/kueue_support.go index 5706a77d9dc..40169e4bd25 100644 --- a/controllers/components/kueue/kueue_support.go +++ b/controllers/components/kueue/kueue_support.go @@ -1,7 +1,10 @@ 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" ) @@ -9,6 +12,8 @@ import ( 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. diff --git a/controllers/components/modelcontroller/modelcontroller.go b/controllers/components/modelcontroller/modelcontroller.go index c168269b04b..234281939ef 100644 --- a/controllers/components/modelcontroller/modelcontroller.go +++ b/controllers/components/modelcontroller/modelcontroller.go @@ -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", diff --git a/controllers/components/modelcontroller/modelcontroller_support.go b/controllers/components/modelcontroller/modelcontroller_support.go index d7416780909..36affb1e4a1 100644 --- a/controllers/components/modelcontroller/modelcontroller_support.go +++ b/controllers/components/modelcontroller/modelcontroller_support.go @@ -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" @@ -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. diff --git a/controllers/components/modelmeshserving/modelmeshserving.go b/controllers/components/modelmeshserving/modelmeshserving.go index b75601bedb2..22bbb6aceea 100644 --- a/controllers/components/modelmeshserving/modelmeshserving.go +++ b/controllers/components/modelmeshserving/modelmeshserving.go @@ -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", diff --git a/controllers/components/modelmeshserving/modelmeshserving_support.go b/controllers/components/modelmeshserving/modelmeshserving_support.go index 8095faf0d47..1f8d8a150a0 100644 --- a/controllers/components/modelmeshserving/modelmeshserving_support.go +++ b/controllers/components/modelmeshserving/modelmeshserving_support.go @@ -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" @@ -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. diff --git a/controllers/components/modelregistry/modelregistry.go b/controllers/components/modelregistry/modelregistry.go index c79519e347a..31b13a1ed2c 100644 --- a/controllers/components/modelregistry/modelregistry.go +++ b/controllers/components/modelregistry/modelregistry.go @@ -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", diff --git a/controllers/components/modelregistry/modelregistry_support.go b/controllers/components/modelregistry/modelregistry_support.go index d3f857f8be5..4cfd0842821 100644 --- a/controllers/components/modelregistry/modelregistry_support.go +++ b/controllers/components/modelregistry/modelregistry_support.go @@ -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" diff --git a/controllers/components/ray/ray.go b/controllers/components/ray/ray.go index 0ad39e09ea2..551961a84ab 100644 --- a/controllers/components/ray/ray.go +++ b/controllers/components/ray/ray.go @@ -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", diff --git a/controllers/components/ray/ray_support.go b/controllers/components/ray/ray_support.go index e58d797157a..34a9f33136f 100644 --- a/controllers/components/ray/ray_support.go +++ b/controllers/components/ray/ray_support.go @@ -1,7 +1,10 @@ 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" ) @@ -9,6 +12,8 @@ import ( 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. diff --git a/controllers/components/trainingoperator/trainingoperator.go b/controllers/components/trainingoperator/trainingoperator.go index d7b44f5bf92..316d686b0c2 100644 --- a/controllers/components/trainingoperator/trainingoperator.go +++ b/controllers/components/trainingoperator/trainingoperator.go @@ -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", diff --git a/controllers/components/trainingoperator/trainingoperator_support.go b/controllers/components/trainingoperator/trainingoperator_support.go index 19c6e744e39..c99b7e9ff22 100644 --- a/controllers/components/trainingoperator/trainingoperator_support.go +++ b/controllers/components/trainingoperator/trainingoperator_support.go @@ -1,7 +1,10 @@ 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" ) @@ -9,6 +12,8 @@ import ( 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. diff --git a/controllers/components/trustyai/trustyai.go b/controllers/components/trustyai/trustyai.go index bd522d7e6f5..2dd4c138eb1 100644 --- a/controllers/components/trustyai/trustyai.go +++ b/controllers/components/trustyai/trustyai.go @@ -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", diff --git a/controllers/components/trustyai/trustyai_support.go b/controllers/components/trustyai/trustyai_support.go index 9a3b83edf84..f758e443c57 100644 --- a/controllers/components/trustyai/trustyai_support.go +++ b/controllers/components/trustyai/trustyai_support.go @@ -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" @@ -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. diff --git a/controllers/components/workbenches/workbenches.go b/controllers/components/workbenches/workbenches.go index 48879b9f6c0..9e2f95cc8f3 100644 --- a/controllers/components/workbenches/workbenches.go +++ b/controllers/components/workbenches/workbenches.go @@ -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", diff --git a/controllers/components/workbenches/workbenches_support.go b/controllers/components/workbenches/workbenches_support.go index 05650806330..7e3a33edc70 100644 --- a/controllers/components/workbenches/workbenches_support.go +++ b/controllers/components/workbenches/workbenches_support.go @@ -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" @@ -12,6 +15,8 @@ import ( const ( ComponentName = componentApi.WorkbenchesComponentName + ReadyConditionType = conditionsv1.ConditionType(componentApi.WorkbenchesKind + status.ReadySuffix) + notebooksPath = "notebooks" notebookImagesManifestSourcePath = "overlays/additional" diff --git a/pkg/cluster/gvk/gvk.go b/pkg/cluster/gvk/gvk.go index 5d986d31e8b..e3d3c531a3c 100644 --- a/pkg/cluster/gvk/gvk.go +++ b/pkg/cluster/gvk/gvk.go @@ -6,6 +6,8 @@ import ( corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" "k8s.io/apimachinery/pkg/runtime/schema" + + componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1" ) var ( @@ -105,75 +107,75 @@ var ( } Dashboard = schema.GroupVersionKind{ - Group: "components.platform.opendatahub.io", - Version: "v1alpha1", - Kind: "Dashboard", + Group: componentApi.GroupVersion.Group, + Version: componentApi.GroupVersion.Version, + Kind: componentApi.DashboardKind, } Workbenches = schema.GroupVersionKind{ - Group: "components.platform.opendatahub.io", - Version: "v1alpha1", - Kind: "Workbenches", + Group: componentApi.GroupVersion.Group, + Version: componentApi.GroupVersion.Version, + Kind: componentApi.WorkbenchesKind, } ModelController = schema.GroupVersionKind{ - Group: "components.platform.opendatahub.io", - Version: "v1alpha1", - Kind: "ModelController", + Group: componentApi.GroupVersion.Group, + Version: componentApi.GroupVersion.Version, + Kind: componentApi.ModelControllerKind, } ModelMeshServing = schema.GroupVersionKind{ - Group: "components.platform.opendatahub.io", - Version: "v1alpha1", - Kind: "ModelMeshServing", + Group: componentApi.GroupVersion.Group, + Version: componentApi.GroupVersion.Version, + Kind: componentApi.ModelMeshServingKind, } DataSciencePipelines = schema.GroupVersionKind{ - Group: "components.platform.opendatahub.io", - Version: "v1alpha1", - Kind: "DataSciencePipelines", + Group: componentApi.GroupVersion.Group, + Version: componentApi.GroupVersion.Version, + Kind: componentApi.DataSciencePipelinesKind, } Kserve = schema.GroupVersionKind{ - Group: "components.platform.opendatahub.io", - Version: "v1alpha1", - Kind: "Kserve", + Group: componentApi.GroupVersion.Group, + Version: componentApi.GroupVersion.Version, + Kind: componentApi.KserveKind, } Kueue = schema.GroupVersionKind{ - Group: "components.platform.opendatahub.io", - Version: "v1alpha1", - Kind: "Kueue", + Group: componentApi.GroupVersion.Group, + Version: componentApi.GroupVersion.Version, + Kind: componentApi.KueueKind, } CodeFlare = schema.GroupVersionKind{ - Group: "components.platform.opendatahub.io", - Version: "v1alpha1", - Kind: "CodeFlare", + Group: componentApi.GroupVersion.Group, + Version: componentApi.GroupVersion.Version, + Kind: componentApi.CodeFlareKind, } Ray = schema.GroupVersionKind{ - Group: "components.platform.opendatahub.io", - Version: "v1alpha1", - Kind: "Ray", + Group: componentApi.GroupVersion.Group, + Version: componentApi.GroupVersion.Version, + Kind: componentApi.RayKind, } TrustyAI = schema.GroupVersionKind{ - Group: "components.platform.opendatahub.io", - Version: "v1alpha1", - Kind: "TrustyAI", + Group: componentApi.GroupVersion.Group, + Version: componentApi.GroupVersion.Version, + Kind: componentApi.TrustyAIKind, } ModelRegistry = schema.GroupVersionKind{ - Group: "components.platform.opendatahub.io", - Version: "v1alpha1", - Kind: "ModelRegistry", + Group: componentApi.GroupVersion.Group, + Version: componentApi.GroupVersion.Version, + Kind: componentApi.ModelRegistryKind, } TrainingOperator = schema.GroupVersionKind{ - Group: "components.platform.opendatahub.io", - Version: "v1alpha1", - Kind: "TrainingOperator", + Group: componentApi.GroupVersion.Group, + Version: componentApi.GroupVersion.Version, + Kind: componentApi.TrainingOperatorKind, } CustomResourceDefinition = schema.GroupVersionKind{ diff --git a/tests/e2e/codeflare_test.go b/tests/e2e/codeflare_test.go index 25413e0ef11..e8d899e0bf6 100644 --- a/tests/e2e/codeflare_test.go +++ b/tests/e2e/codeflare_test.go @@ -22,6 +22,7 @@ import ( componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1" dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1" + "github.com/opendatahub-io/opendatahub-operator/v2/controllers/components/codeflare" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster/gvk" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/labels" ) @@ -192,7 +193,7 @@ func (tc *CodeFlareTestCtx) validateCodeFlareReady() error { } for _, c := range list.Items[0].Status.Conditions { - if c.Type == componentApi.CodeFlareComponentName+"Ready" { + if c.Type == codeflare.ReadyConditionType { return c.Status == corev1.ConditionTrue, nil } } diff --git a/tests/e2e/dashboard_test.go b/tests/e2e/dashboard_test.go index 99fb9f41785..21d25cc70a9 100644 --- a/tests/e2e/dashboard_test.go +++ b/tests/e2e/dashboard_test.go @@ -221,7 +221,7 @@ func (d *DashboardTestCtx) validateDashboardInstance(t *testing.T) { ).Should(And( HaveLen(1), HaveEach(And( - jq.Match(`.status.conditions[] | select(.type == "%sReady") | .status == "%s"`, componentApi.DashboardComponentName, metav1.ConditionTrue), + jq.Match(`.status.conditions[] | select(.type == "%s") | .status == "%s"`, dashboard.ReadyConditionType, metav1.ConditionTrue), jq.Match(`.status.installedComponents."%s" == true`, dashboard.LegacyComponentNameUpstream), jq.Match(`.status.components.%s.managementState == "%s"`, componentApi.DashboardComponentName, operatorv1.Managed), )), diff --git a/tests/e2e/datasciencepipelines_test.go b/tests/e2e/datasciencepipelines_test.go index 59dd75a1f59..dfb0ccd3ed2 100644 --- a/tests/e2e/datasciencepipelines_test.go +++ b/tests/e2e/datasciencepipelines_test.go @@ -22,6 +22,7 @@ import ( componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1" dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1" + "github.com/opendatahub-io/opendatahub-operator/v2/controllers/components/datasciencepipelines" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster/gvk" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/labels" ) @@ -230,7 +231,7 @@ func (tc *DataSciencePipelinesTestCtx) validateDataSciencePipelinesReady() error } for _, c := range list.Items[0].Status.Conditions { - if c.Type == componentApi.DataSciencePipelinesComponentName+"Ready" { + if c.Type == datasciencepipelines.ReadyConditionType { return c.Status == corev1.ConditionTrue, nil } } diff --git a/tests/e2e/kserve_test.go b/tests/e2e/kserve_test.go index 85dc2e1f9f6..2ee44672577 100644 --- a/tests/e2e/kserve_test.go +++ b/tests/e2e/kserve_test.go @@ -18,6 +18,7 @@ import ( componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1" dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1" "github.com/opendatahub-io/opendatahub-operator/v2/controllers/components/kserve" + "github.com/opendatahub-io/opendatahub-operator/v2/controllers/components/modelcontroller" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster/gvk" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/labels" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/resources" @@ -81,8 +82,8 @@ func (k *KserveTestCtx) validateKserveInstance(t *testing.T) { ).Should(And( HaveLen(1), HaveEach(And( - jq.Match(`.status.conditions[] | select(.type == "%sReady") | .status == "%s"`, componentApi.KserveComponentName, metav1.ConditionTrue), - jq.Match(`.status.conditions[] | select(.type == "%sReady") | .status == "%s"`, componentApi.ModelControllerComponentName, metav1.ConditionTrue), + jq.Match(`.status.conditions[] | select(.type == "%s") | .status == "%s"`, kserve.ReadyConditionType, metav1.ConditionTrue), + jq.Match(`.status.conditions[] | select(.type == "%s") | .status == "%s"`, modelcontroller.ReadyConditionType, metav1.ConditionTrue), jq.Match(`.status.installedComponents."%s" == true`, kserve.LegacyComponentName), jq.Match(`.status.components.%s.managementState == "%s"`, componentApi.KserveComponentName, operatorv1.Managed), )), @@ -133,7 +134,7 @@ func (k *KserveTestCtx) validateOperandsOwnerReferences(t *testing.T) { ).Should(And( HaveLen(1), HaveEach( - jq.Match(`.status.conditions[] | select(.type == "%sReady") | .status == "%s"`, componentApi.KserveComponentName, metav1.ConditionTrue), + jq.Match(`.status.conditions[] | select(.type == "%s") | .status == "%s"`, kserve.ReadyConditionType, metav1.ConditionTrue), ), )) } @@ -252,7 +253,7 @@ func (k *KserveTestCtx) validateKserveDisabled(t *testing.T) { ).Should(And( HaveLen(1), HaveEach( - jq.Match(`.status.conditions[] | select(.type == "%sReady") | .status == "%s"`, componentApi.KserveComponentName, metav1.ConditionFalse), + jq.Match(`.status.conditions[] | select(.type == "%s") | .status == "%s"`, kserve.ReadyConditionType, metav1.ConditionFalse), ), )) } diff --git a/tests/e2e/kueue_test.go b/tests/e2e/kueue_test.go index 6a9080acf59..cdfb549382a 100644 --- a/tests/e2e/kueue_test.go +++ b/tests/e2e/kueue_test.go @@ -22,6 +22,7 @@ import ( componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1" dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1" + "github.com/opendatahub-io/opendatahub-operator/v2/controllers/components/kueue" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster/gvk" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/labels" ) @@ -192,7 +193,7 @@ func (tc *KueueTestCtx) validateKueueReady() error { } for _, c := range list.Items[0].Status.Conditions { - if c.Type == componentApi.KueueComponentName+"Ready" { + if c.Type == kueue.ReadyConditionType { return c.Status == corev1.ConditionTrue, nil } } diff --git a/tests/e2e/modelcontroller_test.go b/tests/e2e/modelcontroller_test.go index abf701cb628..7d34fab9377 100644 --- a/tests/e2e/modelcontroller_test.go +++ b/tests/e2e/modelcontroller_test.go @@ -17,6 +17,7 @@ import ( componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1" dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1" + "github.com/opendatahub-io/opendatahub-operator/v2/controllers/components/modelcontroller" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster/gvk" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/labels" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/resources" @@ -204,7 +205,7 @@ func (tc *ModelControllerTestCtx) validateModelControllerInstance(t *testing.T) ).Should(And( HaveLen(1), HaveEach(And( - jq.Match(`.status.conditions[] | select(.type == "%sReady") | .status == "%s"`, componentApi.ModelControllerComponentName, metav1.ConditionTrue), + jq.Match(`.status.conditions[] | select(.type == "%s") | .status == "%s"`, modelcontroller.ReadyConditionType, metav1.ConditionTrue), )), )) } @@ -327,7 +328,7 @@ func (tc *ModelControllerTestCtx) validateModelControllerDisabled(t *testing.T) ).Should(And( HaveLen(1), HaveEach( - jq.Match(`.status.conditions[] | select(.type == "%sReady") | .status == "%s"`, componentApi.ModelControllerComponentName, metav1.ConditionFalse), + jq.Match(`.status.conditions[] | select(.type == "%s") | .status == "%s"`, modelcontroller.ReadyConditionType, metav1.ConditionFalse), ), )) } diff --git a/tests/e2e/modelmeshserving_test.go b/tests/e2e/modelmeshserving_test.go index b1a2af9774c..e6617c24a6e 100644 --- a/tests/e2e/modelmeshserving_test.go +++ b/tests/e2e/modelmeshserving_test.go @@ -17,6 +17,8 @@ import ( componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1" dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1" + "github.com/opendatahub-io/opendatahub-operator/v2/controllers/components/modelcontroller" + "github.com/opendatahub-io/opendatahub-operator/v2/controllers/components/modelmeshserving" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster/gvk" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/labels" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/resources" @@ -204,8 +206,8 @@ func (tc *ModelMeshServingTestCtx) validateModelMeshServingInstance(t *testing.T ).Should(And( HaveLen(1), HaveEach(And( - jq.Match(`.status.conditions[] | select(.type == "%sReady") | .status == "%s"`, componentApi.ModelMeshServingComponentName, metav1.ConditionTrue), - jq.Match(`.status.conditions[] | select(.type == "%sReady") | .status == "%s"`, componentApi.ModelControllerComponentName, metav1.ConditionTrue), + jq.Match(`.status.conditions[] | select(.type == "%s") | .status == "%s"`, modelmeshserving.ReadyConditionType, metav1.ConditionTrue), + jq.Match(`.status.conditions[] | select(.type == "%s") | .status == "%s"`, modelcontroller.ReadyConditionType, metav1.ConditionTrue), )), )) @@ -337,7 +339,7 @@ func (tc *ModelMeshServingTestCtx) validateModelMeshServingDisabled(t *testing.T ).Should(And( HaveLen(1), HaveEach( - jq.Match(`.status.conditions[] | select(.type == "%sReady") | .status == "%s"`, componentApi.ModelMeshServingComponentName, metav1.ConditionFalse), + jq.Match(`.status.conditions[] | select(.type == "%s") | .status == "%s"`, modelmeshserving.ReadyConditionType, metav1.ConditionFalse), ), )) } diff --git a/tests/e2e/modelregistry_test.go b/tests/e2e/modelregistry_test.go index d3b69bf2648..b2426a3507e 100644 --- a/tests/e2e/modelregistry_test.go +++ b/tests/e2e/modelregistry_test.go @@ -226,7 +226,7 @@ func (mr *ModelRegistryTestCtx) validateModelRegistryInstance(t *testing.T) { ).Should(And( HaveLen(1), HaveEach(And( - jq.Match(`.status.conditions[] | select(.type == "%sReady") | .status == "%s"`, componentApi.ModelRegistryComponentName, metav1.ConditionTrue), + jq.Match(`.status.conditions[] | select(.type == "%s") | .status == "%s"`, modelregistry.ReadyConditionType, metav1.ConditionTrue), jq.Match(`.status.installedComponents."%s" == true`, modelregistry.LegacyComponentName), jq.Match(`.status.components.%s.managementState == "%s"`, componentApi.ModelRegistryComponentName, operatorv1.Managed), )), diff --git a/tests/e2e/ray_test.go b/tests/e2e/ray_test.go index 9c02b9c05b4..673c25940ac 100644 --- a/tests/e2e/ray_test.go +++ b/tests/e2e/ray_test.go @@ -22,6 +22,7 @@ import ( componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1" dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1" + "github.com/opendatahub-io/opendatahub-operator/v2/controllers/components/ray" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster/gvk" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/labels" ) @@ -192,7 +193,7 @@ func (tc *RayTestCtx) validateRayReady() error { } for _, c := range list.Items[0].Status.Conditions { - if c.Type == componentApi.RayComponentName+"Ready" { + if c.Type == ray.ReadyConditionType { return c.Status == corev1.ConditionTrue, nil } } diff --git a/tests/e2e/trainingoperator_test.go b/tests/e2e/trainingoperator_test.go index 8b300fbb51a..b3419cfbcfe 100644 --- a/tests/e2e/trainingoperator_test.go +++ b/tests/e2e/trainingoperator_test.go @@ -22,6 +22,7 @@ import ( componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1" dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1" + "github.com/opendatahub-io/opendatahub-operator/v2/controllers/components/trainingoperator" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster/gvk" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/labels" ) @@ -167,13 +168,13 @@ func (tc *TrainingOperatorTestCtx) testOwnerReferences() error { func (tc *TrainingOperatorTestCtx) validateTrainingOperatorReady() error { err := wait.PollUntilContextTimeout(tc.testCtx.ctx, generalRetryInterval, componentReadyTimeout, true, func(ctx context.Context) (bool, error) { key := types.NamespacedName{Name: tc.testTrainingOperatorInstance.Name} - trainingoperator := &componentApi.TrainingOperator{} + to := &componentApi.TrainingOperator{} - err := tc.testCtx.customClient.Get(ctx, key, trainingoperator) + err := tc.testCtx.customClient.Get(ctx, key, to) if err != nil { return false, err } - return trainingoperator.Status.Phase == readyStatus, nil + return to.Status.Phase == readyStatus, nil }) if err != nil { @@ -192,7 +193,7 @@ func (tc *TrainingOperatorTestCtx) validateTrainingOperatorReady() error { } for _, c := range list.Items[0].Status.Conditions { - if c.Type == componentApi.TrainingOperatorComponentName+"Ready" { + if c.Type == trainingoperator.ReadyConditionType { return c.Status == corev1.ConditionTrue, nil } } @@ -304,8 +305,8 @@ func (tc *TrainingOperatorTestCtx) testUpdateTrainingOperatorComponentDisabled() if err = tc.testCtx.wait(func(ctx context.Context) (bool, error) { // Verify TrainingOperator CR is deleted - trainingoperator := &componentApi.TrainingOperator{} - err = tc.testCtx.customClient.Get(ctx, client.ObjectKey{Name: tc.testTrainingOperatorInstance.Name}, trainingoperator) + to := &componentApi.TrainingOperator{} + err = tc.testCtx.customClient.Get(ctx, client.ObjectKey{Name: tc.testTrainingOperatorInstance.Name}, to) return k8serr.IsNotFound(err), nil }); err != nil { return fmt.Errorf("component TrainingOperator is disabled, should not get the TrainingOperator CR %v", tc.testTrainingOperatorInstance.Name) diff --git a/tests/e2e/trustyai_test.go b/tests/e2e/trustyai_test.go index 89a4ba1ece0..f57809e8f68 100644 --- a/tests/e2e/trustyai_test.go +++ b/tests/e2e/trustyai_test.go @@ -22,6 +22,7 @@ import ( componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1" dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1" + "github.com/opendatahub-io/opendatahub-operator/v2/controllers/components/trustyai" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster/gvk" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/labels" ) @@ -167,13 +168,13 @@ func (tc *TrustyaiTestCtx) testOwnerReferences() error { func (tc *TrustyaiTestCtx) validateTrustyaiReady() error { err := wait.PollUntilContextTimeout(tc.testCtx.ctx, generalRetryInterval, componentReadyTimeout, true, func(ctx context.Context) (bool, error) { key := types.NamespacedName{Name: tc.testTrustyaiInstance.Name} - trustyai := &componentApi.TrustyAI{} + tai := &componentApi.TrustyAI{} - err := tc.testCtx.customClient.Get(ctx, key, trustyai) + err := tc.testCtx.customClient.Get(ctx, key, tai) if err != nil { return false, err } - return trustyai.Status.Phase == readyStatus, nil + return tai.Status.Phase == readyStatus, nil }) if err != nil { @@ -192,7 +193,7 @@ func (tc *TrustyaiTestCtx) validateTrustyaiReady() error { } for _, c := range list.Items[0].Status.Conditions { - if c.Type == componentApi.TrustyAIComponentName+"Ready" { + if c.Type == trustyai.ReadyConditionType { return c.Status == corev1.ConditionTrue, nil } } @@ -304,8 +305,8 @@ func (tc *TrustyaiTestCtx) testUpdateTrustyaiComponentDisabled() error { if err = tc.testCtx.wait(func(ctx context.Context) (bool, error) { // Verify trustyai CR is deleted - trustyai := &componentApi.TrustyAI{} - err = tc.testCtx.customClient.Get(ctx, client.ObjectKey{Name: tc.testTrustyaiInstance.Name}, trustyai) + tai := &componentApi.TrustyAI{} + err = tc.testCtx.customClient.Get(ctx, client.ObjectKey{Name: tc.testTrustyaiInstance.Name}, tai) return k8serr.IsNotFound(err), nil }); err != nil { return fmt.Errorf("component trustyai is disabled, should not get the Trustyai CR %v", tc.testTrustyaiInstance.Name) diff --git a/tests/e2e/workbenches_test.go b/tests/e2e/workbenches_test.go index 972a014f30b..fc3922aab55 100644 --- a/tests/e2e/workbenches_test.go +++ b/tests/e2e/workbenches_test.go @@ -22,6 +22,7 @@ import ( componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1" dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1" + "github.com/opendatahub-io/opendatahub-operator/v2/controllers/components/workbenches" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster/gvk" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/labels" ) @@ -169,13 +170,13 @@ func (tc *WorkbenchesTestCtx) testOwnerReferences() error { func (tc *WorkbenchesTestCtx) validateWorkbenchesReady() error { err := wait.PollUntilContextTimeout(tc.testCtx.ctx, generalRetryInterval, componentReadyTimeout, true, func(ctx context.Context) (bool, error) { key := types.NamespacedName{Name: tc.testWorkbenchesInstance.Name} - workbenches := &componentApi.Workbenches{} + wb := &componentApi.Workbenches{} - err := tc.testCtx.customClient.Get(ctx, key, workbenches) + err := tc.testCtx.customClient.Get(ctx, key, wb) if err != nil { return false, err } - return workbenches.Status.Phase == readyStatus, nil + return wb.Status.Phase == readyStatus, nil }) if err != nil { @@ -194,7 +195,7 @@ func (tc *WorkbenchesTestCtx) validateWorkbenchesReady() error { } for _, c := range list.Items[0].Status.Conditions { - if c.Type == componentApi.WorkbenchesComponentName+"Ready" { + if c.Type == workbenches.ReadyConditionType { return c.Status == corev1.ConditionTrue, nil } } @@ -305,8 +306,8 @@ func (tc *WorkbenchesTestCtx) testUpdateWorkbenchesComponentDisabled() error { err = tc.testCtx.wait(func(ctx context.Context) (bool, error) { // Verify Workbenches CR is deleted - workbenches := &componentApi.Workbenches{} - err = tc.testCtx.customClient.Get(ctx, client.ObjectKey{Name: tc.testWorkbenchesInstance.Name}, workbenches) + wb := &componentApi.Workbenches{} + err = tc.testCtx.customClient.Get(ctx, client.ObjectKey{Name: tc.testWorkbenchesInstance.Name}, wb) return k8serr.IsNotFound(err), nil })