operator-framework / operator-framework/java-operator-sdk
Automatically Delete Resource if Dependent Removed From Workflow
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 944
- Forks
- 242
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 43
Description
If a dependent is removed from a workflow, the previously created resource represented by that dependent needs to be cleaned up. This can happen before the actual workflow is executed.
This could be done automatically before a workflow is executed, although it is not trivial in general. There are two problems:
-
If a dependent is removed, on startup the informer related to its type might not be added anymore. So we would need to mark somewhere (maybe status or annotation?) the GVk-s of resources managed.
-
If there are multiple resources of the same type in general it is not easy to identify which resource belongs to which dependent resource - without calling
getSecondaryResourceon the dependent. Since this cleanup would happen before the dependents are reconciled this is not doable without imposing additional requirements on implementation: for example, if the id of the resource is calculated based on the desired state, the desired state calculation might depend on other resources (which might not be reconciled now).
Fortunately, this problem can be solved simply just by adding the name of the dependent as an annotation to the resource so it can be identified easily.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing workflow execution and the informer and dependent-resource lifecycle described in the issue. Determine how managed resource kinds and dependent names can be retained, then define completion as cleanup occurring before execution for removed dependents without confusing multiple resources of the same type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kubernetes
- Domain
- infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100