Skip to content

--take-ownership does not adopt custom resources #30622

@p-se

Description

@p-se

If a resource exists in the cluster and is to be adopted by helm install --take-ownership, it is left unchanged while helm reports the installation to have succeeded.

Reproduce

  1. Helm version v3.17.1+g980d8ac

  2. Install any CRD

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: datas.crd.com
spec:
  group: crd.com
  scope: Namespaced
  names:
    plural: datas
    singular: data
    kind: Data
  versions:
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object
        x-kubernetes-preserve-unknown-fields: true
  1. Apply a custom resource onto the cluster.
kind: Data
apiVersion: crd.com/v1
metadata:
  name: crd-test
  namespace: kube-system
  labels:
    test: adopt
spec:
  color: blue
  size: large
  1. helm install --take-ownership a chart that contains a different version of the custom resource.
kind: Data
apiVersion: crd.com/v1
metadata:
  name: crd-test
  namespace: kube-system
  labels:
    test: adopt
spec:
  weight: heavy
  1. Notice that the custom resource has not changed at all (still at initial state) but helm reported the operation to have succeeded, including the creation of a helm release.
helm install foo ./foo --take-ownership 
NAME: foo
LAST DEPLOYED: Wed Mar  5 17:10:16 2025
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None

Suggested Solution

Transparently use three-way merge for --take-ownership.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions