Skip to content

Instantly share code, notes, and snippets.

@guidorice
Last active September 9, 2023 22:15
Show Gist options
  • Select an option

  • Save guidorice/d30765ee8bb93f32ec1ec981bd50e6ed to your computer and use it in GitHub Desktop.

Select an option

Save guidorice/d30765ee8bb93f32ec1ec981bd50e6ed to your computer and use it in GitHub Desktop.
# This example demonstrates the ability to pass artifacts
# from one step to the next.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: artifact-passing-
annotations:
workflows.argoproj.io/description: |
guidorice testing
spec:
serviceAccountName: argo-workflow
entrypoint: artifact-example
templates:
- name: artifact-example
steps:
- - name: generate-artifact
template: whalesay
- - name: consume-artifact
template: print-message
arguments:
artifacts:
- name: message
from: "{{steps.generate-artifact.outputs.artifacts.hello-art}}"
- name: whalesay
container:
image: docker/whalesay:latest
command: [sh, -c]
args: ["sleep 1; cowsay hello world | tee /tmp/hello_world.txt"]
outputs:
artifacts:
- name: hello-art
path: /tmp/hello_world.txt
- name: print-message
inputs:
artifacts:
- name: message
path: /tmp/message
container:
image: alpine:latest
command: [sh, -c]
args: ["cat /tmp/message"]
tolerations:
- key: "workers"
operator: "Equal"
value: "true"
effect: "NoSchedule"
nodeSelector:
node-type: "workers"
@guidorice
Copy link
Author

Workflow fails with:

 ✖ artifact-passing-qh44s  artifact-example                                                        child 'artifact-passing-qh44s-1878193226' failed                                                                                                                                                    
 └───⚠ generate-artifact   whalesay          artifact-passing-qh44s-whalesay-1878193226  5s        Error (exit code 1): You need to configure artifact storage. More information on how to do this can be found in the docs: https://argoproj.github.io/argo-workflows/configure-artifact-repository/  

--> https://argoproj.github.io/argo-workflows/configure-artifact-repository/

@guidorice
Copy link
Author

Example config from Argo Workflows 101 tutorial:

# kubectl -n argo get configmap artifact-repositories -o yaml
apiVersion: v1
data:
  default-v1: |
    archiveLogs: true
    s3:
      bucket: my-bucket
      endpoint: minio:9000
      insecure: true
      accessKeySecret:
        name: my-minio-cred
        key: accesskey
      secretKeySecret:
        name: my-minio-cred
        key: secretkey
  empty: ""
  my-key: |
    archiveLogs: true
    s3:
      bucket: my-bucket
      endpoint: minio:9000
      insecure: true
      accessKeySecret:
        name: my-minio-cred
        key: accesskey
      secretKeySecret:
        name: my-minio-cred
        key: secretkey
kind: ConfigMap
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","data":{"default-v1":"archiveLogs: true\ns3:\n  bucket: my-bucket\n  endpoint: minio:9000\n  insecure: true\n  accessKeySecret:\n    name: my-minio-cred\n    key: accesskey\n  secretKeySecret:\n    name: my-minio-cred\n    key: secretkey\n","empty":"","my-key":"archiveLogs: true\ns3:\n  bucket: my-bucket\n  endpoint: minio:9000\n  insecure: true\n  accessKeySecret:\n    name: my-minio-cred\n    key: accesskey\n  secretKeySecret:\n    name: my-minio-cred\n    key: secretkey\n"},"kind":"ConfigMap","metadata":{"annotations":{"workflows.argoproj.io/default-artifact-repository":"default-v1"},"name":"artifact-repositories","namespace":"argo"}}
    workflows.argoproj.io/default-artifact-repository: default-v1
  creationTimestamp: "2023-08-31T21:14:05Z"
  name: artifact-repositories
  namespace: argo
  resourceVersion: "1362"
  uid: 45a6451b-ab91-4c3e-8212-fdf8d432e7e1
