argo-workflows icon indicating copy to clipboard operation
argo-workflows copied to clipboard

Artifact Garbage Collection

Open dcherman opened this issue 4 years ago • 17 comments

Summary

When a Workflow is deleted, we should consider garbage collecting artifacts from those workflows where possible. This should likely be configurable.

Motivation

Right now, manual intervention is needed in order to clean up artifacts that were created as part of Workflows if desired. For high frequency workflows with high amounts of artifacts (think a CI system), cleaning up these artifacts can be pretty important for cost savings.

Proposal

Each type of artifact storage will need to support a deleteArtifact function. When a Workflow is deleted (not simply Archived, but actually deleted), all artifacts associated with that workflow would be cleaned up automatically.

We could make this configurable with something like

  # The rest of the output config was omitted
  outputs:
    artifacts:
    - name: my-output-artifact
      artifactGC:
        strategy: Never | OnWorkflowDeletion | OnWorkflowArchival

Initially, I'd suggest that the default be Never to match existing behavior unless you're OK with making a breaking change.


Message from the maintainers:

If you wish to see this enhancement implemented please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.

dcherman avatar May 25 '20 19:05 dcherman

this sounds like a great idea - would you be interested in submitting a PR?

alexec avatar May 26 '20 15:05 alexec

Yep!

dcherman avatar May 26 '20 15:05 dcherman

How are you getting on with this enhancement?

pbebbo avatar Aug 10 '20 22:08 pbebbo

@pbebbo At the moment, it's on hold while I'm reconsidering how to actually implement this. When you consider the huge variety of ways that people can configure their artifact repo on AWS alone such as Access Key/Secret, IRSA, KIAM/kube2iam, temporary secrets that are cleaned up after the workflow runs, etc (and that's just AWS), the scope of the problem is actually pretty big if you try to infer what credentials you should use to delete any given artifact. All of that is actually assuming that you actually have delete permissions on your artifact repo using those credentials as well, and that's not necessarily true.

The current idea I've been kicking around is to add some additional config that would allow you to specify an additional set of credentials to use for garbage collection that are expected to be allowed to delete artifacts from any workflow which basically punts that responsibility to the user. With that in place, I think that should eliminate all of those concerns.

dcherman avatar Aug 11 '20 17:08 dcherman

@dcherman Are you working on this enhancement?

sarabala1979 avatar Sep 15 '21 22:09 sarabala1979

I would be happy to pick this up if no one is working on it?

NikeNano avatar Oct 03 '21 20:10 NikeNano

Note that my GCS deletion related work is present here if someone wants to work on top of that: https://github.com/argoproj/argo-workflows/pull/7659/files

isubasinghe avatar Feb 04 '22 07:02 isubasinghe

For MVP, I think I'll just implement:

  • S3 artifacts.
  • Deletion on workflow deletion.

I'll omit:

  • Non-S3, e.g. OSS and GCS (I don't have test env)
  • Deletion on workflow completion.

alexec avatar Apr 21 '22 21:04 alexec

Vote for GCS support by 👍 this comment.

alexec avatar Apr 21 '22 22:04 alexec

Vote for OSS support by 👍 this comment.

alexec avatar Apr 21 '22 22:04 alexec

Vote for Git support by 👍 this comment.

alexec avatar Apr 21 '22 22:04 alexec

Vote for HTTP support by 👍 this comment.

alexec avatar Apr 21 '22 22:04 alexec

Give this comment a 👍 if you want to specify GC on each artifact.

alexec avatar Apr 22 '22 01:04 alexec

Give this comment a 👍 if you want to specify once for the whole workflow. All artifacts use same GC.

alexec avatar Apr 22 '22 01:04 alexec

I've completed a PoC (#8530) and @jessesuen and I have agreed on a design in that PoC.

I'm now asking for help with the following:

  • We only currently support non-S3 storage. Could you help with implementing those?
  • There are many issues in the artifacts project. There are in order with sizing and "good first issue" labels. Would you like to help there?

alexec avatar May 06 '22 19:05 alexec

This is a great new feature but wondering if you'd considered more strategies eg a TTL for artifacts? This could be achieved by adding object expiration configuration when saving to blob storage.

agrvu avatar Jun 21 '22 15:06 agrvu

Excuse me for my ignorance, Just trying to understand, wouldn't using a proper data streaming service as a means to transfer the artifacts (eg. Kafka and the like) would inherently solve this issue as the data obviously will be automatically deleted after being pulled?

danielbraun89 avatar Jul 16 '22 09:07 danielbraun89

@juliev0 can we close this? I think you should get the pleasure!

alexec avatar Sep 08 '22 22:09 alexec

@juliev0 can we close this? I think you should get the pleasure!

LOL, yes. Good call. We have other issues to represent Artifact GC for storage systems that aren't yet implemented, so I can close this one.

Completed through multiple PRs but this was the main one.

juliev0 avatar Sep 08 '22 23:09 juliev0