JovianX / helm-release-plugin

Helm3 plugin that pulls(re-creates) helm Charts from deployed releases, and updates values of deployed releases without the chart.
Apache License 2.0
97 stars 11 forks source link

Does not support helm charts created via the Fluxcd helmrelease CRD #10

Closed ghost closed 1 year ago

ghost commented 1 year ago

The Flux CRD handles the actual deployment of the helm charts and though the charts do appear as standard helm charts with a helm ls -A, it does not appear to be able to recognize the release name.


[user@ip-10-42-10-254]$ helm --namespace jaeger release pull jaeger-jaeger -d $(pwd)
Error: release: not found```
rtpro commented 1 year ago

@jthunderbird Thank you for reporting this. We are looking into it.

rtpro commented 1 year ago

@jthunderbird I tried to reprodue the issue and it seems to be working fine for me with Flux installed releases. Are you sure you are working with the correct namespace/cluster context?

Tested with the following HelmRelease

$ cat release.yaml 
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: chartmuseum
  namespace: flux-system
spec:
  interval: 5m
  chart:
    spec:
      chart: chartmuseum
      version: "2.14.2"
      sourceRef:
        kind: HelmRepository
        name: chartmuseum
        namespace: flux-system
      interval: 1m
  values:
    serviceAccount:
      create: true

The Helm release is deployed

$ helm status chartmuseum -n flux-system
NAME: chartmuseum
LAST DEPLOYED: Fri Aug  5 17:31:24 2022
NAMESPACE: flux-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
...

Pulling the chart from the release:

$ helm release pull chartmuseum -n flux-system 
Chart saved to chartmuseum-2.14.2

The directory is saved:

[arthurberezin@lfa flux]$ ls 
chartmuseum-2.14.2  release.yaml  repo.yaml
ghost commented 1 year ago

I have a couple of charts that were installed directly via helm and the rest via helmrelease and in a quick test, it seemed obvious only the direct helm charts worked.

I just figured out my issue though. With helm ls, I get the release names and their namespaces. But the namespace is different on the helmrelease. It needs to be the helmrelease namespace and not the proper helm chart namespace itself. Because it is a helm plugin, I assumed the namespace needed to be the helm namespace, not the deployed helmrelease namespace (funny enough, the actual resources are still deployed to namespaces matching helm so the helmrelease is the only thing in the namespace that this plugin needs.

[user@ip-10-42-10-254 ~]$ k get hr -A
NAMESPACE   NAME              AGE   READY   STATUS
bigbang     authservice       43h   True    Release reconciliation succeeded
bigbang     cluster-auditor   43h   True    Release reconciliation succeeded
bigbang     eck-operator      43h   True    Release reconciliation succeeded
bigbang     ek                43h   True    Release reconciliation succeeded
bigbang     fluent-bit        43h   True    Release reconciliation succeeded
bigbang     gatekeeper        43h   True    Release reconciliation succeeded
bigbang     istio             43h   True    Release reconciliation succeeded
bigbang     istio-operator    43h   True    Release reconciliation succeeded
bigbang     jaeger            43h   True    Release reconciliation succeeded
bigbang     kiali             43h   True    Release reconciliation succeeded
bigbang     metrics-server    43h   False   Helm install failed: timed out waiting for the condition
bigbang     monitoring        43h   True    Release reconciliation succeeded

[user@ip-10-42-10-254 ~]$ helm ls -A
NAME                            NAMESPACE               REVISION        UPDATED                                 STATUS          CHART                                   APP VERSION
authservice-authservice         authservice             1               2022-08-03 23:36:43.283962859 +0000 UTC deployed        authservice-0.5.1-bb.5                  0.5.1
bigbang                         bigbang                 1               2022-08-03 23:03:53.842490932 +0000 UTC deployed        bigbang-1.39.0
cluster-auditor-cluster-auditor cluster-auditor         1               2022-08-03 23:36:40.687741826 +0000 UTC deployed        cluster-auditor-1.4.0-bb.4              0.0.4
eck-operator-eck-operator       eck-operator            1               2022-08-03 23:25:48.690091598 +0000 UTC deployed        eck-operator-2.3.0-bb.0                 2.3.0
gatekeeper-system-gatekeeper    gatekeeper-system       1               2022-08-03 23:04:08.873971911 +0000 UTC deployed        gatekeeper-3.8.1-bb.5                   v3.8.1
istio-operator-istio-operator   istio-operator          1               2022-08-03 23:04:02.556833945 +0000 UTC deployed        istio-operator-1.13.5-bb.1              1.13.5
istio-system-istio              istio-system            2               2022-08-04 22:39:29.707241746 +0000 UTC deployed        istio-1.13.5-bb.2                       1.13.5
jaeger-jaeger                   jaeger                  1               2022-08-03 23:41:10.671785008 +0000 UTC deployed        jaeger-operator-2.33.0-bb.0             1.35.0
kiali-kiali                     kiali                   1               2022-08-03 23:36:42.975834953 +0000 UTC deployed        kiali-operator-1.51.0-bb.3              1.51.0
logging-ek                      logging                 1               2022-08-03 23:26:13.272749525 +0000 UTC deployed        logging-0.8.0-bb.1                      8.2.3
logging-fluent-bit              logging                 1               2022-08-03 23:36:43.28370509 +0000 UTC  deployed        fluent-bit-0.20.3-bb.0                  1.9.6
monitoring-monitoring           monitoring              1               2022-08-03 23:34:08.77278053 +0000 UTC  deployed        kube-prometheus-stack-36.2.1-bb.2       0.57.0
rook-ceph                       rook-ceph               1               2022-08-03 22:27:19.629558267 +0000 UTC deployed        rook-ceph-v1.9.3                        v1.9.3

[user@ip-10-42-10-254 ~]$ helm status authservice-authservice -n authservice
Error: release: not found

[user@ip-10-42-10-254 ~]$ helm status authservice-authservice -n bigbang
NAME: authservice-authservice
LAST DEPLOYED: Wed Aug  3 23:36:43 2022
NAMESPACE: authservice
STATUS: deployed
REVISION: 1
TEST SUITE: None
rtpro commented 1 year ago

@jthunderbird Hmm, that's interesting. The helm-release plugin actually works with the secret that stores the release information, which is normally in the same namespace. Can you confirm that the secret is actually stored in the helmrelease namespace, and not in the namespace of the release?

ghost commented 1 year ago

I can indeed. I decoded them as well to verify they were in fact the charts. Ok good to know.