forked from opendatahub-io/data-science-pipelines
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add volumemount support and fix parameter bugs (#40)
* add volumemount support and fix parameter bugs * remove sdk/samples folder and use real kfp example * fix formatting * update unittest and instructions * update license header * update license header * update license
- Loading branch information
Showing
9 changed files
with
144 additions
and
128 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Copyright 2020 kubeflow.org | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
import kfp.dsl as dsl | ||
from kubernetes import client as k8s_client | ||
|
||
|
||
@dsl.pipeline( | ||
name='Volume', | ||
description='A pipeline with volume.' | ||
) | ||
def volume_pipeline(): | ||
op1 = dsl.ContainerOp( | ||
name='download', | ||
image='google/cloud-sdk', | ||
command=['sh', '-c'], | ||
arguments=['ls | tee /tmp/results.txt'], | ||
file_outputs={'downloaded': '/tmp/results.txt'}) \ | ||
.add_volume(k8s_client.V1Volume(name='gcp-credentials', | ||
secret=k8s_client.V1SecretVolumeSource( | ||
secret_name='user-gcp-sa'))) \ | ||
.add_volume_mount(k8s_client.V1VolumeMount( | ||
mount_path='/secret/gcp-credentials', name='gcp-credentials')) \ | ||
.add_env_variable(k8s_client.V1EnvVar( | ||
name='GOOGLE_APPLICATION_CREDENTIALS', | ||
value='/secret/gcp-credentials/user-gcp-sa.json')) \ | ||
.add_env_variable(k8s_client.V1EnvVar(name='Foo', value='bar')) | ||
op2 = dsl.ContainerOp( | ||
name='echo', | ||
image='library/bash', | ||
command=['sh', '-c'], | ||
arguments=['echo %s' % op1.output]) |
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,79 @@ | ||
# Copyright 2020 kubeflow.org | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: download | ||
spec: | ||
results: | ||
- description: /tmp/results.txt | ||
name: downloaded | ||
steps: | ||
- args: | ||
- ls | tee $(results.downloaded.path) | ||
command: | ||
- sh | ||
- -c | ||
env: | ||
- name: GOOGLE_APPLICATION_CREDENTIALS | ||
value: /secret/gcp-credentials/user-gcp-sa.json | ||
- name: Foo | ||
value: bar | ||
image: google/cloud-sdk | ||
name: download | ||
volumeMounts: | ||
- mountPath: /secret/gcp-credentials | ||
name: gcp-credentials | ||
volumes: | ||
- name: gcp-credentials | ||
secret: | ||
secretName: user-gcp-sa | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: echo | ||
spec: | ||
params: | ||
- name: download-downloaded | ||
steps: | ||
- args: | ||
- echo $(inputs.params.download-downloaded) | ||
command: | ||
- sh | ||
- -c | ||
image: library/bash | ||
name: echo | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Pipeline | ||
metadata: | ||
annotations: | ||
pipelines.kubeflow.org/pipeline_spec: '{"description": "A pipeline with volume.", | ||
"name": "Volume"}' | ||
name: volume | ||
spec: | ||
params: [] | ||
tasks: | ||
- name: download | ||
params: [] | ||
taskRef: | ||
name: download | ||
- name: echo | ||
params: | ||
- name: download-downloaded | ||
value: $(tasks.download.results.downloaded) | ||
taskRef: | ||
name: echo |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.