Skip to content

Commit c62298b

Browse files
jlpetterssontekton-robot
authored andcommitted
Improve documentation about volumeClaimTemplate workspaces
Add a short example and link to a full example of using volumeClaimTemplate as a volume source in a workspace. Requested in comment to PR #2326 (comment) that fixes #1986
1 parent a9081fe commit c62298b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

docs/workspaces.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,20 @@ The entry must also include one `VolumeSource`. See [Using `VolumeSources` with
256256
The examples below illustrate how to specify `Workspaces` in your `PipelineRuns`. For a more in-depth example, see the
257257
[`Workspaces` in `PipelineRun`](../examples/v1beta1/pipelineruns/workspaces.yaml) YAML sample.
258258

259+
In the example below, a template is provided for how a `PersistentVolumeClaim` should be created for a workspace named `myworkspace` declared in a `Pipeline`. When using `volumeClaimTemplate` a new `PersistentVolumeClaim` is created for each `PipelineRun` and it allows the user to specify e.g. size and StorageClass for the volume.
260+
261+
```yaml
262+
workspaces:
263+
- name: myworkspace
264+
volumeClaimTemplate:
265+
spec:
266+
accessModes:
267+
- ReadWriteOnce
268+
resources:
269+
requests:
270+
storage: 1Gi
271+
```
272+
259273
In the example below, an existing `PersistentVolumeClaim` named `mypvc` is used for a `Workspace`
260274
named `myworkspace` declared in a `Pipeline`. It exposes only the subdirectory `my-subdir` from that `PersistentVolumeClaim`:
261275

@@ -307,7 +321,7 @@ The `persistentVolumeClaim` field references an existing [`persistentVolumeClaim
307321

308322
The `volumeClaimTemplate` is a template of a [`persistentVolumeClaim` volume](https://kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim), created for each `PipelineRun` or `TaskRun`.
309323
When the volume is created from a template in a `PipelineRun` or `TaskRun` it will be deleted when the `PipelineRun` or `TaskRun` is deleted.
310-
`volumeClaimTemplate` volumes are a good choice for sharing data among `Tasks` within a `Pipeline` when the volume is only used during a `PipelineRun` or `TaskRun`.
324+
`volumeClaimTemplate` volumes are a good choice for sharing data among `Tasks` within a `Pipeline` when the volume is only used during a `PipelineRun` or `TaskRun`. See [`Workspaces` from a volumeClaimTemplate in a `PipelineRun`](../examples/v1beta1/pipelineruns/workspace-from-volumeclaimtemplate.yaml) for a complete example.
311325

312326
#### `configMap`
313327

@@ -336,3 +350,4 @@ See the following in-depth examples of configuring `Workspaces`:
336350

337351
- [`Workspaces` in a `TaskRun`](../examples/v1beta1/taskruns/workspace.yaml)
338352
- [`Workspaces` in a `PipelineRun`](../examples/v1beta1/pipelineruns/workspaces.yaml)
353+
- [`Workspaces` from a volumeClaimTemplate in a `PipelineRun`](../examples/v1beta1/pipelineruns/workspace-from-volumeclaimtemplate.yaml)

0 commit comments

Comments
 (0)