Skip to content

fix(tiller): respect resource policy on upgrade - #5225

Merged
bacongobbler merged 1 commit into
helm:masterfrom
jsravn:respect-resource-policy-on-upgrade
Jan 29, 2019
Merged

bacongobbler merged 1 commit into
helm:masterfrom
jsravn:respect-resource-policy-on-upgrade

Conversation

@jsravn

@jsravn jsravn commented Jan 29, 2019 •

Copy link
Copy Markdown

What this PR does / why we need it:
Don't delete a resource on upgrade if it is annotated with
helm.io/resource-policy=keep. This can cause data loss for users if the
annotation is ignored (e.g. for a PVC).

Use case:

  1. As a helm chart maintainer, I want to prevent accidental deletion of users resources, such as persistent volumes - which could be catastrophic.
  2. I annotate the PVCs with helm.io/resource-policy=keep to ensure helm never removes them.

Unfortunately, in the current implementation, this annotation only works when helm delete is run. If the resource is removed from the chart or renamed, helm will ignore the annotation and delete it on a chart upgrade. This is easy to do accidentally. I believe this annotation should apply in any situation where helm might delete the resource, including on upgrades.

Closes #3673

Special notes for your reviewer:

I don't think this will cause backwards compatibility problems. It might be surprising new behavior though if someone is relying on upgrades/resource renames to delete things with helm.io/resource-policy=keep on them (but that seems pretty strange!). An alternative approach would be to add a new resource policy, like always-keep.

If applicable:

  • this PR contains documentation
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

@helm-bot helm-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 29, 2019
Don't delete a resource on upgrade if it is annotated with
helm.io/resource-policy=keep. This can cause data loss for users if the
annotation is ignored (e.g. for a PVC).

Closes helm#3673

Signed-off-by: James Ravn <[email protected]>
@jsravn
jsravn force-pushed the respect-resource-policy-on-upgrade branch from 3470f4f to 7757ebf Compare January 29, 2019 13:58
@helm-bot helm-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 29, 2019

@bacongobbler bacongobbler left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Thanks for the unit test to cover this change as well as the general package sanitation. LGTM!

@bacongobbler
bacongobbler merged commit ab0ba3a into helm:master Jan 29, 2019
@bacongobbler bacongobbler added this to the 2.13.0 milestone Jan 29, 2019
eraac pushed a commit to eraac/helm that referenced this pull request Mar 21, 2019
Don't delete a resource on upgrade if it is annotated with
helm.io/resource-policy=keep. This can cause data loss for users if the
annotation is ignored (e.g. for a PVC).

Closes helm#3673

Signed-off-by: James Ravn <[email protected]>
Signed-off-by: Kevin Labesse <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants