Skip to content

Is it possible to deploy a clean up job after dependent resources are deleted? #2057

@raminqaf

Description

@raminqaf

Hello,
I am writing an Operator that the primary resource manages deployment, service, configMap, etc. The resource that I am creating needs a graceful shutdown. This can be achieved through a Job (i.e., clean-up job) resource and after all the secondary resources (deployment, service, configMap, etc.) are deleted. What should I do in my cleanup method to achieve this?

Can this be achieved by calling the noFinalizerRemoval() and then processing with the deployment of the clean-up job and then calling defaultDelete()?

    @Override
    public DeleteControl cleanup(final MyComplexApp resource, final Context<MyComplexApp> context) {
        DeleteControl.noFinalizerRemoval();
        
        // Deploy clean-up job (and wait to finish?) ...
        
       return DeleteControl.defaultDelete();
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions