Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define artifactRepositoryRef only once in spec #3184

Closed
hadim opened this issue Jun 7, 2020 · 5 comments · Fixed by #4618
Closed

Define artifactRepositoryRef only once in spec #3184

hadim opened this issue Jun 7, 2020 · 5 comments · Fixed by #4618
Labels
type/feature Feature request
Milestone

Comments

@hadim
Copy link

hadim commented Jun 7, 2020

At the moment each new workflow must redefine an artifact repository:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: input-from-s3-

spec:
  entrypoint: input-from-s3
  serviceAccountName: argo
  templates:
  - name: input-from-s3
    container:
      image: alpine:3.12
      command: [sh, -c]
      args: ["cat /inputs/inputs.txt"]
    inputs:
      artifacts:
        - name: test-input
          path: /inputs
          s3:
            endpoint: s3.amazonaws.com
            region: us-east-2
            bucket: test-bucket
            key: inputs
            accessKeySecret:
              name: argo-s3-credentials
              key: accessKey
            secretKeySecret:
              name: argo-s3-credentials
              key: secretKey

Is that possible to define s3 once and reuse it in different workflows? Something like that:

apiVersion: argoproj.io/v1alpha1
kind: ArtifactRepo
metadata:
  name: my-input-artifact
spec:
  type: s3
  config:
    endpoint: s3.amazonaws.com
    region: us-east-1
    bucket: test-hadrien
    key: inputs
    accessKeySecret:
      name: argo-s3-credentials
      key: accessKey
    secretKeySecret:
      name: argo-s3-credentials
      key: secretKey
---
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: input-from-s3-

spec:
  entrypoint: input-from-s3
  serviceAccountName: argo
  templates:
  - name: input-from-s3
    container:
      image: alpine:3.12
      command: [sh, -c]
      args: ["cat /inputs/inputs.txt"]
    inputs:
      artifacts:
        - name: test-input
          path: /inputs
          artifactRepo: my-input-artifact

Or maybe this is already possible using workflow templates? If that's the case could you provide an example?

@hadim hadim added the question label Jun 7, 2020
@sarabala1979
Copy link
Member

I liked the above idea to decouple the (namespace scoped) artifact repo. Instead of new CRD, we can use Configmap which can have multiple artifact repo configuration which can be referred to in workflows.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: input-from-s3-

spec:
  entrypoint: input-from-s3
  serviceAccountName: argo
  templates:
  - name: input-from-s3
    container:
      image: alpine:3.12
      command: [sh, -c]
      args: ["cat /inputs/inputs.txt"]
    inputs:
      artifacts:
        - name: test-input
          path: /inputs
          configMapKeyRef:
              name: my-input-artifact
              key: repo1

@jessesuen comment on this.

Current Support:

you can configure the controller level artifact repository. All workflows on this controller can upload and download the artifacts to the central artifact repository.

https://github.com/argoproj/argo/blob/master/docs/configure-artifact-repository.md#s3-compatible-artifact-repository-bucket-such-as-aws-gcs-and-minio

# This example demonstrates the ability to pass artifacts
# from one step to the next.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: artifact-passing-
spec:
  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"]

@hadim
Copy link
Author

hadim commented Jun 8, 2020

Thank you @sarabala1979. I am already using artifactRepository and it works well by I want the possibility to work with multiple artifacts at the same time.

About a new CRD or a configMap, whatever works best for you. I guess the configMap would be easier to implement but I think it could make sense to have a new CRD object too.

@alexec
Copy link
Contributor

alexec commented Jun 8, 2020

I'm pretty sure we already have an issue for this problem - which is a problem. I've tried to fix this already - hard to do unfortunatly.

@alexec alexec added artifacts type/feature Feature request and removed question labels Jun 8, 2020
@alexec alexec changed the title Artifact object Define artifactRepositoryRef only once in spec Jul 31, 2020
@alexec alexec self-assigned this Oct 21, 2020
@alexec
Copy link
Contributor

