Skip to content

Instantly share code, notes, and snippets.

@bobcatfish
Created November 5, 2019 19:45
Show Gist options
  • Save bobcatfish/dbc0c8593c59afe33a6f885f9c95d9b3 to your computer and use it in GitHub Desktop.
Save bobcatfish/dbc0c8593c59afe33a6f885f9c95d9b3 to your computer and use it in GitHub Desktop.
Volumes with subpaths at runtime only
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: make-stuff
spec:
params:
- name: message
steps:
- name: doit
image: alpine
command: ["/bin/sh", "-c"]
args:
- echo $(params.message) > $(workspaces.path)/message;
workspaces:
- name: messages
description: the folder where we write the message to
---
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: read-messages
spec:
steps:
- name: doit
image: alpine
script: |
#!/usr/bin/env bash
cat $(workspaces.helloMessage)/message
cat $(workspaces.worldMessage)/message
workspaces:
- name: helloMessage
description: the folder containing the hello messages
- name: worldMessage
description: the folder containing the world message
---
apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
name: volumes-forevah
spec:
volumes:
- name: hello-volume
description: the volume to put hello messages on
- name: world-volume
description: the volume to put world messages on
tasks:
- name: write-hello
taskRef:
name: make-stuff
inputs:
params:
- name: message
value: hello
workspaces:
- name: messages
volume: hello-volume
- name: write-world
taskRef:
name: make-stuff-world
inputs:
params:
- name: message
value: world
workspaces:
name: messages
volume: world-volume
- name: read-it-all
runAfter: [write-hello, write-world]
taskRef:
name: read-messages
workspaces:
- name: helloMessage
volume: world-volume
- name: worldMessage
volume: hello-volume
---
apiVersion: tekton.dev/v1alpha1
kind: PipelineRun
metadata:
name: volumes-forevah-run
spec:
pipelineRef:
name: volumes-forevah
volumes:
- name: world-volume
subPath: /world
persistentVolumeClaim:
- name: my-pvc
- name: hello-volume
subPath: /hello
persistentVolumeClaim:
- name: my-pvc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment