modify "argoexec artifact delete" to handle multiple artifacts
Implement the logic of the GC Pod according to Option 2 in the slides here.
For this MVP:
- don't worry about retries in the case of failure
- optionally don't worry about having multiple goroutines - it's okay if it runs serially
New CRD type ArtifactGCWork is shown here.
-
Read the environment variable "ARGO_ARTIFACT_POD_NAME" (need to add this env var const to workflow/common/common.go). This is how you will know which ArtifactGCWork objects you need to read, as they will be labeled with this.
-
Locate all ArtifactGCWork objects that have label "workflows.argoproj.io/artifact-gc-pod" set to value of "ARGO_ARTIFACT_POD_NAME" (need to add new Label to workflow/common/common.go): should be able to do something like this: ``` artifactGCTaskInterface := workflowInterface.ArgoprojV1alpha1().WorkflowArtifactGCTasks(namespace) labelSelector := fmt.Sprintf("%s = %s", common.LabelKeyArtifactGCPodName, podName)
taskList, err := artifactGCTaskInterface.List(context.Background(), metav1.ListOptions{LabelSelector: labelSelector}) ```
-
For each ArtifactNodeSpec object in ArtifactsByNode: - Create a new ArtifactResultNodeStatus (which you'll add to your ArtifactResultsByNode, keyed by the node name (i.e. same key as ArtifactsByNode)) - Delete each Artifact (use the ArtifactLocation that's specified in the ArtifactNodeSpec except overridden by any fields specified in the Artifact itself) - add each Artifact as an ArtifactResult to the ArtifactResultNodeStatus. If deletion succeeds (it's okay if the key doesn't exist if for some reason it was already deleted), Success should be set to true. Otherwise, set Success to false and Error to the error message. - add your ArtifactResultNodeStatus to the ArtifactGCStatus
- write your ArtifactGCWorkStatus to the ArtifactGCWork CRD object
-
Return exit code 0 if everything succeeded, else return a non-zero exit code (this should probably happen automatically if you return an error)
Message from the maintainers:
Love this enhancement proposal? Give it a 👍. We prioritise the proposals with the most 👍.
I'm not sure why WorkflowTaskSet is relevant. I think this is a good idea, but not MVP.