Skip to content

Commit

Permalink
Fix Kserve Unmanaged Installation (opendatahub-io#860)
Browse files Browse the repository at this point in the history
* Fix Kserve Unmanaged Installation

* Update tests for kserve
  • Loading branch information
VaishnaviHire authored Feb 19, 2024
1 parent e32a7c2 commit b467ed7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
15 changes: 8 additions & 7 deletions components/kserve/kserve.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,8 @@ func (k *Kserve) ReconcileComponent(ctx context.Context, cli client.Client, resC
return err
}
}
// check on dependent operators if all installed in cluster
dependOpsErrors := checkDependentOperators(cli).ErrorOrNil()
if dependOpsErrors != nil {
return dependOpsErrors
}

if err := k.configureServerless(dscispec); err != nil {
if err := k.configureServerless(cli, dscispec); err != nil {
return err
}

Expand Down Expand Up @@ -175,7 +170,7 @@ func (k *Kserve) Cleanup(_ client.Client, instance *dsciv1.DSCInitializationSpec
return k.removeServiceMeshConfigurations(instance)
}

func (k *Kserve) configureServerless(instance *dsciv1.DSCInitializationSpec) error {
func (k *Kserve) configureServerless(cli client.Client, instance *dsciv1.DSCInitializationSpec) error {
switch k.Serving.ManagementState {
case operatorv1.Unmanaged: // Bring your own CR
fmt.Println("Serverless CR is not configured by the operator, we won't do anything")
Expand All @@ -192,6 +187,12 @@ func (k *Kserve) configureServerless(instance *dsciv1.DSCInitializationSpec) err
return fmt.Errorf("ServiceMesh is need to set to 'Managed' in DSCI CR, it is required by KServe serving field")
}

// check on dependent operators if all installed in cluster
dependOpsErrors := checkDependentOperators(cli).ErrorOrNil()
if dependOpsErrors != nil {
return dependOpsErrors
}

serverlessFeatures := feature.ComponentFeaturesHandler(k, instance, k.configureServerlessFeatures())

if err := serverlessFeatures.Apply(); err != nil {
Expand Down
12 changes: 5 additions & 7 deletions tests/e2e/dsc_creation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,12 @@ func (tc *testContext) testAllApplicationCreation(t *testing.T) error { //nolint
// speed testing in parallel
t.Parallel()
err = tc.testApplicationCreation(&(tc.testDsc.Spec.Components.Kserve))
// test Unmanaged state, since servicemesh is not installed.
if tc.testDsc.Spec.Components.Kserve.ManagementState == operatorv1.Managed {
if err != nil {
// depedent operator error, as expected
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())
}
if err != nil && tc.testDsc.Spec.Components.Kserve.Serving.ManagementState == operatorv1.Unmanaged {
require.NoError(t, err, "error validating application %v when enabled", tc.testDsc.Spec.Components.Workbenches.GetComponentName())
} else {
require.NoError(t, err, "error validating application %v when enabled", tc.testDsc.Spec.Components.Kserve.GetComponentName())
}
} else {
require.Error(t, err, "error validating application %v when disabled", tc.testDsc.Spec.Components.Kserve.GetComponentName())
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/opendatahub-io/opendatahub-operator/v2/components/ray"
"github.com/opendatahub-io/opendatahub-operator/v2/components/trustyai"
"github.com/opendatahub-io/opendatahub-operator/v2/components/workbenches"
infrav1 "github.com/opendatahub-io/opendatahub-operator/v2/infrastructure/v1"
)

func (tc *testContext) waitForControllerDeployment(name string, replicas int32) error {
Expand Down Expand Up @@ -108,6 +109,9 @@ func setupDSCInstance(name string) *dsc.DataScienceCluster {
Component: components.Component{
ManagementState: operatorv1.Managed,
},
Serving: infrav1.ServingSpec{
ManagementState: operatorv1.Unmanaged,
},
},
CodeFlare: codeflare.CodeFlare{
Component: components.Component{
Expand Down

0 comments on commit b467ed7

Please sign in to comment.