Skip to content

Instantly share code, notes, and snippets.

@S0PEX
Created August 15, 2022 20:36
Show Gist options
  • Save S0PEX/138e7331f1c552a2076b8df60a9b89de to your computer and use it in GitHub Desktop.
Save S0PEX/138e7331f1c552a2076b8df60a9b89de to your computer and use it in GitHub Desktop.
Argo Workflow with wolume claim
const workflow: HttpWorkflowsArgoprojIoWorkflowsJson = {
metadata: {
name: `${pipelineSchema.title.replace(/\s/g, '-').toLowerCase()}-${id}`,
namespace: 'default',
labels: {
id,
},
},
spec: {
entrypoint: 'workflow',
volumeClaimTemplates: [
{
metadata: { name: 'workdir' },
spec: {
accessModes: ['ReadWriteOnce'],
resources: {
requests: {
storage: '100Gi',
},
},
},
},
],
templates: [
...pipelineSchema.steps.map(({ image, commands }, index) => ({
name: index.toString(),
script: {
image,
env: [{ name: 'workdir', value: '/mnt/share/' }],
volumeMounts: [
{
name: 'workdir',
mountPath: '/mnt/share',
},
],
command: ['bash'],
source: commands.join(';'),
},
/*outputs: {
artifacts: [
{
name: 'Output',
path: '/xyz',
url: https://mywebhdfsprovider.com/webhdfs/v1/file.txt?op=CREATE&overwrite=true
},
],
},*/
})),
{
name: 'workflow',
steps: [
Array.from({ length: pipelineSchema.steps.length }, (_x, i) => ({
name: `${id}-step-${i}`,
template: `${i}`,
})),
],
},
],
ttlStrategy: {
secondsAfterCompletion: 200,
},
podGC: {
strategy: PodGcStrategies.OnWorkflowSuccess,
},
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment