Skip to content

Commit

Permalink
Add missing volume claim to user-container example (#1242)
Browse files Browse the repository at this point in the history
**Pull Request Checklist**
- [x] Fixes #973
- [ ] ~~Tests added~~ not needed here
- [ ] ~~Documentation/examples added~~ not needed here
- [x] [Good commit messages](https://cbea.ms/git-commit/) and/or PR
title

**Description of PR**
Following the volumes page in argo workflows document, updated
user-container examples to have `volumeClaimTemplates`.
- https://argo-workflows.readthedocs.io/en/latest/walk-through/volumes/

---------

Signed-off-by: Ukjae Jeong <[email protected]>
Co-authored-by: Sambhav Kothari <[email protected]>
  • Loading branch information
jeongukjae and sambhav authored Oct 21, 2024
1 parent 3266a5b commit 30cb592
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
23 changes: 22 additions & 1 deletion docs/examples/workflows/misc/user_container.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,19 @@ This example showcases the user of a user container with a volume mount.
print("hi")


with Workflow(generate_name="sidecar-volume-mount-", entrypoint="d") as w:
with Workflow(
generate_name="sidecar-volume-mount-",
entrypoint="d",
volume_claim_templates=[
m.PersistentVolumeClaim(
metadata=m.ObjectMeta(name="something"),
spec=m.PersistentVolumeClaimSpec(
access_modes=["ReadWriteOnce"],
resources=m.ResourceRequirements(requests={"storage": "64Mi"}),
),
)
],
) as w:
with DAG(name="d"):
foo()
```
Expand Down Expand Up @@ -61,5 +73,14 @@ This example showcases the user of a user container with a volume mount.
volumeMounts:
- mountPath: /whatever
name: something
volumeClaimTemplates:
- metadata:
name: something
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 64Mi
```

9 changes: 9 additions & 0 deletions examples/workflows/misc/user-container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ spec:
volumeMounts:
- mountPath: /whatever
name: something
volumeClaimTemplates:
- metadata:
name: something
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 64Mi
14 changes: 13 additions & 1 deletion examples/workflows/misc/user_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ def foo():
print("hi")


with Workflow(generate_name="sidecar-volume-mount-", entrypoint="d") as w:
with Workflow(
generate_name="sidecar-volume-mount-",
entrypoint="d",
volume_claim_templates=[
m.PersistentVolumeClaim(
metadata=m.ObjectMeta(name="something"),
spec=m.PersistentVolumeClaimSpec(
access_modes=["ReadWriteOnce"],
resources=m.ResourceRequirements(requests={"storage": "64Mi"}),
),
)
],
) as w:
with DAG(name="d"):
foo()

0 comments on commit 30cb592

Please sign in to comment.