Skip to content

Instantly share code, notes, and snippets.

@bobcatfish
Created November 5, 2019 19:48
Show Gist options
  • Save bobcatfish/38696e9416c2dd70793846311cf1c43d to your computer and use it in GitHub Desktop.
Save bobcatfish/38696e9416c2dd70793846311cf1c43d to your computer and use it in GitHub Desktop.
Read task can get access to the entire PVC
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.messages.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.mailbox.path)/hello/message
cat $(workspaces.mailbox.path)/world/message
workspaces:
- name: mailbox
description: the folder containing all the messages
---
apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
name: volumes-forevah
spec:
volumes:
- name: main-volume
description: the volume containing all the messages
- 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: mailbox
volume: main-volume
---
apiVersion: tekton.dev/v1alpha1
kind: PipelineRun
metadata:
name: volumes-forevah-run
spec:
pipelineRef:
name: volumes-forevah
volumes:
- name: mailbox
persistentVolumeClaim:
- name: my-pvc
- 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