diff --git a/controllers/datasciencecluster/datasciencecluster_controller.go b/controllers/datasciencecluster/datasciencecluster_controller.go index 6ac7aa62496..ba1717ff0d7 100644 --- a/controllers/datasciencecluster/datasciencecluster_controller.go +++ b/controllers/datasciencecluster/datasciencecluster_controller.go @@ -237,7 +237,7 @@ func (r *DataScienceClusterReconciler) reconcileSubComponent(ctx context.Context if managed { message = "Component is enabled" } else if unmanaged { - message = "Component is unmanaged" + message = "Component " + componentName + " is unmanaged" } status.SetComponentCondition(&saved.Status.Conditions, componentName, status.ReconcileInit, message, corev1.ConditionUnknown) }) diff --git a/get_all_manifests.sh b/get_all_manifests.sh index f1ca2b9781a..0e84e925a2e 100755 --- a/get_all_manifests.sh +++ b/get_all_manifests.sh @@ -11,8 +11,10 @@ MANIFESTS_TARBALL_URL="${GITHUB_URL}/${MANIFEST_ORG}/odh-manifests/tarball/${MAN # component: dsp, kserve, dashbaord, cf/ray. in the format of "repo-org:repo-name:branch-name:source-folder:target-folder" # TODO: workbench, modelmesh, monitoring, etc declare -A COMPONENT_MANIFESTS=( - ["codeflare"]="opendatahub-io:codeflare-operator:main:config:codeflare" - ["ray"]="opendatahub-io:kuberay:master:ray-operator/config:ray" + # ["codeflare"]="opendatahub-io:codeflare-operator:main:config:codeflare" + ["codeflare"]="opendatahub-io:distributed-workloads:main:codeflare-stack:codeflare" + #["ray"]="opendatahub-io:kuberay:master:ray-operator/config:ray" + ["ray"]="opendatahub-io:distributed-workloads:main:ray:ray" ["data-science-pipelines-operator"]="opendatahub-io:data-science-pipelines-operator:main:config:data-science-pipelines-operator" ["odh-dashboard"]="opendatahub-io:odh-dashboard:incubation:manifests:odh-dashboard" ["kf-notebook-controller"]="opendatahub-io:kubeflow:v1.7-branch:components/notebook-controller/config:odh-notebook-controller/kf-notebook-controller" diff --git a/tests/e2e/dsc_creation_test.go b/tests/e2e/dsc_creation_test.go index 4be2ecf95e3..e8fece5a92a 100644 --- a/tests/e2e/dsc_creation_test.go +++ b/tests/e2e/dsc_creation_test.go @@ -41,9 +41,9 @@ func creationTestSuite(t *testing.T) { err = testCtx.testUpdateComponentReconcile() require.NoError(t, err, "error testing updates for DSC managed resource") }) - t.Run("Validate Component Enabled field", func(t *testing.T) { + t.Run("Validate Component managementState field", func(t *testing.T) { err = testCtx.testUpdateDSCComponentEnabled() - require.NoError(t, err, "error testing component enabled field") + require.NoError(t, err, "error testing component managementState field") }) }) } @@ -113,11 +113,11 @@ func (tc *testContext) testAllApplicationCreation(t *testing.T) error { err = tc.testApplicationCreation(&(tc.testDsc.Spec.Components.Dashboard)) if tc.testDsc.Spec.Components.Dashboard.ManagementState == operatorv1.Managed { if err != nil { - require.NoError(t, err, "error validating application %v when enabled", tc.testDsc.Spec.Components.Dashboard.GetComponentName()) + require.NoError(t, err, "error validating application %v when Managed", tc.testDsc.Spec.Components.Dashboard.GetComponentName()) } } else { if err == nil { - require.NoError(t, err, "error validating application %v when disabled", tc.testDsc.Spec.Components.Dashboard.GetComponentName()) + require.NoError(t, err, "error validating application %v when Removed", tc.testDsc.Spec.Components.Dashboard.GetComponentName()) } } }) @@ -128,11 +128,11 @@ func (tc *testContext) testAllApplicationCreation(t *testing.T) error { err = tc.testApplicationCreation(&(tc.testDsc.Spec.Components.ModelMeshServing)) if tc.testDsc.Spec.Components.ModelMeshServing.ManagementState == operatorv1.Managed { if err != nil { - require.NoError(t, err, "error validating application %v when enabled", tc.testDsc.Spec.Components.ModelMeshServing.GetComponentName()) + require.NoError(t, err, "error validating application %v when Managed", tc.testDsc.Spec.Components.ModelMeshServing.GetComponentName()) } } else { if err == nil { - require.NoError(t, err, "error validating application %v when disabled", tc.testDsc.Spec.Components.ModelMeshServing.GetComponentName()) + require.NoError(t, err, "error validating application %v when Removed", tc.testDsc.Spec.Components.ModelMeshServing.GetComponentName()) } } }) @@ -147,12 +147,12 @@ func (tc *testContext) testAllApplicationCreation(t *testing.T) error { if strings.Contains(err.Error(), "Please install the operator before enabling component") { t.Logf("expected error: %v", err.Error()) } else { - require.NoError(t, err, "error validating application %v when enabled", tc.testDsc.Spec.Components.Kserve.GetComponentName()) + require.NoError(t, err, "error validating application %v when Managed", tc.testDsc.Spec.Components.Kserve.GetComponentName()) } } } else { if err == nil { - require.NoError(t, err, "error validating application %v when disabled", tc.testDsc.Spec.Components.Kserve.GetComponentName()) + require.NoError(t, err, "error validating application %v when Removed", tc.testDsc.Spec.Components.Kserve.GetComponentName()) } } }) @@ -163,11 +163,11 @@ func (tc *testContext) testAllApplicationCreation(t *testing.T) error { err = tc.testApplicationCreation(&(tc.testDsc.Spec.Components.Workbenches)) if tc.testDsc.Spec.Components.Workbenches.ManagementState == operatorv1.Managed { if err != nil { - require.NoError(t, err, "error validating application %v when enabled", tc.testDsc.Spec.Components.Workbenches.GetComponentName()) + require.NoError(t, err, "error validating application %v when Managed", tc.testDsc.Spec.Components.Workbenches.GetComponentName()) } } else { if err == nil { - require.NoError(t, err, "error validating application %v when disabled", tc.testDsc.Spec.Components.Workbenches.GetComponentName()) + require.NoError(t, err, "error validating application %v when Removed", tc.testDsc.Spec.Components.Workbenches.GetComponentName()) } } }) @@ -178,11 +178,11 @@ func (tc *testContext) testAllApplicationCreation(t *testing.T) error { err = tc.testApplicationCreation(&(tc.testDsc.Spec.Components.DataSciencePipelines)) if tc.testDsc.Spec.Components.DataSciencePipelines.ManagementState == operatorv1.Managed { if err != nil { - require.NoError(t, err, "error validating application %v when enabled", tc.testDsc.Spec.Components.DataSciencePipelines.GetComponentName()) + require.NoError(t, err, "error validating application %v when Managed", tc.testDsc.Spec.Components.DataSciencePipelines.GetComponentName()) } } else { if err == nil { - require.NoError(t, err, "error validating application %v when disabled", tc.testDsc.Spec.Components.DataSciencePipelines.GetComponentName()) + require.NoError(t, err, "error validating application %v when Removed", tc.testDsc.Spec.Components.DataSciencePipelines.GetComponentName()) } } }) @@ -197,12 +197,16 @@ func (tc *testContext) testAllApplicationCreation(t *testing.T) error { if strings.Contains(err.Error(), "Please install the operator before enabling component") { t.Logf("expected error: %v", err.Error()) } else { - require.NoError(t, err, "error validating application %v when enabled", tc.testDsc.Spec.Components.CodeFlare.GetComponentName()) + require.NoError(t, err, "error validating application %v when Managed", tc.testDsc.Spec.Components.CodeFlare.GetComponentName()) } } + } else if tc.testDsc.Spec.Components.CodeFlare.ManagementState == operatorv1.Unmanaged { + if err != nil { + require.NoError(t, err, "error validating application %v when Unmanaged", tc.testDsc.Spec.Components.CodeFlare.GetComponentName()) + } } else { if err == nil { - require.NoError(t, err, "error validating application %v when disabled", tc.testDsc.Spec.Components.CodeFlare.GetComponentName()) + require.NoError(t, err, "error validating application %v when Removed", tc.testDsc.Spec.Components.CodeFlare.GetComponentName()) } } }) @@ -213,11 +217,11 @@ func (tc *testContext) testAllApplicationCreation(t *testing.T) error { err = tc.testApplicationCreation(&(tc.testDsc.Spec.Components.Ray)) if tc.testDsc.Spec.Components.Ray.ManagementState == operatorv1.Managed { if err != nil { - require.NoError(t, err, "error validating application %v when enabled", tc.testDsc.Spec.Components.Ray.GetComponentName()) + require.NoError(t, err, "error validating application %v when Managed", tc.testDsc.Spec.Components.Ray.GetComponentName()) } } else { if err == nil { - require.NoError(t, err, "error validating application %v when disabled", tc.testDsc.Spec.Components.Ray.GetComponentName()) + require.NoError(t, err, "error validating application %v when Removed", tc.testDsc.Spec.Components.Ray.GetComponentName()) } } }) @@ -228,11 +232,11 @@ func (tc *testContext) testAllApplicationCreation(t *testing.T) error { err = tc.testApplicationCreation(&(tc.testDsc.Spec.Components.TrustyAI)) if tc.testDsc.Spec.Components.TrustyAI.ManagementState == operatorv1.Managed { if err != nil { - require.NoError(t, err, "error validating application %v when enabled", tc.testDsc.Spec.Components.TrustyAI.GetComponentName()) + require.NoError(t, err, "error validating application %v when Managed", tc.testDsc.Spec.Components.TrustyAI.GetComponentName()) } } else { if err == nil { - require.NoError(t, err, "error validating application %v when disabled", tc.testDsc.Spec.Components.TrustyAI.GetComponentName()) + require.NoError(t, err, "error validating application %v when Removed", tc.testDsc.Spec.Components.TrustyAI.GetComponentName()) } } }) @@ -270,6 +274,12 @@ func (tc *testContext) testApplicationCreation(component components.ComponentInt return true, err } } + // check component does not create deployment e.g CF + for _, Condition := range tc.testDsc.Status.Conditions { + if strings.Contains(Condition.Message, "Component "+component.GetComponentName()+" is unmanaged") { + return true, err + } + } return false, nil } }) @@ -350,16 +360,16 @@ func (tc *testContext) testUpdateDSCComponentEnabled() error { LabelSelector: "app.kubernetes.io/part-of=" + tc.testDsc.Spec.Components.Dashboard.GetComponentName(), }) if err != nil { - return fmt.Errorf("error getting enabled component %v", tc.testDsc.Spec.Components.Dashboard.GetComponentName()) + return fmt.Errorf("error getting Managed component %v", tc.testDsc.Spec.Components.Dashboard.GetComponentName()) } if len(appDeployments.Items) > 0 { dashboardDeploymentName = appDeployments.Items[0].Name if appDeployments.Items[0].Status.ReadyReplicas == 0 { - return fmt.Errorf("error getting enabled component: %s its deployment 'ReadyReplicas'", dashboardDeploymentName) + return fmt.Errorf("error getting Managed component: %s its deployment 'ReadyReplicas'", dashboardDeploymentName) } } } else { - return fmt.Errorf("dashboard spec should be in 'enabled: true' state in order to perform test") + return fmt.Errorf("dashboard spec should be in 'Managed' state in order to perform test") } // Disable component Dashboard @@ -377,7 +387,7 @@ func (tc *testContext) testUpdateDSCComponentEnabled() error { // Return err itself here (not wrapped inside another error) // so that RetryOnConflict can identify it correctly. if err != nil { - return fmt.Errorf("error updating component from 'enabled: true' to 'enabled: false': %w", err) + return fmt.Errorf("error updating component from 'Managed' to 'Removed: false': %w", err) } return nil }) diff --git a/tests/e2e/helper_test.go b/tests/e2e/helper_test.go index 0deea6889db..03758fb5cb0 100644 --- a/tests/e2e/helper_test.go +++ b/tests/e2e/helper_test.go @@ -82,9 +82,11 @@ func setupDSCInstance() *dsc.DataScienceCluster { ManagementState: operatorv1.Managed, }, }, + // this should not return error from operator but it wont have anythng running + // because we do not pre-install CFO and we set it to be unmanaged CodeFlare: codeflare.CodeFlare{ Component: components.Component{ - ManagementState: operatorv1.Removed, + ManagementState: operatorv1.Unmanaged, }, }, Ray: ray.Ray{