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

retaining specific resources on stack deletion #2211

Open
errordeveloper opened this issue Oct 24, 2022 · 4 comments
Open

retaining specific resources on stack deletion #2211

errordeveloper opened this issue Oct 24, 2022 · 4 comments
Labels
kind/enhancement Improvements or new features

Comments

@errordeveloper
Copy link

I am currently creating a GKE cluster and deploying Flux for manifests.
The manifest contain a few CRDs as well as CRs. Deletion is tricky due to CRDs and CRs, as well as namespaces in terminating state.
Perhaps the answer is to defined Flux resources natively in Pulumi, and perhaps this is feasible for this particular project, given its popularity, however a general issue ramains for other software.

I have to resort to using retainOnDelete on all ConfigGroup, but I wish I could set it only on specific types, namely namespaces, CRDs and perhaps CRs also. I also wish I could set it only for the cases where entire stack is being deleted, but it seems to be scoped to just the resources that it is set on.

I suppose it'd help to have the following options, even if these are just for ConfigGroup and ConfigFile in the Kubernetes provider (I'm not quite sure if there are wider use-cases).

  • ratainOnStackDelete: bool
  • retainOnDelete: function(name: string, type: string): bool
@danielrbradley
Copy link
Member

Hi @errordeveloper thanks for you question!

I think this would be quite a wide-ranging change which would be a core Pulumi change, rather than just for this provider.

One suggestion that comes to mind could be to utilize Pulumi's transformations - which allow you to make changes dynamically to resource arguments and options. This should allow you to set the retainOnDelete across a range of resources, just in specific scenarious. Would this achieve what you're wanting?

@danielrbradley danielrbradley added the kind/question Questions about existing features label Oct 24, 2022
@errordeveloper
Copy link
Author

@danielrbradley yeah, looks like transformations will help. I would still advocate for a way to making a distinction between resource deletions and complete stack deletions, I think it metters very specifically for Kubernetes resources, as it's often not needed to remove resources from the cluster when underlying cluster itself is about to be deleted. Not sure if a transformation can handle this? Maybe it doesn't need to be about "stack deletion", it could be about deletion of parent...
What I'm trying to say is that it's got to be possible to e.g. delete some particular Kuberentes resources when the cluster is not being deleted, but skip deletion of same resources when cluster is being deleted actually.

@danielrbradley
Copy link
Member

This PR has had some discussion recently which is working in a similar direction pulumi/pulumi#11095

@errordeveloper
Copy link
Author

@danielrbradley thanks! Also related: pulumi/pulumi#11126.

@lblackstone lblackstone added kind/enhancement Improvements or new features and removed kind/question Questions about existing features labels Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

3 participants