-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configuration to pipeline stanza of DSC to enable InstructLab pip…
…eline
- Loading branch information
1 parent
46d8ba2
commit 8cc7364
Showing
14 changed files
with
283 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// +kubebuilder:object:generate=true | ||
|
||
// Package datasciencepipelines provides a set of types used for DataSciencePipelines component | ||
package datasciencepipelines | ||
|
||
import operatorv1 "github.com/openshift/api/operator/v1" | ||
|
||
type ManagedPipelinesSpec struct { | ||
// Configures whether to automatically import the InstructLab pipeline. | ||
// You must enable the trainingoperator component to run the InstructLab pipeline. | ||
InstructLab ManagedPipelineOptions `json:"instructLab,omitempty"` | ||
} | ||
|
||
type ManagedPipelineOptions struct { | ||
// Set to one of the following values: | ||
// | ||
// - "Managed" : This pipeline is automatically imported. | ||
// - "Removed" : This pipeline is not automatically imported when a new pipeline server or DSPA is created. If previously set to "Managed", setting to "Removed" does not remove existing preloaded pipelines but does prevent future updates from being imported. | ||
// | ||
// +kubebuilder:validation:Enum=Managed;Removed | ||
// +kubebuilder:default=Removed | ||
State operatorv1.ManagementState `json:"state,omitempty"` | ||
} |
54 changes: 54 additions & 0 deletions
54
apis/components/v1alpha1/datasciencepipelines/zz_generated.deepcopy.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
controllers/components/datasciencepipelines/datasciencepipelines_support_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//nolint:testpackage | ||
package datasciencepipelines | ||
|
||
import ( | ||
"encoding/json" | ||
"testing" | ||
|
||
"github.com/blang/semver/v4" | ||
"github.com/operator-framework/api/pkg/lib/version" | ||
|
||
componentApi "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1" | ||
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1alpha1/datasciencepipelines" | ||
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster" | ||
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/controller/types" | ||
|
||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestComputeParamsMap(t *testing.T) { | ||
g := NewWithT(t) | ||
|
||
dsp := componentApi.DataSciencePipelines{ | ||
Spec: componentApi.DataSciencePipelinesSpec{ | ||
DataSciencePipelinesCommonSpec: componentApi.DataSciencePipelinesCommonSpec{ | ||
PreloadedPipelines: datasciencepipelines.ManagedPipelinesSpec{}, | ||
}, | ||
}, | ||
} | ||
|
||
v := semver.MustParse("1.2.3") | ||
rr := types.ReconciliationRequest{ | ||
Instance: &dsp, | ||
Release: cluster.Release{ | ||
Check failure on line 33 in controllers/components/datasciencepipelines/datasciencepipelines_support_test.go GitHub Actions / Run tests and collect coverage
|
||
Version: version.OperatorVersion{ | ||
Version: v, | ||
}, | ||
}, | ||
} | ||
|
||
result, err := computeParamsMap(&rr) | ||
g.Expect(err).ShouldNot(HaveOccurred()) | ||
g.Expect(result).ShouldNot(BeEmpty()) | ||
|
||
// Marshal the expected value for comparison | ||
expectedData, err := json.Marshal(dsp.Spec.PreloadedPipelines) | ||
g.Expect(err).ShouldNot(HaveOccurred()) | ||
|
||
expectedData, err = json.Marshal(string(expectedData)) | ||
g.Expect(err).ShouldNot(HaveOccurred()) | ||
|
||
g.Expect(result).Should(And( | ||
HaveKeyWithValue(managedPipelineParamsKey, string(expectedData)), | ||
HaveKeyWithValue(platformVersionParamsKey, v.String()), | ||
)) | ||
} |
Oops, something went wrong.