alexec commented Oct 21, 2020

How does this differ from #3307?

@alexec
Copy link
Contributor

alexec commented Oct 21, 2020

Work in progress (not trivial to solve) you only need to specify s3.key, everything else (e.g. s3.bucket) is taken from the artifactRepositoryRef

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  name: artifact-repository-ref
  labels:
    argo-e2e: "true"
spec:
  entrypoint: main
  artifactRepositoryRef:
    key: minio
  templates:
    - name: main
      dag:
        tasks:
          - name: generate
            template: generate
          - name: consume
            template: consume
            dependencies:
              - generate
    - name: generate
      container:
        image: argoproj/argosay:v2
        args:
          - echo
          - hello
          - /mnt/file
      outputs:
        artifacts:
          - name: file
            path: /mnt/file
            s3:
              key: my-file
    - name: consume
      container:
        image: argoproj/argosay:v2
        args:
          - cat
          - /tmp/file
      inputs:
        artifacts:
          - name: file
            path: /tmp/file
            s3:
              key: my-file

alexec added a commit to alexec/argo-workflows that referenced this issue Oct 22, 2020
Signed-off-by: Alex Collins <alex_collins@intuit.com>
alexec added a commit to alexec/argo-workflows that referenced this issue Nov 4, 2020
Signed-off-by: Alex Collins <alex_collins@intuit.com>
alexec added a commit that referenced this issue Nov 30, 2020
Signed-off-by: Alex Collins <alex_collins@intuit.com>
alexec added a commit to alexec/argo-workflows that referenced this issue Nov 30, 2020
Signed-off-by: Alex Collins <alex_collins@intuit.com>
alexcapras pushed a commit to alexcapras/argo that referenced this issue Dec 2, 2020
Signed-off-by: github@finnesand.no <github@finnesand.no>

feat(ui): Add Template/Cron workflow filter to workflow page. Closes argoproj#4532 (argoproj#4543)

Signed-off-by: Tianchu Zhao <evantczhao@gmail.com>

feat(executor): Auto create s3 bucket if not present.

Signed-off-by: Alex Capras <alexcapras@gmail.com>

Apply codegen

Signed-off-by: Alex Capras <alexcapras@gmail.com>

Add argo-e2e label to test wf

Signed-off-by: Alex Capras <alexcapras@gmail.com>

