Skip to content

Commit 22529bb

Browse files
VaniHaripriyamprahl
authored andcommitted
Add ilab kfp pipeline to the DSPO repo
Signed-off-by: VaniHaripriya <[email protected]> Co-authored-by: Matt Prahl <[email protected]>
1 parent fc71e3e commit 22529bb

12 files changed

+95
-28
lines changed

api/v1/dspipeline_types.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,13 @@ type APIServer struct {
6969
// Include sample pipelines with the deployment of this DSP API Server. Default: true
7070
// +kubebuilder:default:=false
7171
// +kubebuilder:validation:Optional
72-
EnableSamplePipeline bool `json:"enableSamplePipeline"`
73-
ArgoLauncherImage string `json:"argoLauncherImage,omitempty"`
74-
ArgoDriverImage string `json:"argoDriverImage,omitempty"`
72+
EnableSamplePipeline bool `json:"enableSamplePipeline"`
73+
// Enable the Instructlab Multi-Phase Training pipeline with the deployment of this DSP API server. Default: false
74+
// +kubebuilder:default:=false
75+
// +kubebuilder:validation:Optional
76+
EnableInstructLabPipeline bool `json:"enableInstructLabPipeline"`
77+
ArgoLauncherImage string `json:"argoLauncherImage,omitempty"`
78+
ArgoDriverImage string `json:"argoDriverImage,omitempty"`
7579
// Specify custom Pod resource requirements for this component.
7680
Resources *ResourceRequirements `json:"resources,omitempty"`
7781

api/v1alpha1/dspipeline_types.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,13 @@ type APIServer struct {
6969
// Include sample pipelines with the deployment of this DSP API Server. Default: true
7070
// +kubebuilder:default:=false
7171
// +kubebuilder:validation:Optional
72-
EnableSamplePipeline bool `json:"enableSamplePipeline"`
73-
ArgoLauncherImage string `json:"argoLauncherImage,omitempty"`
74-
ArgoDriverImage string `json:"argoDriverImage,omitempty"`
72+
EnableSamplePipeline bool `json:"enableSamplePipeline"`
73+
// Enable the Instructlab Multi-Phase Training pipeline with the deployment of this DSP API server. Default: false
74+
// +kubebuilder:default:=false
75+
// +kubebuilder:validation:Optional
76+
EnableInstructLabPipeline bool `json:"enableInstructLabPipeline"`
77+
ArgoLauncherImage string `json:"argoLauncherImage,omitempty"`
78+
ArgoDriverImage string `json:"argoDriverImage,omitempty"`
7579
// Specify custom Pod resource requirements for this component.
7680
Resources *ResourceRequirements `json:"resources,omitempty"`
7781

config/crd/bases/datasciencepipelinesapplications.opendatahub.io_datasciencepipelinesapplications.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ spec:
105105
Server. Setting Deploy to false disables operator reconciliation.
106106
Default: true'
107107
type: boolean
108+
enableInstructLabPipeline:
109+
default: false
110+
description: 'Enable the Instructlab Multi-Phase Training pipeline
111+
with the deployment of this DSP API server. Default: false'
112+
type: boolean
108113
enableOauth:
109114
default: true
110115
description: 'Create an Openshift Route for this DSP API Server.
@@ -990,6 +995,11 @@ spec:
990995
Server. Setting Deploy to false disables operator reconciliation.
991996
Default: true'
992997
type: boolean
998+
enableInstructLabPipeline:
999+
default: false
1000+
description: 'Enable the Instructlab Multi-Phase Training pipeline
1001+
with the deployment of this DSP API server. Default: false'
1002+
type: boolean
9931003
enableOauth:
9941004
default: true
9951005
description: 'Create an Openshift Route for this DSP API Server.

config/internal/apiserver/default/deployment.yaml.tmpl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ spec:
147147
args:
148148
- --config=/config
149149
- -logtostderr=true
150-
{{ if .APIServer.EnableSamplePipeline }}
150+
{{ if or .APIServer.EnableSamplePipeline .APIServer.EnableInstructLabPipeline }}
151151
- --sampleconfig=/config/sample_config.json
152152
{{ end }}
153153
{{ if .PodToPodTLS }}
@@ -206,18 +206,16 @@ spec:
206206
- mountPath: /etc/tls/private
207207
name: proxy-tls
208208
{{ end }}
209-
{{ if or .APIServer.EnableSamplePipeline .CustomCABundle }}
210-
{{ if .APIServer.EnableSamplePipeline }}
209+
{{ if or .APIServer.EnableSamplePipeline .APIServer.EnableInstructLabPipeline}}
211210
- name: sample-config
212211
mountPath: /config/sample_config.json
213212
subPath: sample_config.json
214213
- name: sample-pipeline
215214
mountPath: /samples/
216-
{{ end }}
217-
{{ if .CustomCABundle }}
215+
{{ end }}
216+
{{ if .CustomCABundle }}
218217
- mountPath: {{ .CustomCABundleRootMountPath }}
219218
name: ca-bundle
220-
{{ end }}
221219
{{ end }}
222220
{{ if .APIServer.EnableRoute }}
223221
- name: oauth-proxy
@@ -287,7 +285,7 @@ spec:
287285
configMap:
288286
name: {{ .CustomCABundle.ConfigMapName }}
289287
{{ end }}
290-
{{ if .APIServer.EnableSamplePipeline }}
288+
{{ if or .APIServer.EnableSamplePipeline .APIServer.EnableInstructLabPipeline}}
291289
- name: sample-config
292290
configMap:
293291
name: sample-config-{{.Name}}

config/internal/apiserver/sample-pipeline/sample-config.yaml.tmpl

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,21 @@ metadata:
77
app: {{.APIServerDefaultResourceName}}
88
component: data-science-pipelines
99
data:
10-
sample_config.json: |-
11-
[
12-
{
13-
"name": "[Demo] iris-training",
14-
"description": "[source code](https://github.com/opendatahub-io/data-science-pipelines/tree/master/samples/iris-sklearn) A simple pipeline to demonstrate a basic ML Training workflow",
15-
"file": "/samples/iris-pipeline-compiled.yaml"
16-
}
17-
]
10+
sample_config.json: |-
11+
[
12+
{{- if .EnableSamplePipeline }}
13+
{
14+
"name": "[Demo] iris-training",
15+
"description": "[source code](https://github.com/opendatahub-io/data-science-pipelines/tree/master/samples/iris-sklearn) A simple pipeline to demonstrate a basic ML Training workflow",
16+
"file": "/samples/iris-pipeline-compiled.yaml"
17+
}
18+
{{- if and .EnableSamplePipeline .EnableInstructLabPipeline }},{{ end }}
19+
{{- end }}
20+
{{- if .EnableInstructLabPipeline }}
21+
{
22+
"name": "[InstructLab] Multi-Phase Training Pipeline",
23+
"description": "[source code](https://github.com/opendatahub-io/ilab-on-ocp) Instructlab Multi-Phase Training Pipeline",
24+
"file": "/pipelines/instructlab.yaml"
25+
}
26+
{{- end }}
27+
]

controllers/apiserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (r *DSPAReconciler) ReconcileAPIServer(ctx context.Context, dsp *dspav1.Dat
6868
}
6969

7070
for cmName, template := range samplePipelineTemplates {
71-
if dsp.Spec.APIServer.EnableSamplePipeline {
71+
if dsp.Spec.APIServer.EnableSamplePipeline || dsp.Spec.APIServer.EnableInstructLabPipeline {
7272
err := r.Apply(dsp, params, template)
7373
if err != nil {
7474
return err

controllers/dspipeline_params.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ type DSPAParams struct {
9292
CustomCABundle *dspa.CABundle
9393
DSPONamespace string
9494
// Use to enable tls communication between component pods.
95-
PodToPodTLS bool
96-
97-
APIServerServiceDNSName string
95+
PodToPodTLS bool
96+
EnableSamplePipeline bool
97+
EnableInstructLabPipeline bool
98+
APIServerServiceDNSName string
9899
}
99100

100101
type DBConnection struct {
@@ -601,6 +602,9 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip
601602
setStringDefault(argoDriverImageFromConfig, &p.APIServer.ArgoDriverImage)
602603
setResourcesDefault(config.APIServerResourceRequirements, &p.APIServer.Resources)
603604

605+
p.EnableSamplePipeline = dsp.Spec.APIServer.EnableSamplePipeline
606+
p.EnableInstructLabPipeline = dsp.Spec.APIServer.EnableInstructLabPipeline
607+
604608
if p.APIServer.CustomServerConfig == nil {
605609
p.APIServer.CustomServerConfig = &dspa.ScriptConfigMap{
606610
Name: config.CustomServerConfigMapNamePrefix + dsp.Name,

tests/pipeline_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,29 @@ func (suite *IntegrationTestSuite) TestAPIServerDeployment() {
7575
require.NoError(t, err)
7676
assert.Equal(t, 200, response.StatusCode)
7777
})
78+
79+
suite.T().Run("Should check for InstructLab pipeline existence based on EnableInstructLabPipeline flag", func(t *testing.T) {
80+
expectedDisplayName := "[InstructLab] Multi-Phase Training Pipeline"
81+
82+
// Retrieve pipelines
83+
pipelines, err := TestUtil.RetrievePipelines(t, suite.Clientmgr.httpClient, APIServerURL)
84+
require.NoError(t, err, "Failed to retrieve pipelines")
85+
86+
found := false
87+
for _, pipeline := range pipelines.Pipelines {
88+
if pipeline.DisplayName == expectedDisplayName {
89+
found = true
90+
break
91+
}
92+
}
93+
if suite.DSPA.Spec.APIServer.EnableInstructLabPipeline {
94+
expectedCount := 4
95+
assert.Equal(t, expectedCount, len(pipelines.Pipelines), "Pipeline count should match when EnableInstructLabPipeline flag is enabled")
96+
assert.True(t, found, "InstructLab pipeline should exist when the flag is enabled")
97+
} else {
98+
expectedCount := 3
99+
assert.Equal(t, expectedCount, len(pipelines.Pipelines), "Pipeline count should match when EnableInstructLabPipeline flag is disabled")
100+
assert.False(t, found, "InstructLab pipeline should not exist when the flag is disabled")
101+
}
102+
})
78103
}

tests/resources/dspa-lite.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ spec:
99
deploy: true
1010
enableOauth: false
1111
enableSamplePipeline: true
12+
enableInstructLabPipeline: true
1213
cABundle:
1314
configMapName: nginx-tls-config
1415
configMapKey: rootCA.crt

tests/resources/test-pipeline-run.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ deploymentSpec:
2929
- -c
3030
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
3131
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
32-
\ python3 -m pip install --quiet --no-warn-script-location 'kfp==2.10.1'\
32+
\ python3 -m pip install --quiet --no-warn-script-location 'kfp==2.11.0'\
3333
\ '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"3.9\"' && \"\
3434
$0\" \"$@\"\n"
3535
- sh

0 commit comments

Comments
 (0)