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

Add OwnerReference to inline resources #1317

Closed
dtaniwaki opened this issue Apr 11, 2019 · 6 comments
Closed

Add OwnerReference to inline resources #1317

dtaniwaki opened this issue Apr 11, 2019 · 6 comments
Assignees
Labels
type/feature Feature request

Comments

@dtaniwaki
Copy link
Member

Is this a BUG REPORT or FEATURE REQUEST?:

FEATURE REQUEST

What happened:

I'd like to clean up all the resources I make in a workflow when the workflow is deleted. However, as OwnerReference is not set in the created resources by the inline resource manifest, it's not easy to clean them up.

What you expected to happen:

Set OwnerReference in created resources by inline resource manifests.

How to reproduce it (as minimally and precisely as possible):

Run the example of examples/k8s-jobs.yaml and see the OwnerReference of the created job. It's empty.

Anything else we need to know?:

Environment:

  • Argo version:
$ argo version
argo: v2.3.0+1c729a7.dirty
  BuildDate: 2019-04-10T14:57:59Z
  GitCommit: 1c729a72a2ae431623332b65646c97cb689eab01
  GitTreeState: dirty
  GoVersion: go1.11.4
  Compiler: gc
  Platform: darwin/amd64
  • Kubernetes version :
$ kubectl version -o yaml
clientVersion:
  buildDate: 2018-08-15T21:23:47Z
  compiler: gc
  gitCommit: 10ecc6db83fd47a93eb0940e2e4434f2b0a5c3ec
  gitTreeState: clean
  gitVersion: v0.0.0-master+$Format:%h$
  goVersion: go1.10.2
  major: ""
  minor: ""
  platform: darwin/amd64
serverVersion:
  buildDate: 2018-11-26T12:46:57Z
  compiler: gc
  gitCommit: 435f92c719f279a3a67808c80521ea17d5715c66
  gitTreeState: clean
  gitVersion: v1.12.3
  goVersion: go1.10.4
  major: "1"
  minor: "12"
  platform: linux/amd64

Other debugging information (if applicable):

N/A

@jessesuen
Copy link
Member

The fact that owner references are not injected, is intentional behavior. It is why we provide the {{workflow.uid}} variable, so that users can opt-in to this behavior. The opposite use case is for workflows which create deployments and do not want the deployments to be deleted when the workflow is deleted.

@dtaniwaki
Copy link
Member Author

The opposite use case is for workflows which create deployments and do not want the deployments to be deleted when the workflow is deleted.

This makes sense, but I don't think executing extra commands to delete child resources is not intuitive. Maybe, we can add an option to set OwnerReference to child resources and make is disabled by default?

@jessesuen
Copy link
Member

@dtaniwaki, are you aware of this technique?
https://github.com/argoproj/argo/blob/master/examples/k8s-owner-reference.yaml#L23

This is how we have instructed users to GC resources with a workflow thus far. It can potentially be simplified with a flag in the resource template (e.g. cascadeDelete: true), so that it's a little simpler, but I think it definitely should be disabled by default.

@dtaniwaki
Copy link
Member Author

are you aware of this technique?

I didn't know it.
As I don't want researchers, who will run jobs by Argo, to learn many things like what OwnerReference is, I'd like to implement something like your suggestion cascadeDelete: true.

@jessesuen
Copy link
Member

Great. I'm good with the cascadeDelete: true simplification.

@dtaniwaki
Copy link
Member Author

Implemented in #1333.

icecoffee531 pushed a commit to icecoffee531/argo-workflows that referenced this issue Jan 5, 2022
Signed-off-by: Windfarer <windfarer@gmail.com>
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
Development

No branches or pull requests

2 participants