fromhera.workflowsimportContainer,Steps,Volume,WorkflowwithWorkflow(generate_name="volumes-pvc-",entrypoint="volumes-pvc-example")asw:v=Volume(name="workdir",size="1Gi",mount_path="/mnt/vol")whalesay=Container(name="whalesay",image="docker/whalesay:latest",command=["sh","-c"],args=["echo generating message in volume; cowsay hello world | tee /mnt/vol/hello_world.txt"],volumes=v,)print_message=Container(name="print-message",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:whalesay(name="generate")print_message(name="print")
apiVersion:argoproj.io/v1alpha1kind:Workflowmetadata:generateName:volumes-pvc-spec:entrypoint:volumes-pvc-exampletemplates:-container:args:-echo generating message in volume; cowsay hello world | tee /mnt/vol/hello_world.txtcommand:-sh--cimage:docker/whalesay:latestvolumeMounts:-mountPath:/mnt/volname:workdirname:whalesay-container:args:-echo getting message from volume; find /mnt/vol; cat /mnt/vol/hello_world.txtcommand:-sh--cimage:alpine:latestvolumeMounts:-mountPath:/mnt/volname:workdirname:print-message-name:volumes-pvc-examplesteps:--name:generatetemplate:whalesay--name:printtemplate:print-messagevolumeClaimTemplates:-metadata:name:workdirspec:accessModes:-ReadWriteOnceresources:requests:storage:1Gi