chore: Updated stress test YAML (argoproj#4569)

Signed-off-by: Alex Collins <alex_collins@intuit.com>

docs: Updated kubectl apply command in manifests README (argoproj#4577)

Signed-off-by: Stefan Gloutnikov <stefan@gloutnikov.com>

feat(controller): Make MAX_OPERATION_TIME configurable. Close argoproj#4239 (argoproj#4562)

Signed-off-by: Alex Collins <alex_collins@intuit.com>

docs: Fix a typo in example (argoproj#4590)

Signed-off-by: Takayoshi Nishida <takayoshi.nishida@gmail.com>

feat(controller): Retry transient offload errors. Resolves argoproj#4464 (argoproj#4482)

Signed-off-by: Alex Collins <alex_collins@intuit.com>

fix(server): use the correct name when downloading artifacts (argoproj#4579)

Signed-off-by: Daniel Herman <dherman@factset.com>

fix(server): serve artifacts directly from disk to support large artifacts (argoproj#4589)

Signed-off-by: Daniel Herman <dherman@factset.com>

fix(executor): Handle sidecar killing in a process-namespace-shared pod (argoproj#4575)

Signed-off-by: Daisuke Taniwaki <daisuketaniwaki@gmail.com>

docs: Add JSON schema for IDE validation (argoproj#4581)

Signed-off-by: Paul Brabban <paul.brabban@gmail.com>

refactor: Use polling model for workflow phase metric (argoproj#4557)

Signed-off-by: Simon Behar <simbeh7@gmail.com>

Addressing reviewers comments

Signed-off-by: Alex Capras <alexcapras@gmail.com>

Addressing reviewers comments

docs: Minor typo fix (argoproj#4610)

Signed-off-by: Paavo Pokkinen <paavo.pokkinen@vaimo.com>

fix(controller): Prevent tasks with names starting with digit to use either 'depends' or 'dependencies' (argoproj#4598)

Signed-off-by: terrytangyuan <terrytangyuan@gmail.com>

fix(docs): Bring minio chart instructions up to date (argoproj#4586)

Signed-off-by: Ranga Krishnan <ranga@bei.re>

fix(executor): Fixed waitMainContainerStart returning prematurely. Closes argoproj#4599 (argoproj#4601)

Signed-off-by: fsiegmund <siegmund@slb.com>

feat(controller): Enhanced artifact repository ref. See argoproj#3184 (argoproj#4458)

Signed-off-by: Alex Collins <alex_collins@intuit.com>

fix: Null check pagination variable (argoproj#4617)

Signed-off-by: Simon Behar <simbeh7@gmail.com>

fix: Perform fields filtering server side (argoproj#4595)

Signed-off-by: Simon Behar <simbeh7@gmail.com>

fix(server): Correct webhook event payload marshalling. Fixes argoproj#4572 (argoproj#4594)

Signed-off-by: Alex Collins <alex_collins@intuit.com>

feat(ui): Add columns--narrower-height to AttributeRow (argoproj#4371)

fix: Fix TestCleanFieldsExclude (argoproj#4625)

Signed-off-by: Simon Behar <simbeh7@gmail.com>

fix(argo-server): fix global variable validation error with reversed dag.tasks (argoproj#4369)

Signed-off-by: chenyu.zheng <chenyu.zheng@hulu.com>

fix: derive jsonschema and fix up issues, validate examples dir… (argoproj#4611)

Signed-off-by: Paul Brabban <paul.brabban@gmail.com>

fix(ui): Reference secrets in EnvVars. Fixes argoproj#3973  (argoproj#4419)

Signed-off-by: Alejandro Tejera <aletepe@gmail.com>

fix(ui): Fix Snyk issues (argoproj#4631)

Signed-off-by: Alex Collins <alex_collins@intuit.com>

feat(executor): More informative log when executors do not support output param from base image layer (argoproj#4620)

Signed-off-by: terrytangyuan <terrytangyuan@gmail.com>

Codegen patch. Signed off by alexcapras@gmail.com

Codegen patch. Signed off by alexcapras@gmail.com

Delete test.patch
alexcapras pushed a commit to alexcapras/argo that referenced this issue Dec 2, 2020
Signed-off-by: github@finnesand.no <github@finnesand.no>

feat(ui): Add Template/Cron workflow filter to workflow page. Closes argoproj#4532 (argoproj#4543)

Signed-off-by: Tianchu Zhao <evantczhao@gmail.com>

feat(executor): Auto create s3 bucket if not present.

Signed-off-by: Alex Capras <alexcapras@gmail.com>

Apply codegen

Signed-off-by: Alex Capras <alexcapras@gmail.com>

Add argo-e2e label to test wf

Signed-off-by: Alex Capras <alexcapras@gmail.com>

chore: Updated stress test YAML (argoproj#4569)

Signed-off-by: Alex Collins <alex_collins@intuit.com>

docs: Updated kubectl apply command in manifests README (argoproj#4577)

Signed-off-by: Stefan Gloutnikov <stefan@gloutnikov.com>

feat(controller): Make MAX_OPERATION_TIME configurable. Close argoproj#4239 (argoproj#4562)

Signed-off-by: Alex Collins <alex_collins@intuit.com>

docs: Fix a typo in example (argoproj#4590)

Signed-off-by: Takayoshi Nishida <takayoshi.nishida@gmail.com>

feat(controller): Retry transient offload errors. Resolves argoproj#4464 (argoproj#4482)

Signed-off-by: Alex Collins <alex_collins@intuit.com>

fix(server): use the correct name when downloading artifacts (argoproj#4579)

Signed-off-by: Daniel Herman <dherman@factset.com>

fix(server): serve artifacts directly from disk to support large artifacts (argoproj#4589)

Signed-off-by: Daniel Herman <dherman@factset.com>

fix(executor): Handle sidecar killing in a process-namespace-shared pod (argoproj#4575)

Signed-off-by: Daisuke Taniwaki <daisuketaniwaki@gmail.com>

docs: Add JSON schema for IDE validation (argoproj#4581)

Signed-off-by: Paul Brabban <paul.brabban@gmail.com>

refactor: Use polling model for workflow phase metric (argoproj#4557)

Signed-off-by: Simon Behar <simbeh7@gmail.com>

Addressing reviewers comments

Signed-off-by: Alex Capras <alexcapras@gmail.com>

Addressing reviewers comments

docs: Minor typo fix (argoproj#4610)

Signed-off-by: Paavo Pokkinen <paavo.pokkinen@vaimo.com>

fix(controller): Prevent tasks with names starting with digit to use either 'depends' or 'dependencies' (argoproj#4598)

Signed-off-by: terrytangyuan <terrytangyuan@gmail.com>

fix(docs): Bring minio chart instructions up to date (argoproj#4586)

Signed-off-by: Ranga Krishnan <ranga@bei.re>

fix(executor): Fixed waitMainContainerStart returning prematurely. Closes argoproj#4599 (argoproj#4601)

Signed-off-by: fsiegmund <siegmund@slb.com>

feat(controller): Enhanced artifact repository ref. See argoproj#3184 (argoproj#4458)

Signed-off-by: Alex Collins <alex_collins@intuit.com>

fix: Null check pagination variable (argoproj#4617)

Signed-off-by: Simon Behar <simbeh7@gmail.com>

fix: Perform fields filtering server side (argoproj#4595)

Signed-off-by: Simon Behar <simbeh7@gmail.com>

fix(server): Correct webhook event payload marshalling. Fixes argoproj#4572 (argoproj#4594)

Signed-off-by: Alex Collins <alex_collins@intuit.com>

feat(ui): Add columns--narrower-height to AttributeRow (argoproj#4371)

fix: Fix TestCleanFieldsExclude (argoproj#4625)

Signed-off-by: Simon Behar <simbeh7@gmail.com>

fix(argo-server): fix global variable validation error with reversed dag.tasks (argoproj#4369)

Signed-off-by: chenyu.zheng <chenyu.zheng@hulu.com>

fix: derive jsonschema and fix up issues, validate examples dir… (argoproj#4611)

Signed-off-by: Paul Brabban <paul.brabban@gmail.com>

fix(ui): Reference secrets in EnvVars. Fixes argoproj#3973  (argoproj#4419)

Signed-off-by: Alejandro Tejera <aletepe@gmail.com>

fix(ui): Fix Snyk issues (argoproj#4631)

Signed-off-by: Alex Collins <alex_collins@intuit.com>

feat(executor): More informative log when executors do not support output param from base image layer (argoproj#4620)

Signed-off-by: terrytangyuan <terrytangyuan@gmail.com>

Codegen patch. Signed off by alexcapras@gmail.com

Codegen patch. Signed off by alexcapras@gmail.com

Delete test.patch

Signed-off-by: Alex Capras <alexcapras@gmail.com>
@alexec alexec modified the milestone: v3.0 Dec 20, 2020
@alexec alexec removed their assignment Jan 20, 2021
@alexec alexec added this to the v3.0 milestone Jan 20, 2021
alexec added a commit that referenced this issue Jan 20, 2021
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Co-authored-by: Saravanan Balasubramanian <33908564+sarabala1979@users.noreply.github.com>
@simster7 simster7 mentioned this issue Jan 25, 2021
19 tasks
@simster7 simster7 mentioned this issue Feb 1, 2021
32 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature Feature request
Projects
None yet
3 participants