Skip to content

Commit

Permalink
fix: added missing dev flags action and remove generic use in controller
Browse files Browse the repository at this point in the history
  • Loading branch information
jackdelahunt committed Nov 5, 2024
1 parent 6e1164c commit c2e67eb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var (
)

func NewComponentReconciler(ctx context.Context, mgr ctrl.Manager) error {
_, err := reconciler.ComponentReconcilerFor[*componentsv1.DataSciencePipelines](
_, err := reconciler.ComponentReconcilerFor(
mgr,
componentsv1.DataSciencePipelinesInstanceName,
&componentsv1.DataSciencePipelines{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package datasciencepipelines
import (
"context"
"fmt"
componentsv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1"

odhtypes "github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/types"
odhdeploy "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
Expand All @@ -37,5 +38,28 @@ func initialize(ctx context.Context, rr *odhtypes.ReconciliationRequest) error {
}

func devFlags(ctx context.Context, rr *odhtypes.ReconciliationRequest) error {
dsp, ok := rr.Instance.(*componentsv1.DataSciencePipelines)
if !ok {
return fmt.Errorf("resource instance %v is not a componentsv1.Ray)", rr.Instance)
}

if dsp.Spec.DevFlags == nil {
return nil
}

// Implement devflags support logic
// If dev flags are set, update default manifests path
if len(dsp.Spec.DevFlags.Manifests) != 0 {
manifestConfig := dsp.Spec.DevFlags.Manifests[0]
if err := odhdeploy.DownloadManifests(ctx, componentsv1.DataSciencePipelinesComponentName, manifestConfig); err != nil {
return err
}
if manifestConfig.SourcePath != "" {
rr.Manifests[0].Path = odhdeploy.DefaultManifestPath
rr.Manifests[0].ContextDir = componentsv1.DataSciencePipelinesComponentName
rr.Manifests[0].SourcePath = manifestConfig.SourcePath
}
}

return nil
}

0 comments on commit c2e67eb

Please sign in to comment.