carvel-dev / kapp-controller

Continuous delivery and package management for Kubernetes.
https://carvel.dev/kapp-controller
Apache License 2.0
260 stars 99 forks source link

Kapp deploy with helm chart fetch throws "helm chart pull" error #1584

Open troll-warlord opened 4 days ago

troll-warlord commented 4 days ago

I am getting helm error on running the command kapp deploy -a metrics-collection -f pasx/package-install-metrics-collection.yaml -y Here is my package CRD

apiVersion: data.packaging.carvel.dev/v1alpha1
kind: Package
metadata:
  name: metrics.azure.io.1.2.0
spec:
  refName: metrics.azure.io
  version: 1.2.0
  releaseNotes: |
    Initial release of the metrics package
  valuesSchema:
    openAPIv3:
      nullable: true
      default: null
  template:
    spec:
      fetch:
      - helmChart:
          name: metrics
          version: 1.2.0
          repository:
            url: oci://<registry-host-name>/apps/
            secretRef:
              name: carvel-pull-secret
        path: metrics
      template:
      - helmTemplate:
          path: metrics/
          name: metrics
          namespace: metrics
      - kbld:
          paths:
          - metrics/.imgpkg/images.yml
          - '-'
      deploy:
      - kapp: {}

Error:

kapp: Error: waiting on reconcile packageinstall/metrics (packaging.carvel.dev/v1alpha1) namespace: default:
  Finished unsuccessfully (Reconcile failed:  (message: vendir: Error: Syncing directory '0':
  Syncing directory '.' with helm chart contents:
    Helm chart pull: exit status 1 (stderr: Error: unknown command "chart" for "helm"
Run 'helm --help' for usage.
)
))

The error is because helm chart pull command was deprecated in helm version 3.7.0 and replaced it with helm pull as per https://github.com/helm/helm/releases/tag/v3.7.0 image

Application versions:

troll-warlord:carvel-demo$ kapp version
kapp version 0.62.1

Succeeded
troll-warlord:carvel-demo$ vendir version
vendir version 0.40.2

Succeeded
troll-warlord:carvel-demo$ kctrl version
kctrl version 0.52.0

Succeeded
troll-warlord:carvel-demo$ ytt version
ytt version 0.49.1
troll-warlord:carvel-demo$ helm version
version.BuildInfo{Version:"v3.14.4", GitCommit:"81c902a123462fd4052bc5e9aa9c513c4c8fc142", GitTreeState:"clean", GoVersion:"go1.21.9"}
praveenrewar commented 1 day ago

You are facing this issue because you are using helm oci chart. The oci feature graduated in v3.8.0 and was experimental before that and we don't support it yet. You should be able to use imgpkg to fetch it. cc @joaopapereira

joaopapereira commented 2 hours ago

That is true unless the chart retrieves other charts. Vendir itself will execute helm pull, so I am not 100% sure where this error is coming from.