Skip to content

unexpected 'pending-install' status of helm release when using different storage namespace and target namespace #439

@zxkane

Description

@zxkane

I meet an issue of Helm release, the flux indeed successfully deployed the helm release(pod is healthy/svc is working) in cluster, however the helm always returns the status of release as pending-install. for example,

$ helm ls -A --filter pod --pending
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
podinfo app 1 2022-03-18 11:55:29.438559647 +0000 UTC pending-install podinfo-6.1.0 6.1.0

$ flux get hr -n app
NAME READY MESSAGE REVISION SUSPENDED
podinfo True Release reconciliation succeeded 6.1.0 False

the side effect is the subsequent update of helm release will fail due to the helm considers the release in existing install/upgrade operations.

I suspect it’s caused by using different storage namespace for helm release, looks like it works for flux to deploy the release, however the helm can not retrieve the release history information if the storage is not in the namespace of release.

You can reproduce this behavior with below manifest in your repo.

apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
  name: helm-controller-issue
  namespace: flux-system
spec:
  interval: 1m
  url: https://github.com/zxkane/flux-helm-storage-namespace-issue.git
  ref:
    branch: main  
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
  name: helm-controller-issue-infra
  namespace: flux-system
spec:
  interval: 10m0s
  prune: true
  sourceRef:
    kind: GitRepository
    name: helm-controller-issue
    namespace: flux-system
  path: ./infra
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
  name: helm-controller-issue-app
  namespace: app
spec:
  serviceAccountName: app-reconciler
  interval: 10m0s
  prune: true
  sourceRef:
    kind: GitRepository
    name: helm-controller-issue
    namespace: flux-system
  path: ./app
  dependsOn:
    - name: helm-controller-issue-infra
      namespace: flux-system
  patches:
    - patch: |-
        - op: replace
          path: /spec/serviceAccountName
          value: app-reconciler
        - op: replace
          path: /spec/storageNamespace
          value: helm-storage
      target:
        group: helm.toolkit.fluxcd.io
        version: v2beta1
        kind: HelmRelease
    - patch: |-
        - op: replace
          path: /spec/serviceAccountName
          value: app-reconciler
      target:
        group: kustomize.toolkit.fluxcd.io
        version: v1beta2
        kind: Kustomization

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/uxIn pursuit of a delightful user experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions