Skip to content

Instantly share code, notes, and snippets.

@pritidesai
Last active January 21, 2020 21:18
Show Gist options
  • Save pritidesai/e50b3d91d628c6cec421939716bbfd81 to your computer and use it in GitHub Desktop.
Save pritidesai/e50b3d91d628c6cec421939716bbfd81 to your computer and use it in GitHub Desktop.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-pvc
spec:
resources:
requests:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
---
apiVersion: v1
kind: ConfigMap
metadata:
name: my-configmap
data:
message: hello world
---
apiVersion: v1
kind: Secret
metadata:
name: my-secret
type: Opaque
stringData:
username: user
data:
message: aGVsbG8gc2VjcmV0
---
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
name: custom-volume-1
spec:
workspaces:
- name: custom
persistentVolumeClaim:
claimName: my-pvc
subPath: my-subdir
- name: custom2
persistentVolumeClaim:
claimName: my-pvc
- name: custom3
emptyDir: {}
subPath: testing
- name: custom4
configMap:
name: my-configmap
items:
- key: message
path: my-message.txt
- name: custom5
secret:
secretName: my-secret
taskSpec:
steps:
- name: write
image: ubuntu
script: echo $(workspaces.custom.volume) > $(workspaces.custom.path)/foo
- name: read
image: ubuntu
script: cat $(workspaces.custom.path)/foo | grep $(workspaces.custom.volume)
- name: write2
image: ubuntu
script: echo $(workspaces.custom2.path) > $(workspaces.custom2.path)/foo
- name: read2
image: ubuntu
script: cat $(workspaces.custom2.path)/foo | grep $(workspaces.custom2.path)
- name: write3
image: ubuntu
script: echo $(workspaces.custom3.path) > $(workspaces.custom3.path)/foo
- name: read3
image: ubuntu
script: cat $(workspaces.custom3.path)/foo | grep $(workspaces.custom3.path)
- name: readconfigmap
image: ubuntu
script: cat $(workspaces.custom4.path)/my-message.txt | grep "hello world"
- name: readsecret
image: ubuntu
script: |
#!/usr/bin/env bash
set -xe
cat $(workspaces.custom5.path)/username | grep "user"
cat $(workspaces.custom5.path)/message | grep "hello secret"
workspaces:
- name: custom
- name: custom2
mountPath: /foo/bar/baz
- name: custom3
- name: custom4
mountPath: /baz/bar/quux
- name: custom5
mountPath: /my/secret/volume
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment