Skip to content

Helm operator: namespace scope resources with Helm keep annotations are being deleted by garbage collection #4378

@mikeshng

Description

@mikeshng

Bug Report

What did you do?

I created a sample Helm operator, then modified one of the namespace scope resources in the template to contain:

metadata:
  annotations:
    "helm.sh/resource-policy": keep

see "Tell Helm Not To Uninstall a Resource" in: https://helm.sh/docs/howto/charts_tips_and_tricks for more details.

After applying the Helm sample CR and then proceed to delete it, the resource with the keep annotation is also deleted from the cluster.

When I tried the same annotation on a cluster scope resource, that resource is not deleted so I think the issue is due to parent child garbage collection with namespace scope resources.

What did you expect to see?

If possible, it would be nice to have the namespace resources that are annotated with the keep to still exists after the CR is deleted. Or the website/doc should mention that keep annotation is not supported for namespace scope resources.

What did you see instead? Under which circumstances?

namespace scope resources with Helm keep annotations are being deleted when the Helm operator CR is removed.

Environment

Operator type:
/language helm

Kubernetes cluster type:
kind

$ operator-sdk version

operator-sdk version: "v1.3.0-7-g8c31ab8f", commit: "8c31ab8fdbbe572a94a10c8f0dff33bbb53beb38", kubernetes version: "v1.19.4", go version: "go1.14.1", GOOS: "linux", GOARCH: "amd64"

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2-0-g52c56ce", GitCommit:"b66f2d3a6893be729f1b8660309a59c6e0b69196", GitTreeState:"clean", BuildDate:"2020-08-10T04:49:09Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2020-01-14T00:09:19Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}

Possible Solution

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.language/helmIssue is related to a Helm operator project

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions