From 9ed9a0b396c8471c5d5bf3727488b86f980802ae Mon Sep 17 00:00:00 2001 From: Vaishnavi Hire Date: Fri, 12 Apr 2024 21:39:11 -0400 Subject: [PATCH 1/4] Add fixes for watch --- controllers/datasciencecluster/datasciencecluster_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/datasciencecluster/datasciencecluster_controller.go b/controllers/datasciencecluster/datasciencecluster_controller.go index 4d66caedb82..e5b004ad4d0 100644 --- a/controllers/datasciencecluster/datasciencecluster_controller.go +++ b/controllers/datasciencecluster/datasciencecluster_controller.go @@ -480,7 +480,7 @@ func (r *DataScienceClusterReconciler) watchDataScienceClusterResources(a client return nil } - if a.GetObjectKind().GroupVersionKind().Kind == "CustomResourceDefinition" { + if a.GetObjectKind().GroupVersionKind().Kind == "CustomResourceDefinition" || a.GetName() == datasciencepipelines.ArgoWorkflowCRD { return []reconcile.Request{{ NamespacedName: types.NamespacedName{Name: requestName}, }} From cc3e2fbed1439ab3253a483198742b43aed98297 Mon Sep 17 00:00:00 2001 From: Wen Zhou Date: Tue, 9 Apr 2024 16:58:03 +0200 Subject: [PATCH 2/4] update(CSV): annontation for features Signed-off-by: Wen Zhou --- bundle/manifests/rhods-operator.clusterserviceversion.yaml | 7 +++++++ .../bases/rhods-operator.clusterserviceversion.yaml | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/bundle/manifests/rhods-operator.clusterserviceversion.yaml b/bundle/manifests/rhods-operator.clusterserviceversion.yaml index a42603a4395..92c37e909aa 100644 --- a/bundle/manifests/rhods-operator.clusterserviceversion.yaml +++ b/bundle/manifests/rhods-operator.clusterserviceversion.yaml @@ -108,6 +108,13 @@ metadata: certified: "False" containerImage: quay.io/opendatahub/opendatahub-operator:v2.0.0 createdAt: "2023-8-23T00:00:00Z" + features.operators.openshift.io/disconnected: "true" + features.operators.openshift.io/fips-compliant: "false" + features.operators.openshift.io/proxy-aware: "false" + features.operators.openshift.io/tls-profiles: "false" + features.operators.openshift.io/token-auth-aws: "false" + features.operators.openshift.io/token-auth-azure: "false" + features.operators.openshift.io/token-auth-gcp: "false" olm.skipRange: '>=1.0.0 <2.0.0' operatorframework.io/initialization-resource: |- { diff --git a/config/manifests/bases/rhods-operator.clusterserviceversion.yaml b/config/manifests/bases/rhods-operator.clusterserviceversion.yaml index 159f47bd1a8..5f616ce4738 100644 --- a/config/manifests/bases/rhods-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/rhods-operator.clusterserviceversion.yaml @@ -8,6 +8,13 @@ metadata: certified: "False" containerImage: quay.io/opendatahub/opendatahub-operator:v2.0.0 createdAt: "2023-8-23T00:00:00Z" + features.operators.openshift.io/disconnected: "true" + features.operators.openshift.io/fips-compliant: "false" + features.operators.openshift.io/proxy-aware: "false" + features.operators.openshift.io/tls-profiles: "false" + features.operators.openshift.io/token-auth-aws: "false" + features.operators.openshift.io/token-auth-azure: "false" + features.operators.openshift.io/token-auth-gcp: "false" olm.skipRange: '>=1.0.0 <2.0.0' operatorframework.io/initialization-resource: |- { From 5760b2a0c57d2f0390cb3b8a7c2d278cccf308e1 Mon Sep 17 00:00:00 2001 From: Wen Zhou Date: Tue, 16 Apr 2024 21:02:10 +0200 Subject: [PATCH 3/4] fix(DSC): when DSC is in Error because of missing DSCI CR (#971) - DSCI creation should trigger watches() and reconcile DSC Signed-off-by: Wen Zhou (cherry picked from commit e97b6ae73e6591920e3b4f0400645c9f0f2553c8) --- .../datasciencecluster_controller.go | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/controllers/datasciencecluster/datasciencecluster_controller.go b/controllers/datasciencecluster/datasciencecluster_controller.go index e5b004ad4d0..60be978948f 100644 --- a/controllers/datasciencecluster/datasciencecluster_controller.go +++ b/controllers/datasciencecluster/datasciencecluster_controller.go @@ -455,7 +455,7 @@ func (r *DataScienceClusterReconciler) SetupWithManager(mgr ctrl.Manager) error Owns(&admv1.MutatingWebhookConfiguration{}). Owns(&admv1.ValidatingWebhookConfiguration{}, builder.WithPredicates(modelMeshwebhookPredicates)). Owns(&corev1.ServiceAccount{}, builder.WithPredicates(saPredicates)). - Watches(&source.Kind{Type: &dsci.DSCInitialization{}}, handler.EnqueueRequestsFromMapFunc(r.watchDataScienceClusterResources)). + Watches(&source.Kind{Type: &dsci.DSCInitialization{}}, handler.EnqueueRequestsFromMapFunc(r.watchDataScienceClusterForDSCI)). Watches(&source.Kind{Type: &corev1.ConfigMap{}}, handler.EnqueueRequestsFromMapFunc(r.watchDataScienceClusterResources), builder.WithPredicates(configMapPredicates)). Watches(&source.Kind{Type: &apiextensionsv1.CustomResourceDefinition{}}, handler.EnqueueRequestsFromMapFunc(r.watchDataScienceClusterResources), builder.WithPredicates(argoWorkflowCRDPredicates)). @@ -464,6 +464,29 @@ func (r *DataScienceClusterReconciler) SetupWithManager(mgr ctrl.Manager) error Complete(r) } +func (r *DataScienceClusterReconciler) watchDataScienceClusterForDSCI(a client.Object) []reconcile.Request { + instanceList := &dsc.DataScienceClusterList{} + err := r.Client.List(context.TODO(), instanceList) + if err != nil { + return nil + } + var requestName string + switch { + case len(instanceList.Items) == 1: + requestName = instanceList.Items[0].Name + case len(instanceList.Items) == 0: + requestName = "default-dsc" + default: + return nil + } + // When DSCI CR gets created, trigger reconcile function + if a.GetObjectKind().GroupVersionKind().Kind == "DSCInitialization" || a.GetName() == "default-dsci" { + return []reconcile.Request{{ + NamespacedName: types.NamespacedName{Name: requestName}, + }} + } + return nil +} func (r *DataScienceClusterReconciler) watchDataScienceClusterResources(a client.Object) []reconcile.Request { instanceList := &dsc.DataScienceClusterList{} err := r.Client.List(context.TODO(), instanceList) @@ -491,7 +514,6 @@ func (r *DataScienceClusterReconciler) watchDataScienceClusterResources(a client if err != nil { return nil } - if a.GetNamespace() == operatorNs { labels := a.GetLabels() if val, ok := labels[upgrade.DeleteConfigMapLabel]; ok && val == "true" { @@ -501,6 +523,14 @@ func (r *DataScienceClusterReconciler) watchDataScienceClusterResources(a client } return nil } + + // Trigger reconcile function when DSCInitialization from Missing to Valid + if a.GetObjectKind().GroupVersionKind().Kind == "DSCInitialization" { + return []reconcile.Request{{ + NamespacedName: types.NamespacedName{Name: requestName}, + }} + } + return nil } From b98201c3d669eedc2700ce195e958949797fba35 Mon Sep 17 00:00:00 2001 From: Vaishnavi Hire Date: Tue, 16 Apr 2024 18:52:53 -0400 Subject: [PATCH 4/4] Update condition to avoid upgrade on reoncile --- .../datasciencecluster_controller.go | 2 +- get_all_manifests.sh | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/controllers/datasciencecluster/datasciencecluster_controller.go b/controllers/datasciencecluster/datasciencecluster_controller.go index 60be978948f..e89958a7813 100644 --- a/controllers/datasciencecluster/datasciencecluster_controller.go +++ b/controllers/datasciencecluster/datasciencecluster_controller.go @@ -214,7 +214,7 @@ func (r *DataScienceClusterReconciler) Reconcile(ctx context.Context, req ctrl.R return ctrl.Result{}, nil } // Check preconditions if this is an upgrade - if instance.Status.Phase == status.PhaseReady { + if instance.Status.Phase == status.PhaseReady || instance.Status.Phase == status.PhaseError { // Check for existence of Argo Workflows if DSP is if instance.Spec.Components.DataSciencePipelines.ManagementState == v1.Managed { if err := datasciencepipelines.UnmanagedArgoWorkFlowExists(ctx, r.Client); err != nil { diff --git a/get_all_manifests.sh b/get_all_manifests.sh index 76ea3f7b666..215911c10e7 100755 --- a/get_all_manifests.sh +++ b/get_all_manifests.sh @@ -8,18 +8,18 @@ MANIFEST_ORG="red-hat-data-services" # component: notebook, dsp, kserve, dashbaord, cf/ray, trustyai, modelmesh. # in the format of "repo-org:repo-name:branch-name:source-folder:target-folder". declare -A COMPONENT_MANIFESTS=( - ["codeflare"]="red-hat-data-services:codeflare-operator:rhoai-2.8:config:codeflare" - ["ray"]="red-hat-data-services:kuberay:rhoai-2.8:ray-operator/config:ray" - ["kueue"]="red-hat-data-services:kueue:rhoai-2.8:config:kueue" - ["data-science-pipelines-operator"]="red-hat-data-services:data-science-pipelines-operator:rhoai-2.8:config:data-science-pipelines-operator" - ["kf-notebook-controller"]="red-hat-data-services:kubeflow:rhoai-2.8:components/notebook-controller/config:odh-notebook-controller/kf-notebook-controller" - ["odh-notebook-controller"]="red-hat-data-services:kubeflow:rhoai-2.8:components/odh-notebook-controller/config:odh-notebook-controller/odh-notebook-controller" - ["notebooks"]="red-hat-data-services:notebooks:rhoai-2.8:manifests:/jupyterhub/notebooks" - ["trustyai"]="red-hat-data-services:trustyai-service-operator:rhoai-2.8:config:trustyai-service-operator" - ["model-mesh"]="red-hat-data-services:modelmesh-serving:rhoai-2.8:config:model-mesh" - ["odh-model-controller"]="red-hat-data-services:odh-model-controller:rhoai-2.8:config:odh-model-controller" - ["kserve"]="red-hat-data-services:kserve:rhoai-2.8:config:kserve" - ["odh-dashboard"]="red-hat-data-services:odh-dashboard:rhoai-2.8:manifests:dashboard" + ["codeflare"]="red-hat-data-services:codeflare-operator:rhoai-2.9:config:codeflare" + ["ray"]="red-hat-data-services:kuberay:rhoai-2.9:ray-operator/config:ray" + ["kueue"]="red-hat-data-services:kueue:rhoai-2.9:config:kueue" + ["data-science-pipelines-operator"]="red-hat-data-services:data-science-pipelines-operator:rhoai-2.9:config:data-science-pipelines-operator" + ["kf-notebook-controller"]="red-hat-data-services:kubeflow:rhoai-2.9:components/notebook-controller/config:odh-notebook-controller/kf-notebook-controller" + ["odh-notebook-controller"]="red-hat-data-services:kubeflow:rhoai-2.9:components/odh-notebook-controller/config:odh-notebook-controller/odh-notebook-controller" + ["notebooks"]="red-hat-data-services:notebooks:rhoai-2.9:manifests:/jupyterhub/notebooks" + ["trustyai"]="red-hat-data-services:trustyai-service-operator:rhoai-2.9:config:trustyai-service-operator" + ["model-mesh"]="red-hat-data-services:modelmesh-serving:rhoai-2.9:config:model-mesh" + ["odh-model-controller"]="red-hat-data-services:odh-model-controller:rhoai-2.9:config:odh-model-controller" + ["kserve"]="red-hat-data-services:kserve:rhoai-2.9:config:kserve" + ["odh-dashboard"]="red-hat-data-services:odh-dashboard:rhoai-2.9:manifests:dashboard" ) # Allow overwriting repo using flags component=repo