From 389405bda8754d6bc0eb211e33e5c024470df971 Mon Sep 17 00:00:00 2001 From: Ugo Giordano Date: Wed, 29 Jan 2025 16:15:30 +0100 Subject: [PATCH] Map component versions to RHOAI status for better visibility commit 8caaedfbbc7da4890f41496275a71e4364730646 Author: Ugo Giordano Date: Wed Jan 29 16:09:34 2025 +0100 added generated files commit aedbf416350a406e58224a80a65333bb651d4a6e Merge: 91359272 6e134b11 Author: Ugo Giordano Date: Wed Jan 29 16:00:38 2025 +0100 Merge branch 'main' into RHOAIENG-11648/component-mapping-refactor commit 91359272e43f7ec34699be3b5cdc6a5591721192 Author: Ugo Giordano Date: Wed Jan 29 15:28:08 2025 +0100 removed releases from dashboard since not needed and renamed ComponentReleaseStatus into ComponentRelease commit 237806dcb60361fc29a61bb3666bf3af8ffb4013 Author: Ugo Giordano Date: Wed Jan 29 12:56:50 2025 +0100 removed releases from dashboard since not needed commit 6e134b11c495cfae354c70f2afff026e6f295e53 Author: Wen Zhou Date: Wed Jan 29 12:41:18 2025 +0100 fix: missing permission to update prometheusrules (#1581) Signed-off-by: Wen Zhou commit a044cdaee78a70b7604c14b5ec5ac275edd89da8 Merge: 25719651 bd00c9bb Author: Ugo Giordano Date: Wed Jan 29 12:13:12 2025 +0100 Merge branch 'main' into RHOAIENG-11648/component-mapping-refactor commit 25719651a42517067bc05a9c64f107efaab4ce9d Author: Ugo Giordano Date: Wed Jan 29 11:42:27 2025 +0100 Map component versions to RHOAI status for better visibility commit 0f1cf7dd9ca20e41c97a1590e18dc888b68e9fd5 Author: Ugo Giordano Date: Wed Jan 29 11:40:58 2025 +0100 fix lint error commit 473e86f55fd87e496c5d4251d075dc1082ce6e4c Author: Ugo Giordano Date: Mon Jan 27 16:42:00 2025 +0100 Map component versions to RHOAI status for better visibility commit 3d4767951e1d18729e5f7b13fa5974feb96e7e0d Merge: d706b929 bd00c9bb Author: Ugo Giordano Date: Wed Jan 29 11:32:16 2025 +0100 Merge branch 'main' into RHOAIENG-11648/component-mapping-refactor commit d706b92995b558e265941ddc71373423e842d1b5 Author: Ugo Giordano Date: Tue Jan 28 18:00:29 2025 +0100 Remove fetch releases action from dashboard & e2e tests commit 4e0deb2321616bc98a4049512264aa8b1c398fc0 Author: Ugo Giordano Date: Tue Jan 28 16:10:28 2025 +0100 unit test e2e tests commit bd00c9bb43f801e78f3026c71c1cb967bd530f13 Author: Luca Burgazzoli Date: Tue Jan 28 23:53:01 2025 +0100 Improve Kserve's FeatureTraker handing (#1562) * Improve Kserve's FeatureTraker handing - Make it possible to set FT's OwnerReference as Controller reference so the kubernetes garbage collector can block owner deletion till the FT has been deleted - Make it possible to set FT's generated resources OwnerReference as Controller reference so the kubernetes garbage collector can block FT deletion till the resources have been deleted - Add an Kserver reconciler action to remove legacy ownership on DSCI/DSC is any and related e2e tests * Update RBACs * Update RBACs * Fix findings * Update pkg/cluster/meta.go Co-authored-by: Gerard Ryan * Fix renaming * Remove unrelated methods --------- Co-authored-by: Gerard Ryan commit df5495e92bd6b46a315177659ca9278b472b5226 Author: Wen Zhou Date: Tue Jan 28 21:21:23 2025 +0100 docs: remove duplicated files and update integration docs (#1575) Signed-off-by: Wen Zhou commit ca2f619308ea33aa8013f27fa80684e16043dc15 Author: Wen Zhou Date: Tue Jan 28 21:02:36 2025 +0100 fix: missing update permission on dashboard object (#1576) - add update on all cases Signed-off-by: Wen Zhou commit a996732147218650e8127b5b577e9db7990500c6 Author: Wen Zhou Date: Tue Jan 28 20:50:56 2025 +0100 fix: fix wrong map for DSP images (#1577) - the old images are from 2.15 which have been updated during 2.16 Signed-off-by: Wen Zhou commit 94095f927f113c355e53f9619e9d2fa25125a5f0 Author: Dipanshu Gupta <97534722+dpanshug@users.noreply.github.com> Date: Tue Jan 28 21:57:25 2025 +0530 Setup admin permissions for hardware profiles (#1573) commit 3056ab4860f6b84b554e4a884784a1a18aa4dda3 Author: Ajay Jaganathan <36824134+AjayJagan@users.noreply.github.com> Date: Tue Jan 28 17:58:06 2025 +0530 (fix): point to correct path for component integration doc (#1574) commit d538956f5238fb90ff9aabc4991092897b3d4cfb Author: Luca Burgazzoli Date: Tue Jan 28 10:01:48 2025 +0100 chore: use constants from the status package where possible (#1541) Co-authored-by: Wen Zhou commit 9aed5e093abd903c41a5b9edec5ab0decbf42e9c Author: Andrew Ballantyne <8126518+andrewballantyne@users.noreply.github.com> Date: Mon Jan 27 13:20:04 2025 -0500 Clarify and update permissions (#1538) * Add readme to explain values of permissions * NIM Accounts are namespaced resources * Update permissions to fulfill doc design * Based on feedback, less hard-fast ruling wording in the README commit 5e60591b0fb670b56098bfe3455254f802da6828 Author: Wen Zhou Date: Mon Jan 27 17:33:51 2025 +0100 test: disable monitoring config in DSCI for ODH e2e test (#1570) - we do not enable monitoring in ODH logic - we should keep it enable for rhoai branch Signed-off-by: Wen Zhou commit a8eb6ff71b902677980be52bdeb54876f5967392 Author: Ugo Giordano Date: Mon Jan 27 16:51:31 2025 +0100 fix lint add updated api doc commit 4b76ca4d0f83a54f79a9ded4938f3a1163de9512 Author: Ugo Giordano Date: Mon Jan 27 16:42:00 2025 +0100 Map component versions to RHOAI status for better visibility commit 48341ffdc20606a517f65502662d39515716737e Author: Luca Burgazzoli Date: Mon Jan 27 15:38:21 2025 +0100 It takes more than 10 minutes for kserve-controller to be created during 2.17 installation (#1564) * It takes more than 10 minutes for kserve-controller to be created during 2.17 installation * cleanup commit b0a0f87897e27b449833120d8aa8bb00882cace5 Author: Wen Zhou Date: Mon Jan 27 13:53:40 2025 +0100 update: clean up old code before refactor (#1494) * update: clean up old code before refactor - remove reference we explicilty check on odhdashboardconfig and kserve - remove customized config on controller QPS - remove RemoveLabel which is not called anywhere Signed-off-by: Wen Zhou * update: - remove function for upgrade cleanup introduced before 2.8 - remove flags to main: operator namespace and application namespace ( operator namespace is passing as env variable, app namespace is done by DSCI ) Signed-off-by: Wen Zhou * fix: Auth CR is cluster-scoped no need to set namespace for request - application namespace is removed from reconciler of dsci Signed-off-by: Wen Zhou * fix: wrong code for upgrade path + rebase error Signed-off-by: Wen Zhou --------- Signed-off-by: Wen Zhou commit 7b4dfc277f761a747f522e163aa8fa44a15f4076 Author: Wen Zhou Date: Mon Jan 27 12:01:07 2025 +0100 fix: for upgrade case we will need update permission on buildconfig to revmoew ownerref from dsc (#1567) Signed-off-by: Wen Zhou commit a00aa618d69e3fabc62f204e046c67824698cec2 Author: Wen Zhou Date: Mon Jan 27 09:00:32 2025 +0100 fix: add matchlabel on NWP for customized appliation (#1566) - update README and troubleshooting Signed-off-by: Wen Zhou commit eb424504eda32a6852a832c9c8ed0b2986db66e1 Author: Manjunath Kumatagi Date: Fri Jan 24 19:11:14 2025 +0530 Build platform independent binary based on the target platform (#1549) commit bc63cfdf1d120eb015ee53223b26fb86e0939cc2 Author: Wen Zhou Date: Thu Jan 23 21:04:44 2025 +0100 update: change previous workaround for subscription and add smcp in the list (#1557) - remove subs from client cache - add smcp into exclude cache Signed-off-by: Wen Zhou commit 63d4eaba75b1c4b9092b0a30b349e5e73e2e3d4a Author: Wen Zhou Date: Thu Jan 23 18:44:37 2025 +0100 fix: missing monitoring NS for NWP if user opt customized app NS (#1558) Signed-off-by: Wen Zhou commit 912dcaa9d1f4ba0242b297e408976504efc8f73c Author: Ugo Giordano Date: Thu Jan 23 16:56:32 2025 +0100 Align get_all_manifests.sh with Kubeflow main branch (#1550) commit ce7b3814bb9b1c01a2adfdfab58c4638a29ae12c Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu Jan 23 14:08:54 2025 +0100 Update version to 2.23.1 (#1553) Co-authored-by: zdtsw <915053+zdtsw@users.noreply.github.com> commit 9845f7e6f8e4a4b1475c072eb5dfedf143dd1aef Author: Wen Zhou Date: Thu Jan 23 14:07:25 2025 +0100 update: various fix backport from RHOAI (#1536) - fix missing RHOAI monitoring namespace for self-managed - fix wrong namespace name in manifests - update hardcode label name - fix misleading log message Signed-off-by: Wen Zhou commit 871c7999924a884fefd816bddaba667e4a1bd036 Author: Wen Zhou Date: Thu Jan 23 13:21:29 2025 +0100 fix: as a workaround for getting knative opreator check, set cache (#1555) Signed-off-by: Wen Zhou commit 28d0fa1a42d70defeafd9d1055a83617aba7d22c Author: Wen Zhou Date: Thu Jan 23 11:49:37 2025 +0100 fix: add missing namespace for console in managed cluster (#1552) - blackbox require this - move into const in cluster pkg Signed-off-by: Wen Zhou commit 5bcbabaa27f8ab3fd066c609cca417ec25c91e54 Author: Luca Burgazzoli Date: Wed Jan 22 19:31:20 2025 +0100 Avoid modelmesh and Kserve loop on updating shared CRDs (#1547) The KServe and ModelMesh are shipping the same CRDs as part of their manifests but with different versions, this cause the respective component reconcilers to keep trying to install their respective version, ending in a infinite loop. This commit does not solve the underlying problem of having two components shipping the same CRDs with different versions, but avoids the infinite reconcile loop. The CRDs that is actually installed on the cluster is undefined, the latest one that is applied wins commit 8c7fef2861e0d1c52e199be658d6d957a11c8197 Author: Luca Burgazzoli Date: Wed Jan 22 15:45:51 2025 +0100 chore: remove unused code (#1543) * chore: remove unused TrimToRFC1123Name function * chore: remove unused pkg/cluster/roles functions * chore: remove unused pkg/cluster/resources functions commit e83f2fc93421ca62a1341709be86b3988fbc7b5d Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed Jan 22 13:49:00 2025 +0100 Update version to 2.23.0 (#1544) Co-authored-by: zdtsw <915053+zdtsw@users.noreply.github.com> commit 21eba1bc14bb25ea6ce4ff39b1119780d003a7c4 Author: Luca Burgazzoli Date: Wed Jan 22 12:38:49 2025 +0100 chore: cleanup Monitoring's initialize action (#1542) The Monitoring controller is initialized only when the platform is managed, hence there's no need to conditionally add manifests commit 5321b8c102688c3a6672cfdfd6c636aca20783a6 Author: Luca Burgazzoli Date: Wed Jan 22 11:05:23 2025 +0100 fix: use Monitoring.Spec.Namespace instead of the DSCI one (#1540) This reduce the direct dependency from Monitoring to DSCI --- apis/common/types.go | 25 +++ apis/common/zz_generated.deepcopy.go | 35 +++ apis/components/v1alpha1/codeflare_types.go | 7 + .../v1alpha1/datasciencepipelines_types.go | 9 + apis/components/v1alpha1/kserve_types.go | 11 +- apis/components/v1alpha1/kueue_types.go | 8 + .../v1alpha1/modelmeshserving_types.go | 10 + .../v1alpha1/modelregistry_types.go | 11 +- apis/components/v1alpha1/ray_types.go | 8 + .../v1alpha1/trainingoperator_types.go | 10 + apis/components/v1alpha1/trustyai_types.go | 8 + apis/components/v1alpha1/workbenches_types.go | 7 + .../v1alpha1/zz_generated.deepcopy.go | 50 +++-- ...ts.platform.opendatahub.io_codeflares.yaml | 18 ++ ...m.opendatahub.io_datasciencepipelines.yaml | 18 ++ ...nents.platform.opendatahub.io_kserves.yaml | 18 ++ ...onents.platform.opendatahub.io_kueues.yaml | 18 ++ ...form.opendatahub.io_modelmeshservings.yaml | 18 ++ ...atform.opendatahub.io_modelregistries.yaml | 18 ++ ...mponents.platform.opendatahub.io_rays.yaml | 18 ++ ...form.opendatahub.io_trainingoperators.yaml | 18 ++ ...nts.platform.opendatahub.io_trustyais.yaml | 18 ++ ...s.platform.opendatahub.io_workbenches.yaml | 18 ++ ...er.opendatahub.io_datascienceclusters.yaml | 180 +++++++++++++++ ...atahub-operator.clusterserviceversion.yaml | 2 +- ...ts.platform.opendatahub.io_codeflares.yaml | 18 ++ ...m.opendatahub.io_datasciencepipelines.yaml | 18 ++ ...nents.platform.opendatahub.io_kserves.yaml | 18 ++ ...onents.platform.opendatahub.io_kueues.yaml | 18 ++ ...form.opendatahub.io_modelmeshservings.yaml | 18 ++ ...atform.opendatahub.io_modelregistries.yaml | 18 ++ ...mponents.platform.opendatahub.io_rays.yaml | 18 ++ ...form.opendatahub.io_trainingoperators.yaml | 18 ++ ...nts.platform.opendatahub.io_trustyais.yaml | 18 ++ ...s.platform.opendatahub.io_workbenches.yaml | 18 ++ ...er.opendatahub.io_datascienceclusters.yaml | 180 +++++++++++++++ .../codeflare/codeflare_controller.go | 2 + .../datasciencepipelines_controller.go | 2 + .../components/kserve/kserve_controller.go | 2 + .../components/kueue/kueue_controller.go | 2 + .../modelmeshserving_controller.go | 2 + .../modelregistry/modelregistry_controller.go | 2 + controllers/components/ray/ray_controller.go | 2 + .../trainingoperator_controller.go | 2 + .../trustyai/trustyai_controller.go | 2 + .../workbenches/workbenches_controller.go | 6 + docs/api-overview.md | 36 +++ .../releases/action_fetch_releases_status.go | 151 +++++++++++++ .../action_fetch_releases_status_test.go | 210 ++++++++++++++++++ pkg/resources/resources.go | 10 + tests/e2e/codeflare_test.go | 1 + tests/e2e/components_test.go | 40 ++++ tests/e2e/datasciencepipelines_test.go | 1 + tests/e2e/kserve_test.go | 1 + tests/e2e/kueue_test.go | 1 + tests/e2e/modelmeshserving_test.go | 1 + tests/e2e/modelregistry_test.go | 1 + tests/e2e/ray_test.go | 1 + tests/e2e/trainingoperator_test.go | 1 + tests/e2e/trustyai_test.go | 1 + 60 files changed, 1378 insertions(+), 23 deletions(-) create mode 100644 pkg/controller/actions/status/releases/action_fetch_releases_status.go create mode 100644 pkg/controller/actions/status/releases/action_fetch_releases_status_test.go diff --git a/apis/common/types.go b/apis/common/types.go index 473f288e0c8..90089dbb1cd 100644 --- a/apis/common/types.go +++ b/apis/common/types.go @@ -71,6 +71,26 @@ type Status struct { Conditions []metav1.Condition `json:"conditions,omitempty"` } +// ComponentRelease represents the detailed status of a component release. +// +kubebuilder:object:generate=true +type ComponentRelease struct { + // +required + // +kubebuilder:validation:Required + Name string `json:"name"` + Version string `json:"version,omitempty"` + RepoURL string `json:"repoUrl,omitempty"` +} + +// ComponentReleaseStatus tracks the list of component releases, including their name, version, and repository URL. +// +kubebuilder:object:generate=true +type ComponentReleaseStatus struct { + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=map + // +listMapKey=name + Releases []ComponentRelease `json:"releases,omitempty"` +} + type WithStatus interface { GetStatus() *Status } @@ -79,6 +99,11 @@ type WithDevFlags interface { GetDevFlags() *DevFlags } +type WithReleases interface { + GetReleaseStatus() *[]ComponentRelease + SetReleaseStatus(status []ComponentRelease) +} + type PlatformObject interface { client.Object WithStatus diff --git a/apis/common/zz_generated.deepcopy.go b/apis/common/zz_generated.deepcopy.go index 6c981a98ca3..f05899a4974 100644 --- a/apis/common/zz_generated.deepcopy.go +++ b/apis/common/zz_generated.deepcopy.go @@ -24,6 +24,41 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentRelease) DeepCopyInto(out *ComponentRelease) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentRelease. +func (in *ComponentRelease) DeepCopy() *ComponentRelease { + if in == nil { + return nil + } + out := new(ComponentRelease) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentReleaseStatus) DeepCopyInto(out *ComponentReleaseStatus) { + *out = *in + if in.Releases != nil { + in, out := &in.Releases, &out.Releases + *out = make([]ComponentRelease, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentReleaseStatus. +func (in *ComponentReleaseStatus) DeepCopy() *ComponentReleaseStatus { + if in == nil { + return nil + } + out := new(ComponentReleaseStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DevFlags) DeepCopyInto(out *DevFlags) { *out = *in diff --git a/apis/components/v1alpha1/codeflare_types.go b/apis/components/v1alpha1/codeflare_types.go index 9152db29fd0..115458bf58e 100644 --- a/apis/components/v1alpha1/codeflare_types.go +++ b/apis/components/v1alpha1/codeflare_types.go @@ -30,6 +30,7 @@ const ( // CodeFlareCommonStatus defines the shared observed state of CodeFlare type CodeFlareCommonStatus struct { + common.ComponentReleaseStatus `json:",inline"` } // CodeFlareStatus defines the observed state of CodeFlare @@ -70,6 +71,12 @@ func (c *CodeFlare) GetStatus() *common.Status { return &c.Status.Status } +func (c *CodeFlare) GetReleaseStatus() *[]common.ComponentRelease { return &c.Status.Releases } + +func (c *CodeFlare) SetReleaseStatus(releases []common.ComponentRelease) { + c.Status.Releases = releases +} + func init() { SchemeBuilder.Register(&CodeFlare{}, &CodeFlareList{}) } diff --git a/apis/components/v1alpha1/datasciencepipelines_types.go b/apis/components/v1alpha1/datasciencepipelines_types.go index da10f02cc8c..573d589296e 100644 --- a/apis/components/v1alpha1/datasciencepipelines_types.go +++ b/apis/components/v1alpha1/datasciencepipelines_types.go @@ -55,6 +55,7 @@ type DataSciencePipelinesCommonSpec struct { // DataSciencePipelinesCommonStatus defines the shared observed state of DataSciencePipelines type DataSciencePipelinesCommonStatus struct { + common.ComponentReleaseStatus `json:",inline"` } // DataSciencePipelinesStatus defines the observed state of DataSciencePipelines @@ -71,6 +72,14 @@ func (c *DataSciencePipelines) GetStatus() *common.Status { return &c.Status.Status } +func (c *DataSciencePipelines) GetReleaseStatus() *[]common.ComponentRelease { + return &c.Status.Releases +} + +func (c *DataSciencePipelines) SetReleaseStatus(releases []common.ComponentRelease) { + c.Status.Releases = releases +} + // +kubebuilder:object:root=true // DataSciencePipelinesList contains a list of DataSciencePipelines diff --git a/apis/components/v1alpha1/kserve_types.go b/apis/components/v1alpha1/kserve_types.go index b69d88aed83..e34e0d42494 100644 --- a/apis/components/v1alpha1/kserve_types.go +++ b/apis/components/v1alpha1/kserve_types.go @@ -76,7 +76,8 @@ type KserveSpec struct { type KserveCommonStatus struct { // DefaultDeploymentMode is the value of the defaultDeploymentMode field // as read from the "deploy" JSON in the inferenceservice-config ConfigMap - DefaultDeploymentMode string `json:"defaultDeploymentMode,omitempty"` + DefaultDeploymentMode string `json:"defaultDeploymentMode,omitempty"` + common.ComponentReleaseStatus `json:",inline"` } // KserveStatus defines the observed state of Kserve @@ -109,6 +110,14 @@ func (c *Kserve) GetStatus() *common.Status { return &c.Status.Status } +func (c *Kserve) GetReleaseStatus() *[]common.ComponentRelease { + return &c.Status.Releases +} + +func (c *Kserve) SetReleaseStatus(releases []common.ComponentRelease) { + c.Status.Releases = releases +} + // +kubebuilder:object:root=true // KserveList contains a list of Kserve diff --git a/apis/components/v1alpha1/kueue_types.go b/apis/components/v1alpha1/kueue_types.go index e0be9ff57ac..293847f8d4a 100644 --- a/apis/components/v1alpha1/kueue_types.go +++ b/apis/components/v1alpha1/kueue_types.go @@ -57,6 +57,7 @@ type KueueCommonSpec struct { // KueueCommonStatus defines the shared observed state of Kueue type KueueCommonStatus struct { + common.ComponentReleaseStatus `json:",inline"` } // KueueStatus defines the observed state of Kueue @@ -80,10 +81,17 @@ func init() { func (c *Kueue) GetDevFlags() *common.DevFlags { return c.Spec.DevFlags } + func (c *Kueue) GetStatus() *common.Status { return &c.Status.Status } +func (c *Kueue) GetReleaseStatus() *[]common.ComponentRelease { return &c.Status.Releases } + +func (c *Kueue) SetReleaseStatus(releases []common.ComponentRelease) { + c.Status.Releases = releases +} + // DSCKueue contains all the configuration exposed in DSC instance for Kueue component type DSCKueue struct { common.ManagementSpec `json:",inline"` diff --git a/apis/components/v1alpha1/modelmeshserving_types.go b/apis/components/v1alpha1/modelmeshserving_types.go index e28649a417c..3a4b36ce7c1 100644 --- a/apis/components/v1alpha1/modelmeshserving_types.go +++ b/apis/components/v1alpha1/modelmeshserving_types.go @@ -57,6 +57,7 @@ type ModelMeshServingCommonSpec struct { // ModelMeshServingCommonStatus defines the shared observed state of ModelMeshServing type ModelMeshServingCommonStatus struct { + common.ComponentReleaseStatus `json:",inline"` } // ModelMeshServingStatus defines the observed state of ModelMeshServing @@ -80,10 +81,19 @@ func init() { func (c *ModelMeshServing) GetDevFlags() *common.DevFlags { return c.Spec.DevFlags } + func (c *ModelMeshServing) GetStatus() *common.Status { return &c.Status.Status } +func (c *ModelMeshServing) GetReleaseStatus() *[]common.ComponentRelease { + return &c.Status.Releases +} + +func (c *ModelMeshServing) SetReleaseStatus(releases []common.ComponentRelease) { + c.Status.Releases = releases +} + // DSCModelMeshServing contains all the configuration exposed in DSC instance for ModelMeshServing component type DSCModelMeshServing struct { common.ManagementSpec `json:",inline"` diff --git a/apis/components/v1alpha1/modelregistry_types.go b/apis/components/v1alpha1/modelregistry_types.go index 0d653b7d355..e7d6850ed44 100644 --- a/apis/components/v1alpha1/modelregistry_types.go +++ b/apis/components/v1alpha1/modelregistry_types.go @@ -50,7 +50,8 @@ type ModelRegistrySpec struct { // ModelRegistryCommonStatus defines the shared observed state of ModelRegistry type ModelRegistryCommonStatus struct { - RegistriesNamespace string `json:"registriesNamespace,omitempty"` + RegistriesNamespace string `json:"registriesNamespace,omitempty"` + common.ComponentReleaseStatus `json:",inline"` } // ModelRegistryStatus defines the observed state of ModelRegistry @@ -83,6 +84,14 @@ func (c *ModelRegistry) GetStatus() *common.Status { return &c.Status.Status } +func (c *ModelRegistry) GetReleaseStatus() *[]common.ComponentRelease { + return &c.Status.Releases +} + +func (c *ModelRegistry) SetReleaseStatus(releases []common.ComponentRelease) { + c.Status.Releases = releases +} + // +kubebuilder:object:root=true // ModelRegistryList contains a list of ModelRegistry diff --git a/apis/components/v1alpha1/ray_types.go b/apis/components/v1alpha1/ray_types.go index a51c29e3cd4..5ade60220eb 100644 --- a/apis/components/v1alpha1/ray_types.go +++ b/apis/components/v1alpha1/ray_types.go @@ -57,6 +57,7 @@ type RayCommonSpec struct { // RayCommonStatus defines the shared observed state of Ray type RayCommonStatus struct { + common.ComponentReleaseStatus `json:",inline"` } // RayStatus defines the observed state of Ray @@ -80,10 +81,17 @@ func init() { func (c *Ray) GetDevFlags() *common.DevFlags { return c.Spec.DevFlags } + func (c *Ray) GetStatus() *common.Status { return &c.Status.Status } +func (c *Ray) GetReleaseStatus() *[]common.ComponentRelease { return &c.Status.Releases } + +func (c *Ray) SetReleaseStatus(releases []common.ComponentRelease) { + c.Status.Releases = releases +} + // DSCRay contains all the configuration exposed in DSC instance for Ray component type DSCRay struct { common.ManagementSpec `json:",inline"` diff --git a/apis/components/v1alpha1/trainingoperator_types.go b/apis/components/v1alpha1/trainingoperator_types.go index 2d76ca78e6e..fad8d455034 100644 --- a/apis/components/v1alpha1/trainingoperator_types.go +++ b/apis/components/v1alpha1/trainingoperator_types.go @@ -57,6 +57,7 @@ type TrainingOperatorCommonSpec struct { // TrainingOperatorCommonStatus defines the shared observed state of TrainingOperator type TrainingOperatorCommonStatus struct { + common.ComponentReleaseStatus `json:",inline"` } // TrainingOperatorStatus defines the observed state of TrainingOperator @@ -80,10 +81,19 @@ func init() { func (c *TrainingOperator) GetDevFlags() *common.DevFlags { return c.Spec.DevFlags } + func (c *TrainingOperator) GetStatus() *common.Status { return &c.Status.Status } +func (c *TrainingOperator) GetReleaseStatus() *[]common.ComponentRelease { + return &c.Status.Releases +} + +func (c *TrainingOperator) SetReleaseStatus(releases []common.ComponentRelease) { + c.Status.Releases = releases +} + // DSCTrainingOperator contains all the configuration exposed in DSC instance for TrainingOperator component type DSCTrainingOperator struct { common.ManagementSpec `json:",inline"` diff --git a/apis/components/v1alpha1/trustyai_types.go b/apis/components/v1alpha1/trustyai_types.go index 9ac2652fcc1..20819c7606b 100644 --- a/apis/components/v1alpha1/trustyai_types.go +++ b/apis/components/v1alpha1/trustyai_types.go @@ -57,6 +57,7 @@ type TrustyAICommonSpec struct { // TrustyAICommonStatus defines the shared observed state of TrustyAI type TrustyAICommonStatus struct { + common.ComponentReleaseStatus `json:",inline"` } // TrustyAIStatus defines the observed state of TrustyAI @@ -80,10 +81,17 @@ func init() { func (c *TrustyAI) GetDevFlags() *common.DevFlags { return c.Spec.DevFlags } + func (c *TrustyAI) GetStatus() *common.Status { return &c.Status.Status } +func (c *TrustyAI) GetReleaseStatus() *[]common.ComponentRelease { return &c.Status.Releases } + +func (c *TrustyAI) SetReleaseStatus(releases []common.ComponentRelease) { + c.Status.Releases = releases +} + // DSCTrustyAI contains all the configuration exposed in DSC instance for TrustyAI component type DSCTrustyAI struct { common.ManagementSpec `json:",inline"` diff --git a/apis/components/v1alpha1/workbenches_types.go b/apis/components/v1alpha1/workbenches_types.go index 4ea01ce7bbc..f1a831ef6be 100644 --- a/apis/components/v1alpha1/workbenches_types.go +++ b/apis/components/v1alpha1/workbenches_types.go @@ -44,6 +44,7 @@ type WorkbenchesSpec struct { // WorkbenchesCommonStatus defines the shared observed state of Workbenches type WorkbenchesCommonStatus struct { + common.ComponentReleaseStatus `json:",inline"` } // WorkbenchesStatus defines the observed state of Workbenches @@ -76,6 +77,12 @@ func (c *Workbenches) GetStatus() *common.Status { return &c.Status.Status } +func (c *Workbenches) GetReleaseStatus() *[]common.ComponentRelease { return &c.Status.Releases } + +func (c *Workbenches) SetReleaseStatus(releases []common.ComponentRelease) { + c.Status.Releases = releases +} + // +kubebuilder:object:root=true // WorkbenchesList contains a list of Workbenches diff --git a/apis/components/v1alpha1/zz_generated.deepcopy.go b/apis/components/v1alpha1/zz_generated.deepcopy.go index b88eff6bed0..08377a59287 100644 --- a/apis/components/v1alpha1/zz_generated.deepcopy.go +++ b/apis/components/v1alpha1/zz_generated.deepcopy.go @@ -70,6 +70,7 @@ func (in *CodeFlareCommonSpec) DeepCopy() *CodeFlareCommonSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CodeFlareCommonStatus) DeepCopyInto(out *CodeFlareCommonStatus) { *out = *in + in.ComponentReleaseStatus.DeepCopyInto(&out.ComponentReleaseStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CodeFlareCommonStatus. @@ -134,7 +135,7 @@ func (in *CodeFlareSpec) DeepCopy() *CodeFlareSpec { func (in *CodeFlareStatus) DeepCopyInto(out *CodeFlareStatus) { *out = *in in.Status.DeepCopyInto(&out.Status) - out.CodeFlareCommonStatus = in.CodeFlareCommonStatus + in.CodeFlareCommonStatus.DeepCopyInto(&out.CodeFlareCommonStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CodeFlareStatus. @@ -171,7 +172,7 @@ func (in *DSCCodeFlareStatus) DeepCopyInto(out *DSCCodeFlareStatus) { if in.CodeFlareCommonStatus != nil { in, out := &in.CodeFlareCommonStatus, &out.CodeFlareCommonStatus *out = new(CodeFlareCommonStatus) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -247,7 +248,7 @@ func (in *DSCDataSciencePipelinesStatus) DeepCopyInto(out *DSCDataSciencePipelin if in.DataSciencePipelinesCommonStatus != nil { in, out := &in.DataSciencePipelinesCommonStatus, &out.DataSciencePipelinesCommonStatus *out = new(DataSciencePipelinesCommonStatus) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -323,7 +324,7 @@ func (in *DSCKserveStatus) DeepCopyInto(out *DSCKserveStatus) { if in.KserveCommonStatus != nil { in, out := &in.KserveCommonStatus, &out.KserveCommonStatus *out = new(KserveCommonStatus) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -361,7 +362,7 @@ func (in *DSCKueueStatus) DeepCopyInto(out *DSCKueueStatus) { if in.KueueCommonStatus != nil { in, out := &in.KueueCommonStatus, &out.KueueCommonStatus *out = new(KueueCommonStatus) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -399,7 +400,7 @@ func (in *DSCModelMeshServingStatus) DeepCopyInto(out *DSCModelMeshServingStatus if in.ModelMeshServingCommonStatus != nil { in, out := &in.ModelMeshServingCommonStatus, &out.ModelMeshServingCommonStatus *out = new(ModelMeshServingCommonStatus) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -437,7 +438,7 @@ func (in *DSCModelRegistryStatus) DeepCopyInto(out *DSCModelRegistryStatus) { if in.ModelRegistryCommonStatus != nil { in, out := &in.ModelRegistryCommonStatus, &out.ModelRegistryCommonStatus *out = new(ModelRegistryCommonStatus) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -475,7 +476,7 @@ func (in *DSCRayStatus) DeepCopyInto(out *DSCRayStatus) { if in.RayCommonStatus != nil { in, out := &in.RayCommonStatus, &out.RayCommonStatus *out = new(RayCommonStatus) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -513,7 +514,7 @@ func (in *DSCTrainingOperatorStatus) DeepCopyInto(out *DSCTrainingOperatorStatus if in.TrainingOperatorCommonStatus != nil { in, out := &in.TrainingOperatorCommonStatus, &out.TrainingOperatorCommonStatus *out = new(TrainingOperatorCommonStatus) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -551,7 +552,7 @@ func (in *DSCTrustyAIStatus) DeepCopyInto(out *DSCTrustyAIStatus) { if in.TrustyAICommonStatus != nil { in, out := &in.TrustyAICommonStatus, &out.TrustyAICommonStatus *out = new(TrustyAICommonStatus) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -589,7 +590,7 @@ func (in *DSCWorkbenchesStatus) DeepCopyInto(out *DSCWorkbenchesStatus) { if in.WorkbenchesCommonStatus != nil { in, out := &in.WorkbenchesCommonStatus, &out.WorkbenchesCommonStatus *out = new(WorkbenchesCommonStatus) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -772,6 +773,7 @@ func (in *DataSciencePipelinesCommonSpec) DeepCopy() *DataSciencePipelinesCommon // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DataSciencePipelinesCommonStatus) DeepCopyInto(out *DataSciencePipelinesCommonStatus) { *out = *in + in.ComponentReleaseStatus.DeepCopyInto(&out.ComponentReleaseStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataSciencePipelinesCommonStatus. @@ -836,7 +838,7 @@ func (in *DataSciencePipelinesSpec) DeepCopy() *DataSciencePipelinesSpec { func (in *DataSciencePipelinesStatus) DeepCopyInto(out *DataSciencePipelinesStatus) { *out = *in in.Status.DeepCopyInto(&out.Status) - out.DataSciencePipelinesCommonStatus = in.DataSciencePipelinesCommonStatus + in.DataSciencePipelinesCommonStatus.DeepCopyInto(&out.DataSciencePipelinesCommonStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataSciencePipelinesStatus. @@ -1020,6 +1022,7 @@ func (in *KserveCommonSpec) DeepCopy() *KserveCommonSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KserveCommonStatus) DeepCopyInto(out *KserveCommonStatus) { *out = *in + in.ComponentReleaseStatus.DeepCopyInto(&out.ComponentReleaseStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KserveCommonStatus. @@ -1084,7 +1087,7 @@ func (in *KserveSpec) DeepCopy() *KserveSpec { func (in *KserveStatus) DeepCopyInto(out *KserveStatus) { *out = *in in.Status.DeepCopyInto(&out.Status) - out.KserveCommonStatus = in.KserveCommonStatus + in.KserveCommonStatus.DeepCopyInto(&out.KserveCommonStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KserveStatus. @@ -1143,6 +1146,7 @@ func (in *KueueCommonSpec) DeepCopy() *KueueCommonSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KueueCommonStatus) DeepCopyInto(out *KueueCommonStatus) { *out = *in + in.ComponentReleaseStatus.DeepCopyInto(&out.ComponentReleaseStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KueueCommonStatus. @@ -1207,7 +1211,7 @@ func (in *KueueSpec) DeepCopy() *KueueSpec { func (in *KueueStatus) DeepCopyInto(out *KueueStatus) { *out = *in in.Status.DeepCopyInto(&out.Status) - out.KueueCommonStatus = in.KueueCommonStatus + in.KueueCommonStatus.DeepCopyInto(&out.KueueCommonStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KueueStatus. @@ -1399,6 +1403,7 @@ func (in *ModelMeshServingCommonSpec) DeepCopy() *ModelMeshServingCommonSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ModelMeshServingCommonStatus) DeepCopyInto(out *ModelMeshServingCommonStatus) { *out = *in + in.ComponentReleaseStatus.DeepCopyInto(&out.ComponentReleaseStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModelMeshServingCommonStatus. @@ -1463,7 +1468,7 @@ func (in *ModelMeshServingSpec) DeepCopy() *ModelMeshServingSpec { func (in *ModelMeshServingStatus) DeepCopyInto(out *ModelMeshServingStatus) { *out = *in in.Status.DeepCopyInto(&out.Status) - out.ModelMeshServingCommonStatus = in.ModelMeshServingCommonStatus + in.ModelMeshServingCommonStatus.DeepCopyInto(&out.ModelMeshServingCommonStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModelMeshServingStatus. @@ -1522,6 +1527,7 @@ func (in *ModelRegistryCommonSpec) DeepCopy() *ModelRegistryCommonSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ModelRegistryCommonStatus) DeepCopyInto(out *ModelRegistryCommonStatus) { *out = *in + in.ComponentReleaseStatus.DeepCopyInto(&out.ComponentReleaseStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModelRegistryCommonStatus. @@ -1586,7 +1592,7 @@ func (in *ModelRegistrySpec) DeepCopy() *ModelRegistrySpec { func (in *ModelRegistryStatus) DeepCopyInto(out *ModelRegistryStatus) { *out = *in in.Status.DeepCopyInto(&out.Status) - out.ModelRegistryCommonStatus = in.ModelRegistryCommonStatus + in.ModelRegistryCommonStatus.DeepCopyInto(&out.ModelRegistryCommonStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModelRegistryStatus. @@ -1660,6 +1666,7 @@ func (in *RayCommonSpec) DeepCopy() *RayCommonSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RayCommonStatus) DeepCopyInto(out *RayCommonStatus) { *out = *in + in.ComponentReleaseStatus.DeepCopyInto(&out.ComponentReleaseStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RayCommonStatus. @@ -1724,7 +1731,7 @@ func (in *RaySpec) DeepCopy() *RaySpec { func (in *RayStatus) DeepCopyInto(out *RayStatus) { *out = *in in.Status.DeepCopyInto(&out.Status) - out.RayCommonStatus = in.RayCommonStatus + in.RayCommonStatus.DeepCopyInto(&out.RayCommonStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RayStatus. @@ -1783,6 +1790,7 @@ func (in *TrainingOperatorCommonSpec) DeepCopy() *TrainingOperatorCommonSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TrainingOperatorCommonStatus) DeepCopyInto(out *TrainingOperatorCommonStatus) { *out = *in + in.ComponentReleaseStatus.DeepCopyInto(&out.ComponentReleaseStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrainingOperatorCommonStatus. @@ -1847,7 +1855,7 @@ func (in *TrainingOperatorSpec) DeepCopy() *TrainingOperatorSpec { func (in *TrainingOperatorStatus) DeepCopyInto(out *TrainingOperatorStatus) { *out = *in in.Status.DeepCopyInto(&out.Status) - out.TrainingOperatorCommonStatus = in.TrainingOperatorCommonStatus + in.TrainingOperatorCommonStatus.DeepCopyInto(&out.TrainingOperatorCommonStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrainingOperatorStatus. @@ -1906,6 +1914,7 @@ func (in *TrustyAICommonSpec) DeepCopy() *TrustyAICommonSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TrustyAICommonStatus) DeepCopyInto(out *TrustyAICommonStatus) { *out = *in + in.ComponentReleaseStatus.DeepCopyInto(&out.ComponentReleaseStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrustyAICommonStatus. @@ -1970,7 +1979,7 @@ func (in *TrustyAISpec) DeepCopy() *TrustyAISpec { func (in *TrustyAIStatus) DeepCopyInto(out *TrustyAIStatus) { *out = *in in.Status.DeepCopyInto(&out.Status) - out.TrustyAICommonStatus = in.TrustyAICommonStatus + in.TrustyAICommonStatus.DeepCopyInto(&out.TrustyAICommonStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrustyAIStatus. @@ -2029,6 +2038,7 @@ func (in *WorkbenchesCommonSpec) DeepCopy() *WorkbenchesCommonSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WorkbenchesCommonStatus) DeepCopyInto(out *WorkbenchesCommonStatus) { *out = *in + in.ComponentReleaseStatus.DeepCopyInto(&out.ComponentReleaseStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkbenchesCommonStatus. @@ -2093,7 +2103,7 @@ func (in *WorkbenchesSpec) DeepCopy() *WorkbenchesSpec { func (in *WorkbenchesStatus) DeepCopyInto(out *WorkbenchesStatus) { *out = *in in.Status.DeepCopyInto(&out.Status) - out.WorkbenchesCommonStatus = in.WorkbenchesCommonStatus + in.WorkbenchesCommonStatus.DeepCopyInto(&out.WorkbenchesCommonStatus) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkbenchesStatus. diff --git a/bundle/manifests/components.platform.opendatahub.io_codeflares.yaml b/bundle/manifests/components.platform.opendatahub.io_codeflares.yaml index caec1b33965..7995ead3d6b 100644 --- a/bundle/manifests/components.platform.opendatahub.io_codeflares.yaml +++ b/bundle/manifests/components.platform.opendatahub.io_codeflares.yaml @@ -141,6 +141,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/bundle/manifests/components.platform.opendatahub.io_datasciencepipelines.yaml b/bundle/manifests/components.platform.opendatahub.io_datasciencepipelines.yaml index 458b38f5e52..06183b22cd1 100644 --- a/bundle/manifests/components.platform.opendatahub.io_datasciencepipelines.yaml +++ b/bundle/manifests/components.platform.opendatahub.io_datasciencepipelines.yaml @@ -144,6 +144,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/bundle/manifests/components.platform.opendatahub.io_kserves.yaml b/bundle/manifests/components.platform.opendatahub.io_kserves.yaml index 92ac4530345..64318eeb43b 100644 --- a/bundle/manifests/components.platform.opendatahub.io_kserves.yaml +++ b/bundle/manifests/components.platform.opendatahub.io_kserves.yaml @@ -226,6 +226,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/bundle/manifests/components.platform.opendatahub.io_kueues.yaml b/bundle/manifests/components.platform.opendatahub.io_kueues.yaml index 87ada19027e..da3eb090038 100644 --- a/bundle/manifests/components.platform.opendatahub.io_kueues.yaml +++ b/bundle/manifests/components.platform.opendatahub.io_kueues.yaml @@ -142,6 +142,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/bundle/manifests/components.platform.opendatahub.io_modelmeshservings.yaml b/bundle/manifests/components.platform.opendatahub.io_modelmeshservings.yaml index a9be9f4a080..70f710d90d0 100644 --- a/bundle/manifests/components.platform.opendatahub.io_modelmeshservings.yaml +++ b/bundle/manifests/components.platform.opendatahub.io_modelmeshservings.yaml @@ -142,6 +142,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/bundle/manifests/components.platform.opendatahub.io_modelregistries.yaml b/bundle/manifests/components.platform.opendatahub.io_modelregistries.yaml index d23f767edc4..47623b5ff19 100644 --- a/bundle/manifests/components.platform.opendatahub.io_modelregistries.yaml +++ b/bundle/manifests/components.platform.opendatahub.io_modelregistries.yaml @@ -151,6 +151,24 @@ spec: type: string registriesNamespace: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/bundle/manifests/components.platform.opendatahub.io_rays.yaml b/bundle/manifests/components.platform.opendatahub.io_rays.yaml index e1073bed74b..8d750669660 100644 --- a/bundle/manifests/components.platform.opendatahub.io_rays.yaml +++ b/bundle/manifests/components.platform.opendatahub.io_rays.yaml @@ -142,6 +142,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/bundle/manifests/components.platform.opendatahub.io_trainingoperators.yaml b/bundle/manifests/components.platform.opendatahub.io_trainingoperators.yaml index 7dc395ac2b1..0a688a7f32b 100644 --- a/bundle/manifests/components.platform.opendatahub.io_trainingoperators.yaml +++ b/bundle/manifests/components.platform.opendatahub.io_trainingoperators.yaml @@ -142,6 +142,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/bundle/manifests/components.platform.opendatahub.io_trustyais.yaml b/bundle/manifests/components.platform.opendatahub.io_trustyais.yaml index 522954961fe..b2f0a9be3d2 100644 --- a/bundle/manifests/components.platform.opendatahub.io_trustyais.yaml +++ b/bundle/manifests/components.platform.opendatahub.io_trustyais.yaml @@ -142,6 +142,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/bundle/manifests/components.platform.opendatahub.io_workbenches.yaml b/bundle/manifests/components.platform.opendatahub.io_workbenches.yaml index d75be60e4af..dbc84e062e7 100644 --- a/bundle/manifests/components.platform.opendatahub.io_workbenches.yaml +++ b/bundle/manifests/components.platform.opendatahub.io_workbenches.yaml @@ -142,6 +142,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/bundle/manifests/datasciencecluster.opendatahub.io_datascienceclusters.yaml b/bundle/manifests/datasciencecluster.opendatahub.io_datascienceclusters.yaml index 5a5f7499c7c..07eeaca555a 100644 --- a/bundle/manifests/datasciencecluster.opendatahub.io_datascienceclusters.yaml +++ b/bundle/manifests/datasciencecluster.opendatahub.io_datascienceclusters.yaml @@ -722,6 +722,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object dashboard: description: Dashboard component status. @@ -760,6 +778,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object feastoperator: description: Feast Operator component status. @@ -801,6 +837,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object kueue: description: Kueue component status. @@ -819,6 +873,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object modelmeshserving: description: ModelMeshServing component status. @@ -837,6 +909,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object modelregistry: description: ModelRegistry component status. @@ -857,6 +947,24 @@ spec: type: string registriesNamespace: type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object ray: description: Ray component status. @@ -875,6 +983,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object trainingoperator: description: Training Operator component status. @@ -893,6 +1019,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object trustyai: description: TrustyAI component status. @@ -911,6 +1055,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object workbenches: description: Workbenches component status. @@ -929,6 +1091,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object conditions: diff --git a/bundle/manifests/opendatahub-operator.clusterserviceversion.yaml b/bundle/manifests/opendatahub-operator.clusterserviceversion.yaml index 124ae992416..b9372060dbe 100644 --- a/bundle/manifests/opendatahub-operator.clusterserviceversion.yaml +++ b/bundle/manifests/opendatahub-operator.clusterserviceversion.yaml @@ -1312,7 +1312,7 @@ spec: value: /opt/manifests - name: ODH_PLATFORM_TYPE value: OpenDataHub - image: REPLACE_IMAGE:latest + image: quay.io/ugiordan/opendatahub-operator:v2.18.0-versions-mapping imagePullPolicy: Always livenessProbe: httpGet: diff --git a/config/crd/bases/components.platform.opendatahub.io_codeflares.yaml b/config/crd/bases/components.platform.opendatahub.io_codeflares.yaml index 999e5ccfdd4..0f2db738a8a 100644 --- a/config/crd/bases/components.platform.opendatahub.io_codeflares.yaml +++ b/config/crd/bases/components.platform.opendatahub.io_codeflares.yaml @@ -141,6 +141,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/config/crd/bases/components.platform.opendatahub.io_datasciencepipelines.yaml b/config/crd/bases/components.platform.opendatahub.io_datasciencepipelines.yaml index 495d178bb28..6d1cdfdd595 100644 --- a/config/crd/bases/components.platform.opendatahub.io_datasciencepipelines.yaml +++ b/config/crd/bases/components.platform.opendatahub.io_datasciencepipelines.yaml @@ -144,6 +144,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/config/crd/bases/components.platform.opendatahub.io_kserves.yaml b/config/crd/bases/components.platform.opendatahub.io_kserves.yaml index c64e35fe0ee..0fc7868d935 100644 --- a/config/crd/bases/components.platform.opendatahub.io_kserves.yaml +++ b/config/crd/bases/components.platform.opendatahub.io_kserves.yaml @@ -226,6 +226,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/config/crd/bases/components.platform.opendatahub.io_kueues.yaml b/config/crd/bases/components.platform.opendatahub.io_kueues.yaml index 1232c4dcadb..f08bb145c78 100644 --- a/config/crd/bases/components.platform.opendatahub.io_kueues.yaml +++ b/config/crd/bases/components.platform.opendatahub.io_kueues.yaml @@ -142,6 +142,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/config/crd/bases/components.platform.opendatahub.io_modelmeshservings.yaml b/config/crd/bases/components.platform.opendatahub.io_modelmeshservings.yaml index 8a8b82f876f..4f32879a4eb 100644 --- a/config/crd/bases/components.platform.opendatahub.io_modelmeshservings.yaml +++ b/config/crd/bases/components.platform.opendatahub.io_modelmeshservings.yaml @@ -142,6 +142,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/config/crd/bases/components.platform.opendatahub.io_modelregistries.yaml b/config/crd/bases/components.platform.opendatahub.io_modelregistries.yaml index 8f538fe5810..6af9651e65d 100644 --- a/config/crd/bases/components.platform.opendatahub.io_modelregistries.yaml +++ b/config/crd/bases/components.platform.opendatahub.io_modelregistries.yaml @@ -151,6 +151,24 @@ spec: type: string registriesNamespace: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/config/crd/bases/components.platform.opendatahub.io_rays.yaml b/config/crd/bases/components.platform.opendatahub.io_rays.yaml index 92f3b3c62c3..87800e47be3 100644 --- a/config/crd/bases/components.platform.opendatahub.io_rays.yaml +++ b/config/crd/bases/components.platform.opendatahub.io_rays.yaml @@ -142,6 +142,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/config/crd/bases/components.platform.opendatahub.io_trainingoperators.yaml b/config/crd/bases/components.platform.opendatahub.io_trainingoperators.yaml index 82b7262849b..0f20c208900 100644 --- a/config/crd/bases/components.platform.opendatahub.io_trainingoperators.yaml +++ b/config/crd/bases/components.platform.opendatahub.io_trainingoperators.yaml @@ -142,6 +142,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/config/crd/bases/components.platform.opendatahub.io_trustyais.yaml b/config/crd/bases/components.platform.opendatahub.io_trustyais.yaml index 10f42dfb24e..e82b0fd5f11 100644 --- a/config/crd/bases/components.platform.opendatahub.io_trustyais.yaml +++ b/config/crd/bases/components.platform.opendatahub.io_trustyais.yaml @@ -142,6 +142,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/config/crd/bases/components.platform.opendatahub.io_workbenches.yaml b/config/crd/bases/components.platform.opendatahub.io_workbenches.yaml index e928970082d..077400bcf35 100644 --- a/config/crd/bases/components.platform.opendatahub.io_workbenches.yaml +++ b/config/crd/bases/components.platform.opendatahub.io_workbenches.yaml @@ -142,6 +142,24 @@ spec: type: integer phase: type: string + releases: + items: + description: ComponentRelease represents the detailed status of + a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object x-kubernetes-validations: diff --git a/config/crd/bases/datasciencecluster.opendatahub.io_datascienceclusters.yaml b/config/crd/bases/datasciencecluster.opendatahub.io_datascienceclusters.yaml index 44ab31d6e55..f46c7c8f0d4 100644 --- a/config/crd/bases/datasciencecluster.opendatahub.io_datascienceclusters.yaml +++ b/config/crd/bases/datasciencecluster.opendatahub.io_datascienceclusters.yaml @@ -722,6 +722,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object dashboard: description: Dashboard component status. @@ -760,6 +778,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object feastoperator: description: Feast Operator component status. @@ -801,6 +837,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object kueue: description: Kueue component status. @@ -819,6 +873,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object modelmeshserving: description: ModelMeshServing component status. @@ -837,6 +909,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object modelregistry: description: ModelRegistry component status. @@ -857,6 +947,24 @@ spec: type: string registriesNamespace: type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object ray: description: Ray component status. @@ -875,6 +983,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object trainingoperator: description: Training Operator component status. @@ -893,6 +1019,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object trustyai: description: TrustyAI component status. @@ -911,6 +1055,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object workbenches: description: Workbenches component status. @@ -929,6 +1091,24 @@ spec: - Removed pattern: ^(Managed|Unmanaged|Force|Removed)$ type: string + releases: + items: + description: ComponentRelease represents the detailed status + of a component release. + properties: + name: + type: string + repoUrl: + type: string + version: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object conditions: diff --git a/controllers/components/codeflare/codeflare_controller.go b/controllers/components/codeflare/codeflare_controller.go index f46f5effac6..6969db01d3a 100644 --- a/controllers/components/codeflare/codeflare_controller.go +++ b/controllers/components/codeflare/codeflare_controller.go @@ -30,6 +30,7 @@ import ( "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/deploy" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/gc" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/render/kustomize" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/status/releases" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/updatestatus" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/handlers" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/predicates/component" @@ -67,6 +68,7 @@ func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl. // Add CodeFlare-specific actions WithAction(initialize). WithAction(devFlags). + WithAction(releases.NewAction()). WithAction(kustomize.NewAction( kustomize.WithCache(), kustomize.WithLabel(labels.ODH.Component(LegacyComponentName), labels.True), diff --git a/controllers/components/datasciencepipelines/datasciencepipelines_controller.go b/controllers/components/datasciencepipelines/datasciencepipelines_controller.go index 12db851377b..e3a426ba3ad 100644 --- a/controllers/components/datasciencepipelines/datasciencepipelines_controller.go +++ b/controllers/components/datasciencepipelines/datasciencepipelines_controller.go @@ -31,6 +31,7 @@ import ( "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/deploy" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/gc" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/render/kustomize" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/status/releases" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/updatestatus" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/handlers" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/predicates/component" @@ -64,6 +65,7 @@ func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl. WithAction(checkPreConditions). WithAction(initialize). WithAction(devFlags). + WithAction(releases.NewAction()). WithAction(kustomize.NewAction( kustomize.WithCache(), kustomize.WithLabel(labels.ODH.Component(LegacyComponentName), labels.True), diff --git a/controllers/components/kserve/kserve_controller.go b/controllers/components/kserve/kserve_controller.go index 7f4df4bdad7..4202b4599cb 100644 --- a/controllers/components/kserve/kserve_controller.go +++ b/controllers/components/kserve/kserve_controller.go @@ -38,6 +38,7 @@ import ( "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/deploy" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/gc" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/render/kustomize" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/status/releases" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/updatestatus" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/handlers" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/predicates" @@ -151,6 +152,7 @@ func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl. WithAction(checkPreConditions). WithAction(initialize). WithAction(devFlags). + WithAction(releases.NewAction()). WithAction(removeLegacyFeatureTrackerOwnerRef). WithAction(configureServerless). WithAction(configureServiceMesh). diff --git a/controllers/components/kueue/kueue_controller.go b/controllers/components/kueue/kueue_controller.go index d9ec73c56de..5566fef2e72 100644 --- a/controllers/components/kueue/kueue_controller.go +++ b/controllers/components/kueue/kueue_controller.go @@ -35,6 +35,7 @@ import ( "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/deploy" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/gc" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/render/kustomize" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/status/releases" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/updatestatus" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/handlers" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/predicates/component" @@ -76,6 +77,7 @@ func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl. // Add Kueue-specific actions WithAction(initialize). WithAction(devFlags). + WithAction(releases.NewAction()). WithAction(kustomize.NewAction( kustomize.WithCache(), kustomize.WithLabel(labels.ODH.Component(LegacyComponentName), labels.True), diff --git a/controllers/components/modelmeshserving/modelmeshserving_controller.go b/controllers/components/modelmeshserving/modelmeshserving_controller.go index 04fd1686cde..516f7466319 100644 --- a/controllers/components/modelmeshserving/modelmeshserving_controller.go +++ b/controllers/components/modelmeshserving/modelmeshserving_controller.go @@ -34,6 +34,7 @@ import ( "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/deploy" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/gc" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/render/kustomize" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/status/releases" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/updatestatus" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/handlers" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/predicates/clusterrole" @@ -85,6 +86,7 @@ func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl. // Add ModelMeshServing specific actions WithAction(initialize). WithAction(devFlags). + WithAction(releases.NewAction()). WithAction(kustomize.NewAction( kustomize.WithCache(), kustomize.WithLabel(labels.ODH.Component(LegacyComponentName), labels.True), diff --git a/controllers/components/modelregistry/modelregistry_controller.go b/controllers/components/modelregistry/modelregistry_controller.go index 800ef932028..9ae46c52ee8 100644 --- a/controllers/components/modelregistry/modelregistry_controller.go +++ b/controllers/components/modelregistry/modelregistry_controller.go @@ -34,6 +34,7 @@ import ( "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/gc" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/render/kustomize" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/render/template" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/status/releases" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/updatestatus" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/handlers" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/predicates/component" @@ -82,6 +83,7 @@ func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl. // actions WithAction(checkPreConditions). WithAction(initialize). + WithAction(releases.NewAction()). WithAction(configureDependencies). WithAction(template.NewAction( template.WithCache(), diff --git a/controllers/components/ray/ray_controller.go b/controllers/components/ray/ray_controller.go index adc4ad65271..48eca16ad83 100644 --- a/controllers/components/ray/ray_controller.go +++ b/controllers/components/ray/ray_controller.go @@ -30,6 +30,7 @@ import ( "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/deploy" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/gc" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/render/kustomize" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/status/releases" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/updatestatus" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/handlers" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/predicates/component" @@ -60,6 +61,7 @@ func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl. // Add Ray-specific actions WithAction(initialize). WithAction(devFlags). + WithAction(releases.NewAction()). WithAction(kustomize.NewAction( kustomize.WithCache(), kustomize.WithLabel(labels.ODH.Component(LegacyComponentName), labels.True), diff --git a/controllers/components/trainingoperator/trainingoperator_controller.go b/controllers/components/trainingoperator/trainingoperator_controller.go index 096ef8a5198..6e5ceecfd10 100644 --- a/controllers/components/trainingoperator/trainingoperator_controller.go +++ b/controllers/components/trainingoperator/trainingoperator_controller.go @@ -30,6 +30,7 @@ import ( "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/deploy" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/gc" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/render/kustomize" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/status/releases" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/updatestatus" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/handlers" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/predicates/component" @@ -57,6 +58,7 @@ func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl. // Add TrainingOperator-specific actions WithAction(initialize). WithAction(devFlags). + WithAction(releases.NewAction()). WithAction(kustomize.NewAction( kustomize.WithCache(), kustomize.WithLabel(labels.ODH.Component(LegacyComponentName), labels.True), diff --git a/controllers/components/trustyai/trustyai_controller.go b/controllers/components/trustyai/trustyai_controller.go index e77bdd151de..32147fc9993 100644 --- a/controllers/components/trustyai/trustyai_controller.go +++ b/controllers/components/trustyai/trustyai_controller.go @@ -29,6 +29,7 @@ import ( "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/deploy" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/gc" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/render/kustomize" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/status/releases" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/updatestatus" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/handlers" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/predicates/component" @@ -58,6 +59,7 @@ func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl. // Add TrustyAI-specific actions WithAction(initialize). WithAction(devFlags). + WithAction(releases.NewAction()). WithAction(kustomize.NewAction( kustomize.WithCache(), kustomize.WithLabel(labels.ODH.Component(LegacyComponentName), labels.True), diff --git a/controllers/components/workbenches/workbenches_controller.go b/controllers/components/workbenches/workbenches_controller.go index 0a790c2ab81..f63238893bc 100644 --- a/controllers/components/workbenches/workbenches_controller.go +++ b/controllers/components/workbenches/workbenches_controller.go @@ -18,6 +18,7 @@ package workbenches import ( "context" + "path" admissionregistrationv1 "k8s.io/api/admissionregistration/v1" appsv1 "k8s.io/api/apps/v1" @@ -30,11 +31,13 @@ import ( "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/deploy" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/gc" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/render/kustomize" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/status/releases" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/updatestatus" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/handlers" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/predicates/component" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/predicates/resources" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/reconciler" + odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/labels" ) @@ -60,6 +63,9 @@ func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl. ). WithAction(initialize). WithAction(devFlags). + WithAction(releases.NewAction( + releases.WithMetadataFilePath( + path.Join(odhdeploy.DefaultManifestPath, ComponentName, kfNotebookControllerPath, releases.ComponentMetadataFilename)))). WithAction(configureDependencies). WithAction(kustomize.NewAction( kustomize.WithCache(), diff --git a/docs/api-overview.md b/docs/api-overview.md index bd3d57ec89f..626b577cd35 100644 --- a/docs/api-overview.md +++ b/docs/api-overview.md @@ -92,6 +92,9 @@ _Appears in:_ - [CodeFlareStatus](#codeflarestatus) - [DSCCodeFlareStatus](#dsccodeflarestatus) +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### CodeFlareList @@ -146,6 +149,7 @@ _Appears in:_ | `phase` _string_ | | | | | `observedGeneration` _integer_ | | | | | `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#condition-v1-meta) array_ | | | | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### DSCCodeFlare @@ -710,6 +714,9 @@ _Appears in:_ - [DSCDataSciencePipelinesStatus](#dscdatasciencepipelinesstatus) - [DataSciencePipelinesStatus](#datasciencepipelinesstatus) +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### DataSciencePipelinesList @@ -764,6 +771,7 @@ _Appears in:_ | `phase` _string_ | | | | | `observedGeneration` _integer_ | | | | | `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#condition-v1-meta) array_ | | | | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### DefaultDeploymentMode @@ -950,6 +958,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | | `defaultDeploymentMode` _string_ | DefaultDeploymentMode is the value of the defaultDeploymentMode field
as read from the "deploy" JSON in the inferenceservice-config ConfigMap | | | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### KserveList @@ -1008,6 +1017,7 @@ _Appears in:_ | `observedGeneration` _integer_ | | | | | `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#condition-v1-meta) array_ | | | | | `defaultDeploymentMode` _string_ | DefaultDeploymentMode is the value of the defaultDeploymentMode field
as read from the "deploy" JSON in the inferenceservice-config ConfigMap | | | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### Kueue @@ -1061,6 +1071,9 @@ _Appears in:_ - [DSCKueueStatus](#dsckueuestatus) - [KueueStatus](#kueuestatus) +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### KueueList @@ -1115,6 +1128,7 @@ _Appears in:_ | `phase` _string_ | | | | | `observedGeneration` _integer_ | | | | | `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#condition-v1-meta) array_ | | | | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### ModelController @@ -1280,6 +1294,9 @@ _Appears in:_ - [DSCModelMeshServingStatus](#dscmodelmeshservingstatus) - [ModelMeshServingStatus](#modelmeshservingstatus) +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### ModelMeshServingList @@ -1334,6 +1351,7 @@ _Appears in:_ | `phase` _string_ | | | | | `observedGeneration` _integer_ | | | | | `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#condition-v1-meta) array_ | | | | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### ModelRegistry @@ -1391,6 +1409,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | | `registriesNamespace` _string_ | | | | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### ModelRegistryList @@ -1447,6 +1466,7 @@ _Appears in:_ | `observedGeneration` _integer_ | | | | | `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#condition-v1-meta) array_ | | | | | `registriesNamespace` _string_ | | | | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### NimSpec @@ -1519,6 +1539,9 @@ _Appears in:_ - [DSCRayStatus](#dscraystatus) - [RayStatus](#raystatus) +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### RayList @@ -1573,6 +1596,7 @@ _Appears in:_ | `phase` _string_ | | | | | `observedGeneration` _integer_ | | | | | `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#condition-v1-meta) array_ | | | | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### TrainingOperator @@ -1626,6 +1650,9 @@ _Appears in:_ - [DSCTrainingOperatorStatus](#dsctrainingoperatorstatus) - [TrainingOperatorStatus](#trainingoperatorstatus) +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### TrainingOperatorList @@ -1680,6 +1707,7 @@ _Appears in:_ | `phase` _string_ | | | | | `observedGeneration` _integer_ | | | | | `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#condition-v1-meta) array_ | | | | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### TrustyAI @@ -1733,6 +1761,9 @@ _Appears in:_ - [DSCTrustyAIStatus](#dsctrustyaistatus) - [TrustyAIStatus](#trustyaistatus) +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### TrustyAIList @@ -1787,6 +1818,7 @@ _Appears in:_ | `phase` _string_ | | | | | `observedGeneration` _integer_ | | | | | `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#condition-v1-meta) array_ | | | | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### Workbenches @@ -1840,6 +1872,9 @@ _Appears in:_ - [DSCWorkbenchesStatus](#dscworkbenchesstatus) - [WorkbenchesStatus](#workbenchesstatus) +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | #### WorkbenchesList @@ -1894,6 +1929,7 @@ _Appears in:_ | `phase` _string_ | | | | | `observedGeneration` _integer_ | | | | | `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#condition-v1-meta) array_ | | | | +| `releases` _[ComponentRelease](#componentrelease) array_ | | | | diff --git a/pkg/controller/actions/status/releases/action_fetch_releases_status.go b/pkg/controller/actions/status/releases/action_fetch_releases_status.go new file mode 100644 index 00000000000..d4a7f84ab58 --- /dev/null +++ b/pkg/controller/actions/status/releases/action_fetch_releases_status.go @@ -0,0 +1,151 @@ +package releases + +import ( + "context" + "encoding/json" + "fmt" + "os" + "path/filepath" + "strings" + + logf "sigs.k8s.io/controller-runtime/pkg/log" + + "github.com/opendatahub-io/opendatahub-operator/v2/apis/common" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/types" + odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/resources" +) + +const ( + ComponentMetadataFilename = "component_metadata.yaml" +) + +type Action struct { + metadataFilePath string + componentReleaseStatus []common.ComponentRelease +} + +// WithMetadataFilePath is an ActionOpts function that sets a custom metadata file path. +func WithMetadataFilePath(filePath string) ActionOpts { + return func(a *Action) { + a.metadataFilePath = filePath + } +} + +// WithComponentReleaseStatus allows setting a custom ComponentRelease for the action. +// This is mostly for testing purposes to simulate cached or pre-existing release statuses. +// In production scenarios, the action should fetch the current release status from the source rather than being manually set. +func WithComponentReleaseStatus(status []common.ComponentRelease) ActionOpts { + return func(a *Action) { + a.componentReleaseStatus = status + } +} + +type ActionOpts func(*Action) + +// run is responsible for executing the logic of reconciling and processing component releases. +// +// This function performs the following: +// 1. Verifies that the resource instance implements the `WithReleases` interface. +// 2. If the release status is not already cached, it calls the `render` method to fetch the releases from the metadata file. +// 3. Updates the release status on the resource instance with the processed release information. +// +// Parameters: +// - ctx: The context for managing deadlines and cancellations during the reconciliation process. +// - rr: The `ReconciliationRequest` containing the resource instance that needs to be reconciled. +// +// Returns: +// - An error if the reconciliation fails at any step. This could occur if the resource doesn't implement the required interface +// or if the metadata file cannot be read or processed. +func (a *Action) run(ctx context.Context, rr *types.ReconciliationRequest) error { + // Ensure the resource implements the WithReleases interface + obj, ok := rr.Instance.(common.WithReleases) + if !ok { + return fmt.Errorf("resource instance %v is not a WithReleases", rr.Instance) + } + + // If the release status is empty, or if the DevFlags.Manifests is set, render the release information. + // This ensures that releases are either reprocessed or fetched from the manifests specified in DevFlags. + if len(a.componentReleaseStatus) == 0 || resources.InstanceHasDevFlags(rr.Instance) { + releases, err := a.render(ctx, rr) + if err != nil { + return err + } + a.componentReleaseStatus = releases + } + + // Update the release status in the resource + obj.SetReleaseStatus(a.componentReleaseStatus) + + return nil +} + +// render reads and processes the component releases from the metadata file. +// +// This function performs the following: +// 1. Reads the component metadata YAML file (either from a custom or default path). +// 2. Parses the YAML file and extracts the release metadata (name, version, repo URL). +// 3. Returns a slice of `ComponentRelease` containing the processed release information. +// +// Parameters: +// - rr: The `ReconciliationRequest` containing the resource instance. This is used to determine the metadata file path. +// +// Returns: +// - A slice of `common.ComponentRelease`, representing the parsed release information from the metadata file. +// - An error if there is an issue with reading the file, unmarshalling the YAML, or processing the release data. +func (a *Action) render(ctx context.Context, rr *types.ReconciliationRequest) ([]common.ComponentRelease, error) { + log := logf.FromContext(ctx) + + // Determine the metadata file path + var metadataPath string + if a.metadataFilePath != "" { + metadataPath = a.metadataFilePath + } else { + // Build the path to the component metadata file + controllerName := strings.ToLower(rr.Instance.GetObjectKind().GroupVersionKind().Kind) + metadataPath = filepath.Join(odhdeploy.DefaultManifestPath, controllerName, ComponentMetadataFilename) + } + + // Read the YAML file + yamlData, err := os.ReadFile(metadataPath) + if err != nil { + if os.IsNotExist(err) { + // Log a message indicating the file doesn't exist but do not return an error + // Log this as a warning, as it's not necessarily a failure if the file is absent + log.V(3).Info("Metadata file not found, proceeding with empty releases", "metadataFilePath", metadataPath) + // Return an empty slice of releases instead of an error + return nil, nil + } + return nil, fmt.Errorf("error reading metadata file: %w", err) + } + + // Unmarshal YAML into defined struct + var componentMeta common.ComponentReleaseStatus + if err := json.Unmarshal(yamlData, &componentMeta); err != nil { + return nil, fmt.Errorf("error unmarshaling YAML: %w", err) + } + + // Parse and populate releases + componentReleasesStatus := make([]common.ComponentRelease, 0, len(componentMeta.Releases)) + for _, release := range componentMeta.Releases { + componentVersion := strings.TrimSpace(release.Version) + componentReleasesStatus = append(componentReleasesStatus, common.ComponentRelease{ + Name: release.Name, + Version: componentVersion, + RepoURL: release.RepoURL, + }) + } + + return componentReleasesStatus, nil +} + +func NewAction(opts ...ActionOpts) actions.Fn { + action := Action{} + + for _, opt := range opts { + opt(&action) + } + + return action.run +} diff --git a/pkg/controller/actions/status/releases/action_fetch_releases_status_test.go b/pkg/controller/actions/status/releases/action_fetch_releases_status_test.go new file mode 100644 index 00000000000..b274ea06f8a --- /dev/null +++ b/pkg/controller/actions/status/releases/action_fetch_releases_status_test.go @@ -0,0 +1,210 @@ +package releases_test + +import ( + "context" + "os" + "path/filepath" + "testing" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/opendatahub-io/opendatahub-operator/v2/apis/common" + componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/actions/status/releases" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/types" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestFetchReleasesStatusAction(t *testing.T) { + t.Helper() + + g := NewWithT(t) + ctx := context.Background() + + // Root directory for temporary test files + tempDir := filepath.Join(os.TempDir(), "releases_test") + + // Clean up created files after each test + AfterEach(func() { + // Remove the temporary test files + err := os.RemoveAll(tempDir) + Expect(err).NotTo(HaveOccurred()) + }) + + // Define a test cases + tests := []struct { + name string + metadataFilePath string + metadataContent string + expectedReleases int + expectedError bool + devFlagsEnabled bool + providedStatus []common.ComponentRelease // Provided ReleaseStatus for testing cache behavior + }{ + { + name: "should successfully render releases from valid YAML", + metadataFilePath: filepath.Join(tempDir, "valid_file.yaml"), + metadataContent: ` +releases: + - name: Kubeflow Pipelines + version: 2.2.0 + repoUrl: https://github.com/kubeflow/kfp-tekton + - name: Another Component + version: 1.3.1 + repoUrl: https://example.com/repo +`, + expectedReleases: 2, + expectedError: false, + }, + { + name: "should handle empty metadata file and return empty releases", + metadataFilePath: filepath.Join(tempDir, "empty_file.yaml"), + metadataContent: "", + expectedReleases: 0, + expectedError: false, + }, + { + name: "should fail if YAML is invalid and return empty releases", + metadataFilePath: filepath.Join(tempDir, "invalid_file.yaml"), + metadataContent: ` +releases: + - name: Kubeflow Pipelines + versionNumber: 2.2.0 + repoUrl: https://github.com/kubeflow/kfp-tekton +`, + expectedReleases: 0, + expectedError: true, + }, + { + name: "should handle empty metadata file path gracefully", + metadataFilePath: "", + metadataContent: "", + expectedReleases: 0, + expectedError: false, + }, + { + name: "should not re-render releases if cached", + metadataFilePath: filepath.Join(tempDir, "cached_file.yaml"), + metadataContent: ` +releases: + - name: Kubeflow Pipelines + version: 2.2.0 + repoUrl: https://github.com/kubeflow/kfp-tekton +`, + expectedReleases: 1, + expectedError: false, + providedStatus: []common.ComponentRelease{ + { // Simulating cached status + Name: "Kubeflow Pipelines", + Version: "0.0.0", + RepoURL: "https://github.com/kubeflow/kfp-tekton", + }, + }, + }, + { + name: "should re-render releases if DevFlags are enabled", + metadataFilePath: filepath.Join(tempDir, "dev_flags_enabled_file.yaml"), + metadataContent: ` +releases: + - name: Kubeflow Pipelines + version: 2.2.0 + repoUrl: https://github.com/kubeflow/kfp-tekton +`, + expectedReleases: 1, + expectedError: false, + devFlagsEnabled: true, + providedStatus: []common.ComponentRelease{ + { // Simulating cached status + Name: "Kubeflow Pipelines", + Version: "0.0.0", + RepoURL: "https://github.com/kubeflow/kfp-tekton", + }, + }, + }, + } + + // Iterate through all test cases + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Create the mock metadata file if needed + if tt.metadataContent != "" && tt.metadataFilePath != "" { + // Ensure the directory exists + err := os.MkdirAll(filepath.Dir(tt.metadataFilePath), 0755) + if err != nil { + t.Fatalf("failed to create directories: %v", err) + } + + // Write the test metadata content to the mock file + err = os.WriteFile(tt.metadataFilePath, []byte(tt.metadataContent), 0600) + if err != nil { + t.Fatalf("failed to write file: %v", err) + } + } + + // Mocking DevFlags if enabled (if DevFlagsEnabled is true, simulate dev flags) + devFlagsSpec := common.DevFlagsSpec{} + if tt.devFlagsEnabled { + devFlagsSpec.DevFlags = &common.DevFlags{ + Manifests: []common.ManifestsConfig{{URI: "github.com/kubeflow/kfp-tekton"}}, + } + } + + // Create the ReconciliationRequest and set a dummy resource instance + rr := types.ReconciliationRequest{ + Instance: &componentApi.DataSciencePipelines{ + ObjectMeta: metav1.ObjectMeta{ + Name: "mock-instance", + }, + + // Mocking DevFlags if enabled (if DevFlagsEnabled is true, simulate dev flags) + Spec: componentApi.DataSciencePipelinesSpec{ + DataSciencePipelinesCommonSpec: componentApi.DataSciencePipelinesCommonSpec{ + DevFlagsSpec: devFlagsSpec, + }, + }, + }, + } + + // Check the number of componentReleases set on the instance + withReleasesInstance, ok := rr.Instance.(common.WithReleases) + if !ok { + t.Fatalf("Instance does not implement WithReleases") + } + + // Set up the action with the custom metadata file path and provided status + action := releases.NewAction( + releases.WithMetadataFilePath(tt.metadataFilePath), + releases.WithComponentReleaseStatus(tt.providedStatus), // Use WithComponentReleaseStatus to set the provided status + ) + + // Run the render action + err := action(ctx, &rr) + + // Validate results + if tt.expectedError { + g.Expect(err).To(HaveOccurred()) + } else { + g.Expect(err).NotTo(HaveOccurred()) + } + + // Get release status after action + finalReleases := withReleasesInstance.GetReleaseStatus() + + // Verify that the status is updated based on the caching and DevFlags + if tt.providedStatus != nil { + if tt.devFlagsEnabled { + // DevFlags are enabled, expect re-render (new version) + g.Expect(*finalReleases).NotTo(Equal(tt.providedStatus)) + } else { + // Cache is available, no DevFlags, expect no re-render (cached version) + g.Expect(*finalReleases).To(Equal(tt.providedStatus)) + } + } + + // Validate the expected release count after action + g.Expect(*finalReleases).To(HaveLen(tt.expectedReleases)) + }) + } +} diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go index 72ddd91622d..05b3d1354a3 100644 --- a/pkg/resources/resources.go +++ b/pkg/resources/resources.go @@ -323,6 +323,16 @@ func HasDevFlags(in common.WithDevFlags) bool { return df != nil && len(df.Manifests) != 0 } +// InstanceHasDevFlags checks if the given PlatformObject implements the WithDevFlags interface +// and if it has any DevFlags set. If the object does not implement WithDevFlags, it returns false. +// This function helps ensure that only objects with the WithDevFlags interface are processed for DevFlags. +func InstanceHasDevFlags(in common.PlatformObject) bool { + if obj, ok := in.(common.WithDevFlags); ok { + return HasDevFlags(obj) + } + return false +} + func NamespacedNameFromObject(obj client.Object) types.NamespacedName { return types.NamespacedName{ Namespace: obj.GetNamespace(), diff --git a/tests/e2e/codeflare_test.go b/tests/e2e/codeflare_test.go index 26781260463..ce3f8e47eeb 100644 --- a/tests/e2e/codeflare_test.go +++ b/tests/e2e/codeflare_test.go @@ -22,6 +22,7 @@ func codeflareTestSuite(t *testing.T) { t.Run("Validate operands have OwnerReferences", componentCtx.ValidateOperandsOwnerReferences) t.Run("Validate update operand resources", componentCtx.ValidateUpdateDeploymentsResources) t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled) + t.Run("Validate component releases", componentCtx.ValidateComponentReleases) } type CodeFlareTestCtx struct { diff --git a/tests/e2e/components_test.go b/tests/e2e/components_test.go index c7f37290d1a..4077b55c810 100644 --- a/tests/e2e/components_test.go +++ b/tests/e2e/components_test.go @@ -260,6 +260,46 @@ func (c *ComponentTestCtx) ValidateCRDReinstated(t *testing.T, name string) { ) } +// Validate releases for any component in the DataScienceCluster. +func (c *ComponentTestCtx) ValidateComponentReleases(t *testing.T) { + t.Helper() + + g := c.NewWithT(t) + + componentName := strings.ToLower(c.GVK.Kind) + + // Transform the DataScienceCluster to set the management state of the component + g.Update( + gvk.DataScienceCluster, + c.DSCName, + testf.Transform( + `.spec.components.%s.managementState = "%s"`, componentName, operatorv1.Managed, + ), + ).Eventually().Should( + jq.Match(`.spec.components.%s.managementState == "%s"`, componentName, operatorv1.Managed), + ) + + // Check if the releases field contains multiple releases for the component + g.List(gvk.DataScienceCluster).Eventually().Should(And( + HaveLen(1), + HaveEach( + // Check releases for the component itself + jq.Match(`.status.components.%s.releases | length > 0`, componentName), + ), + )) + + // Validate each release's fields (name, version, repoUrl) using HaveEach + g.List(gvk.DataScienceCluster).Eventually().Should(And( + HaveLen(1), + HaveEach(And( + // Check that each release has the required fields (name, version, repoUrl) + jq.Match(`.status.components.%s.releases[].name != ""`, componentName), + jq.Match(`.status.components.%s.releases[].version != ""`, componentName), + jq.Match(`.status.components.%s.releases[].repoUrl != ""`, componentName)), + ), + )) +} + func (c *ComponentTestCtx) GetDSC() (*dscv1.DataScienceCluster, error) { obj := dscv1.DataScienceCluster{} diff --git a/tests/e2e/datasciencepipelines_test.go b/tests/e2e/datasciencepipelines_test.go index dda8186938f..62abd8ffbed 100644 --- a/tests/e2e/datasciencepipelines_test.go +++ b/tests/e2e/datasciencepipelines_test.go @@ -22,6 +22,7 @@ func dataSciencePipelinesTestSuite(t *testing.T) { t.Run("Validate operands have OwnerReferences", componentCtx.ValidateOperandsOwnerReferences) t.Run("Validate update operand resources", componentCtx.ValidateUpdateDeploymentsResources) t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled) + t.Run("Validate component releases", componentCtx.ValidateComponentReleases) } type DataSciencePipelinesTestCtx struct { diff --git a/tests/e2e/kserve_test.go b/tests/e2e/kserve_test.go index aa12f85a4d1..3fec9048f9d 100644 --- a/tests/e2e/kserve_test.go +++ b/tests/e2e/kserve_test.go @@ -47,6 +47,7 @@ func kserveTestSuite(t *testing.T) { t.Run("Validate default certs", componentCtx.validateDefaultCertsAvailable) t.Run("Validate update operand resources", componentCtx.ValidateUpdateDeploymentsResources) t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled) + t.Run("Validate component releases", componentCtx.ValidateComponentReleases) } type KserveTestCtx struct { diff --git a/tests/e2e/kueue_test.go b/tests/e2e/kueue_test.go index 4fb42093059..1cddd874a64 100644 --- a/tests/e2e/kueue_test.go +++ b/tests/e2e/kueue_test.go @@ -32,6 +32,7 @@ func kueueTestSuite(t *testing.T) { t.Run("Validate Kueue Dynamically create VAP and VAPB", componentCtx.validateKueueVAPReady) t.Run("Validate CRDs reinstated", componentCtx.validateCRDReinstated) t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled) + t.Run("Validate component releases", componentCtx.ValidateComponentReleases) } type KueueTestCtx struct { diff --git a/tests/e2e/modelmeshserving_test.go b/tests/e2e/modelmeshserving_test.go index 005db8ff03a..7a723f3b1cd 100644 --- a/tests/e2e/modelmeshserving_test.go +++ b/tests/e2e/modelmeshserving_test.go @@ -29,6 +29,7 @@ func modelMeshServingTestSuite(t *testing.T) { t.Run("Validate operands have OwnerReferences", componentCtx.ValidateOperandsOwnerReferences) t.Run("Validate update operand resources", componentCtx.ValidateUpdateDeploymentsResources) t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled) + t.Run("Validate component releases", componentCtx.ValidateComponentReleases) } type ModelMeshServingTestCtx struct { diff --git a/tests/e2e/modelregistry_test.go b/tests/e2e/modelregistry_test.go index 413226ef94a..e5241e70819 100644 --- a/tests/e2e/modelregistry_test.go +++ b/tests/e2e/modelregistry_test.go @@ -48,6 +48,7 @@ func modelRegistryTestSuite(t *testing.T) { t.Run("Validate ServiceMeshMember", componentCtx.validateModelRegistryServiceMeshMember) t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled) + t.Run("Validate component releases", componentCtx.ValidateComponentReleases) } func (c *ModelRegistryTestCtx) validateSpec(t *testing.T) { diff --git a/tests/e2e/ray_test.go b/tests/e2e/ray_test.go index d56b0309c61..f666d6f25c7 100644 --- a/tests/e2e/ray_test.go +++ b/tests/e2e/ray_test.go @@ -22,6 +22,7 @@ func rayTestSuite(t *testing.T) { t.Run("Validate operands have OwnerReferences", componentCtx.ValidateOperandsOwnerReferences) t.Run("Validate update operand resources", componentCtx.ValidateUpdateDeploymentsResources) t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled) + t.Run("Validate component releases", componentCtx.ValidateComponentReleases) } type RayTestCtx struct { diff --git a/tests/e2e/trainingoperator_test.go b/tests/e2e/trainingoperator_test.go index d1b4eca9367..823db746e5f 100644 --- a/tests/e2e/trainingoperator_test.go +++ b/tests/e2e/trainingoperator_test.go @@ -22,6 +22,7 @@ func trainingOperatorTestSuite(t *testing.T) { t.Run("Validate operands have OwnerReferences", componentCtx.ValidateOperandsOwnerReferences) t.Run("Validate update operand resources", componentCtx.ValidateUpdateDeploymentsResources) t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled) + t.Run("Validate component releases", componentCtx.ValidateComponentReleases) } type TrainingOperatorTestCtx struct { diff --git a/tests/e2e/trustyai_test.go b/tests/e2e/trustyai_test.go index 7d9b4d9094f..2ddb58ec83b 100644 --- a/tests/e2e/trustyai_test.go +++ b/tests/e2e/trustyai_test.go @@ -22,6 +22,7 @@ func trustyAITestSuite(t *testing.T) { t.Run("Validate operands have OwnerReferences", componentCtx.ValidateOperandsOwnerReferences) t.Run("Validate update operand resources", componentCtx.ValidateUpdateDeploymentsResources) t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled) + t.Run("Validate component releases", componentCtx.ValidateComponentReleases) } type TrustyAITestCtx struct {