# $ kubectl -n argo get configmap workflow-controller-configmap -o yaml
apiVersion: v1
data:
  artifactRepository: |
    s3:
      bucket: my-bucket
      endpoint: minio:9000
      insecure: true
      accessKeySecret:
        name: my-minio-cred
        key: accesskey
      secretKeySecret:
        name: my-minio-cred
        key: secretkey
  columns: |
    - name: Workflow Completed
      type: label
      key: workflows.argoproj.io/completed
  executor: |
    resources:
      requests:
        cpu: 10m
        memory: 64Mi
  images: |
    docker/whalesay:latest:
       cmd: [cowsay]
  links: |
    - name: Workflow Link
      scope: workflow
      url: http://logging-facility?namespace=${metadata.namespace}&workflowName=${metadata.name}&startedAt=${status.startedAt}&finishedAt=${status.finishedAt}
    - name: Pod Link
      scope: pod
      url: http://logging-facility?namespace=${metadata.namespace}&podName=${metadata.name}&startedAt=${status.startedAt}&finishedAt=${status.finishedAt}
    - name: Pod Logs Link
      scope: pod-logs
      url: http://logging-facility?namespace=${metadata.namespace}&podName=${metadata.name}&startedAt=${status.startedAt}&finishedAt=${status.finishedAt}
    - name: Event Source Logs Link
      scope: event-source-logs
      url: http://logging-facility?namespace=${metadata.namespace}&podName=${metadata.name}&startedAt=${status.startedAt}&finishedAt=${status.finishedAt}
    - name: Sensor Logs Link
      scope: sensor-logs
      url: http://logging-facility?namespace=${metadata.namespace}&podName=${metadata.name}&startedAt=${status.startedAt}&finishedAt=${status.finishedAt}
    - name: Completed Workflows
      scope: workflow-list
      url: http://workflows?label=workflows.argoproj.io/completed=true
  metricsConfig: |
    enabled: true
    path: /metrics
    port: 9090
  namespaceParallelism: "10"
  persistence: |
    connectionPool:
      maxIdleConns: 100
      maxOpenConns: 0
      connMaxLifetime: 0s
    nodeStatusOffLoad: true
    archive: true
    archiveTTL: 7d
    postgresql:
      host: postgres
      port: 5432
      database: postgres
      tableName: argo_workflows
      userNameSecret:
        name: argo-postgres-config
        key: username
      passwordSecret:
        name: argo-postgres-config
        key: password
  retentionPolicy: |
    completed: 10
    failed: 3
    errored: 3
kind: ConfigMap
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","data":{"artifactRepository":"s3:\n  bucket: my-bucket\n  endpoint: minio:9000\n  insecure: true\n  accessKeySecret:\n    name: my-minio-cred\n    key: accesskey\n  secretKeySecret:\n    name: my-minio-cred\n    key: secretkey\n","columns":"- name: Workflow Completed\n  type: label\n  key: workflows.argoproj.io/completed\n","executor":"resources:\n  requests:\n    cpu: 10m\n    memory: 64Mi\n","images":"docker/whalesay:latest:\n   cmd: [cowsay]\n","links":"- name: Workflow Link\n  scope: workflow\n  url: http://logging-facility?namespace=${metadata.namespace}\u0026workflowName=${metadata.name}\u0026startedAt=${status.startedAt}\u0026finishedAt=${status.finishedAt}\n- name: Pod Link\n  scope: pod\n  url: http://logging-facility?namespace=${metadata.namespace}\u0026podName=${metadata.name}\u0026startedAt=${status.startedAt}\u0026finishedAt=${status.finishedAt}\n- name: Pod Logs Link\n  scope: pod-logs\n  url: http://logging-facility?namespace=${metadata.namespace}\u0026podName=${metadata.name}\u0026startedAt=${status.startedAt}\u0026finishedAt=${status.finishedAt}\n- name: Event Source Logs Link\n  scope: event-source-logs\n  url: http://logging-facility?namespace=${metadata.namespace}\u0026podName=${metadata.name}\u0026startedAt=${status.startedAt}\u0026finishedAt=${status.finishedAt}\n- name: Sensor Logs Link\n  scope: sensor-logs\n  url: http://logging-facility?namespace=${metadata.namespace}\u0026podName=${metadata.name}\u0026startedAt=${status.startedAt}\u0026finishedAt=${status.finishedAt}\n- name: Completed Workflows\n  scope: workflow-list\n  url: http://workflows?label=workflows.argoproj.io/completed=true\n","metricsConfig":"enabled: true\npath: /metrics\nport: 9090\n","namespaceParallelism":"10","persistence":"connectionPool:\n  maxIdleConns: 100\n  maxOpenConns: 0\n  connMaxLifetime: 0s\nnodeStatusOffLoad: true\narchive: true\narchiveTTL: 7d\npostgresql:\n  host: postgres\n  port: 5432\n  database: postgres\n  tableName: argo_workflows\n  userNameSecret:\n    name: argo-postgres-config\n    key: username\n  passwordSecret:\n    name: argo-postgres-config\n    key: password\n","retentionPolicy":"completed: 10\nfailed: 3\nerrored: 3\n"},"kind":"ConfigMap","metadata":{"annotations":{},"name":"workflow-controller-configmap","namespace":"argo"}}
  creationTimestamp: "2023-08-31T21:14:05Z"
  name: workflow-controller-configmap
  namespace: argo
  resourceVersion: "1363"
  uid: ae8d2a47-e497-42e7-8d81-d220d4f58b34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment