Search code examples
kuberneteskubernetes-helm

How do I know which repository the installed Chart belongs to


I have many helm repositories in my kubernetes, And I installed a lot of charts, So How do I know which repository the installed Chart belongs to? For example:

$> helm repo list
  NAME            URL
  lucy-dev        https://harbor.mydomain.net/chartrepo/lucy-dev
  lucy-prod       https://harbor.mydomain.net/chartrepo/lucy-prod

$> helm ls -n msgbox-lucy -o yaml
- app_version: "1.0"
  chart: msgbox-lucy-8.27.3
  name: msgbox-lucy
  namespace: msgbox-lucy
  revision: "48"
  status: deployed
  updated: 2022-04-19 08:11:16.761059067 +0000 UTC

I can't use helm show because:

$> helm show all msgbox-lucy -n msgbox-lucy --debug
show.go:195: [debug] Original chart version: ""
Error: non-absolute URLs should be in form of repo_name/path_to_chart, got: msgbox-lucy
...

Solution

  • I don't believe you're guaranteed to get the info you're looking for, however we can try.

    Find the latest Helm secret for your Helm release.

    kubectl get secret -n msgbox-lucy
    

    Yours might look something like this:

    sh.helm.release.v1.msgbox-lucy.v5
    

    and run this command to view the chart's metadata:

    SECRET_NAME="sh.helm.release.v1.msgbox-lucy.v5"
    
    kubectl get secret $SECRET_NAME -o json | jq .data.release \
      | tr -d '"' | base64 -d | base64 -d | gzip -d \
      | jq '.chart.metadata'
    

    The metadata should hopefully show you 2 things you're looking for. The chart name will be under the name field. The chart repository URL might be under sources.

    I say "might" because the chart developer should have added it there, but they might not have.

    Then you can match the URL to your repo alias.


    If it's not included in the metadata, you're probably out of luck for now.

    There is an open Github issue about exactly this feature you're wanting:

    https://github.com/helm/helm/issues/4256

    And an open PR that adds that feature:

    https://github.com/helm/helm/pull/10369

    And an open PR to add a HIP (Helm Improvement Proposal) for adding that feature:

    https://github.com/helm/community/pull/224