Skip to content

support --take-ownership option like helm install and helm upgrade commands #731

Closed
@atsu85

Description

@atsu85

Background

Helm install and upgrade actions got support for --take-ownership option last week with Helm v3.17.0 release (PR), that is required when importing existing k8s resources into Helm release (see reasons below).

Feature request

Add support for --take-ownership option also for helm diff command provided by this plugin, so it would be possible to work around the failure from following command (for example when renaming Helm release):

  • helm diff upgrade --install $helmReleaseNewName ...:

Error: rendered manifests contain a resource that already exists. Unable to continue with install: `$k8sResourceKind "$k8sResourceName" in namespace "$k8sResourceNamespace" exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/release-name" must equal "$helmReleaseNewName": current value is "$helmReleaseOldName"

by adding --take-ownership flag like this:

  • helm diff upgrade --install --take-ownership $helmReleaseNewName ...

Error: unknown flag: --take-ownership

Alternatives discarded for working around similar solutions:

There are several alternative approaches that one might assume should work well, but they all have surprising and severe disadvantages (unless destroying k8s resources is acceptable):

  • adding meta.helm.sh/release-name annotation for existing resources doesn't destroy them, but Helm starts ignoring them (won't change the resource based on Helm values and chart template)
  • other options (like uninstalling old releas or installing new release with --force flag) are destroy the existing resources, that can cause incidents, for example:
    • application downtime due to deleting k8s Deployment
    • loosing access to cloud resources related to k8s resource managing to cloud provider resources

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions