fromhera.workflowsimportContainer,Steps,Volume,WorkflowwithWorkflow(generate_name="volumes-pvc-",entrypoint="volumes-pvc-example")asw:v=Volume(name="workdir",size="1Gi",mount_path="/mnt/vol")hello_world_to_file=Container(name="hello-world-to-file",image="busybox",command=["sh","-c"],args=["echo generating message in volume; echo hello world | tee /mnt/vol/hello_world.txt"],volumes=v,)print_message_from_file=Container(name="print-message-from-file",image="alpine:latest",command=["sh","-c"],args=["echo getting message from volume; find /mnt/vol; cat /mnt/vol/hello_world.txt"],volumes=v,)withSteps(name="volumes-pvc-example")ass:hello_world_to_file(name="generate")print_message_from_file(name="print")
apiVersion:argoproj.io/v1alpha1kind:Workflowmetadata:generateName:volumes-pvc-spec:entrypoint:volumes-pvc-exampletemplates:-name:hello-world-to-filecontainer:image:busyboxargs:-echo generating message in volume; echo hello world | tee /mnt/vol/hello_world.txtcommand:-sh--cvolumeMounts:-name:workdirmountPath:/mnt/vol-name:print-message-from-filecontainer:image:alpine:latestargs:-echo getting message from volume; find /mnt/vol; cat /mnt/vol/hello_world.txtcommand:-sh--cvolumeMounts:-name:workdirmountPath:/mnt/vol-name:volumes-pvc-examplesteps:--name:generatetemplate:hello-world-to-file--name:printtemplate:print-message-from-filevolumeClaimTemplates:-metadata:name:workdirspec:accessModes:-ReadWriteOnceresources:requests:storage:1Gi