From 83f9184862d5fd2efa34c427d23137342bc8a3f2 Mon Sep 17 00:00:00 2001 From: Ukjae Jeong Date: Thu, 17 Oct 2024 10:53:42 +0100 Subject: [PATCH 1/3] Add pvc to user-container example Signed-off-by: Ukjae Jeong --- examples/workflows/misc/user-container.yaml | 9 +++++++++ examples/workflows/misc/user_container.py | 14 +++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/examples/workflows/misc/user-container.yaml b/examples/workflows/misc/user-container.yaml index e3330cee3..dafcc02ef 100644 --- a/examples/workflows/misc/user-container.yaml +++ b/examples/workflows/misc/user-container.yaml @@ -25,3 +25,12 @@ spec: volumeMounts: - mountPath: /whatever name: something + volumeClaimTemplates: + - metadata: + name: something + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 64Mi diff --git a/examples/workflows/misc/user_container.py b/examples/workflows/misc/user_container.py index 39c9e6d1a..df70b7619 100644 --- a/examples/workflows/misc/user_container.py +++ b/examples/workflows/misc/user_container.py @@ -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": m.Quantity(__root__="64Mi")}), + ), + ) + ], +) as w: with DAG(name="d"): foo() From aa97ee83cebc2a9661fb5150a6c0adf08d963da9 Mon Sep 17 00:00:00 2001 From: Ukjae Jeong Date: Thu, 17 Oct 2024 11:04:27 +0100 Subject: [PATCH 2/3] Update Resource requirements simply Signed-off-by: Ukjae Jeong --- examples/workflows/misc/user_container.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/workflows/misc/user_container.py b/examples/workflows/misc/user_container.py index df70b7619..c587ad9ab 100644 --- a/examples/workflows/misc/user_container.py +++ b/examples/workflows/misc/user_container.py @@ -26,7 +26,7 @@ def foo(): metadata=m.ObjectMeta(name="something"), spec=m.PersistentVolumeClaimSpec( access_modes=["ReadWriteOnce"], - resources=m.ResourceRequirements(requests={"storage": m.Quantity(__root__="64Mi")}), + resources=m.ResourceRequirements(requests={"storage": "64Mi"}), ), ) ], From 389a68c326be24e86b1ad7675ae51986b14db4e5 Mon Sep 17 00:00:00 2001 From: Ukjae Jeong Date: Thu, 17 Oct 2024 11:15:44 +0100 Subject: [PATCH 3/3] Run codegen Signed-off-by: Ukjae Jeong --- .../examples/workflows/misc/user_container.md | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/examples/workflows/misc/user_container.md b/docs/examples/workflows/misc/user_container.md index 7884f0c12..e2af4bfa2 100644 --- a/docs/examples/workflows/misc/user_container.md +++ b/docs/examples/workflows/misc/user_container.md @@ -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() ``` @@ -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 ```