apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  annotations:
    pipelines.kubeflow.org/pipeline_spec: '{"description": "The fourth example of
      the design doc.", "inputs": [{"name": "url"}], "name": "VolumeSnapshotOp Sequential"}'
  generateName: volumesnapshotop-sequential-
spec:
  arguments:
    parameters:
    - name: url
  entrypoint: volumesnapshotop-sequential
  serviceAccountName: pipeline-runner
  templates:
  - name: create-volume
    outputs:
      parameters:
      - name: create-volume-manifest
        valueFrom:
          jsonPath: '{}'
      - name: create-volume-name
        valueFrom:
          jsonPath: '{.metadata.name}'
      - name: create-volume-size
        valueFrom:
          jsonPath: '{.status.capacity.storage}'
    resource:
      action: create
      manifest: "apiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: '{{workflow.name}}-vol1'\n\
        spec:\n  accessModes:\n  - ReadWriteMany\n  resources:\n    requests:\n  \
        \    storage: 1Gi\n"
  - container:
      args:
      - mkdir /data/step1 && gsutil cat {{inputs.parameters.url}} | gzip -c >/data/step1/file1.gz
      command:
      - sh
      - -c
      image: google/cloud-sdk:279.0.0
      volumeMounts:
      - mountPath: /data
        name: create-volume
    inputs:
      parameters:
      - name: create-volume-name
      - name: url
    name: step1-ingest
    volumes:
    - name: create-volume
      persistentVolumeClaim:
        claimName: '{{inputs.parameters.create-volume-name}}'
  - inputs:
      parameters:
      - name: create-volume-name
    name: step1-snap
    outputs:
      parameters:
      - name: step1-snap-manifest
        valueFrom:
          jsonPath: '{}'
      - name: step1-snap-name
        valueFrom:
          jsonPath: '{.metadata.name}'
      - name: step1-snap-size
        valueFrom:
          jsonPath: '{.status.restoreSize}'
    resource:
      action: create
      manifest: "apiVersion: snapshot.storage.k8s.io/v1alpha1\nkind: VolumeSnapshot\n\
        metadata:\n  name: '{{workflow.name}}-step1-snap'\nspec:\n  source:\n    kind:\
        \ PersistentVolumeClaim\n    name: '{{inputs.parameters.create-volume-name}}'\n"
      successCondition: status.readyToUse == true
  - container:
      args:
      - mkdir /data/step2 && gunzip /data/step1/file1.gz -c >/data/step2/file1
      command:
      - sh
      - -c
      image: library/bash:4.4.23
      volumeMounts:
      - mountPath: /data
        name: create-volume
    inputs:
      parameters:
      - name: create-volume-name
    name: step2-gunzip
    volumes:
    - name: create-volume
      persistentVolumeClaim:
        claimName: '{{inputs.parameters.create-volume-name}}'
  - inputs:
      parameters:
      - name: create-volume-name
    name: step2-snap
    outputs:
      parameters:
      - name: step2-snap-manifest
        valueFrom:
          jsonPath: '{}'
      - name: step2-snap-name
        valueFrom:
          jsonPath: '{.metadata.name}'
      - name: step2-snap-size
        valueFrom:
          jsonPath: '{.status.restoreSize}'
    resource:
      action: create
      manifest: "apiVersion: snapshot.storage.k8s.io/v1alpha1\nkind: VolumeSnapshot\n\
        metadata:\n  name: '{{workflow.name}}-step2-snap'\nspec:\n  source:\n    kind:\
        \ PersistentVolumeClaim\n    name: '{{inputs.parameters.create-volume-name}}'\n"
      successCondition: status.readyToUse == true
  - container:
      args:
      - mkdir /data/step3 && cp -av /data/step2/file1 /data/step3/file3
      command:
      - sh
      - -c
      image: library/bash:4.4.23
      volumeMounts:
      - mountPath: /data
        name: create-volume
    inputs:
      parameters:
      - name: create-volume-name
    name: step3-copy
    volumes:
    - name: create-volume
      persistentVolumeClaim:
        claimName: '{{inputs.parameters.create-volume-name}}'
  - inputs:
      parameters:
      - name: create-volume-name
    name: step3-snap
    outputs:
      parameters:
      - name: step3-snap-manifest
        valueFrom:
          jsonPath: '{}'
      - name: step3-snap-name
        valueFrom:
          jsonPath: '{.metadata.name}'
      - name: step3-snap-size
        valueFrom:
          jsonPath: '{.status.restoreSize}'
    resource:
      action: create
      manifest: "apiVersion: snapshot.storage.k8s.io/v1alpha1\nkind: VolumeSnapshot\n\
        metadata:\n  name: '{{workflow.name}}-step3-snap'\nspec:\n  source:\n    kind:\
        \ PersistentVolumeClaim\n    name: '{{inputs.parameters.create-volume-name}}'\n"
      successCondition: status.readyToUse == true
  - container:
      command:
      - cat
      - /data/step2/file1
      - /data/step3/file3
      image: library/bash:4.4.23
      volumeMounts:
      - mountPath: /data
        name: create-volume
    inputs:
      parameters:
      - name: create-volume-name
    name: step4-output
    volumes:
    - name: create-volume
      persistentVolumeClaim:
        claimName: '{{inputs.parameters.create-volume-name}}'
  - dag:
      tasks:
      - name: create-volume
        template: create-volume
      - arguments:
          parameters:
          - name: create-volume-name
            value: '{{tasks.create-volume.outputs.parameters.create-volume-name}}'
          - name: url
            value: '{{inputs.parameters.url}}'
        dependencies:
        - create-volume
        name: step1-ingest
        template: step1-ingest
      - arguments:
          parameters:
          - name: create-volume-name
            value: '{{tasks.create-volume.outputs.parameters.create-volume-name}}'
        dependencies:
        - create-volume
        - step1-ingest
        name: step1-snap
        template: step1-snap
      - arguments:
          parameters:
          - name: create-volume-name
            value: '{{tasks.create-volume.outputs.parameters.create-volume-name}}'
        dependencies:
        - create-volume
        - step1-ingest
        name: step2-gunzip
        template: step2-gunzip
      - arguments:
          parameters:
          - name: create-volume-name
            value: '{{tasks.create-volume.outputs.parameters.create-volume-name}}'
        dependencies:
        - create-volume
        - step2-gunzip
        name: step2-snap
        template: step2-snap
      - arguments:
          parameters:
          - name: create-volume-name
            value: '{{tasks.create-volume.outputs.parameters.create-volume-name}}'
        dependencies:
        - create-volume
        - step2-gunzip
        name: step3-copy
        template: step3-copy
      - arguments:
          parameters:
          - name: create-volume-name
            value: '{{tasks.create-volume.outputs.parameters.create-volume-name}}'
        dependencies:
        - create-volume
        - step3-copy
        name: step3-snap
        template: step3-snap
      - arguments:
          parameters:
          - name: create-volume-name
            value: '{{tasks.create-volume.outputs.parameters.create-volume-name}}'
        dependencies:
        - create-volume
        - step3-copy
        name: step4-output
        template: step4-output
    inputs:
      parameters:
      - name: url
    name: volumesnapshotop-sequential
