banzaicloud / crd-updater

Helm 3 library chart that emulates Helm 2 CRD update behavior.
Apache License 2.0
10 stars 0 forks source link

Unable to do helm upgrade #3

Open nitinSophos opened 2 years ago

nitinSophos commented 2 years ago

Describe the bug When trying to use the helm chart as mentioned in the Usage, helm upgrade fails

Steps to reproduce the issue:

  1. existing helm chart installed
  2. Download kube-prometheus-stack and integrate with existing chart
  3. add the crd-updater to the kube-prometheus-stack
  4. add the crd-updater.yaml to the templates folder
  5. perform helm upgrade to install the stack

Expected behavior Helm upgrade should pass and CRDs should get created.

Screenshots

Screenshot 2022-05-16 at 3 30 14 PM Screenshot 2022-05-16 at 3 29 21 PM Screenshot 2022-05-16 at 3 29 12 PM Screenshot 2022-05-16 at 3 29 01 PM Screenshot 2022-05-16 at 3 28 46 PM

Additional context

root@ubuntu:/home/admin# helm version version.BuildInfo{Version:"v3.3.4", GitCommit:"a61ce5633af99708171414353ed49547cf05013d", GitTreeState:"clean", GoVersion:"go1.14.9"} Error Logs:

upgrade.go:121: [debug] preparing upgrade for mycharts upgrade.go:444: [debug] copying values from mycharts (v1) to new release. Error: UPGRADE FAILED: YAML parse error on mycharts/charts/kube-prometheus-stack/templates/crd-updater.yaml: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type releaseutil.SimpleHead helm.go:94: [debug] error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type releaseutil.SimpleHead YAML parse error on mycharts/charts/kube-prometheus-stack/templates/crd-updater.yaml helm.sh/helm/v3/pkg/releaseutil.(*manifestFile).sort /home/circleci/helm.sh/helm/pkg/releaseutil/manifest_sorter.go:146 helm.sh/helm/v3/pkg/releaseutil.SortManifests /home/circleci/helm.sh/helm/pkg/releaseutil/manifest_sorter.go:106 helm.sh/helm/v3/pkg/action.(*Configuration).renderResources /home/circleci/helm.sh/helm/pkg/action/action.go:163 helm.sh/helm/v3/pkg/action.(*Upgrade).prepareUpgrade /home/circleci/helm.sh/helm/pkg/action/upgrade.go:208 helm.sh/helm/v3/pkg/action.(*Upgrade).Run /home/circleci/helm.sh/helm/pkg/action/upgrade.go:122 main.newUpgradeCmd.func2 /home/circleci/helm.sh/helm/cmd/helm/upgrade.go:154 github.com/spf13/cobra.(*Command).execute /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:842 github.com/spf13/cobra.(*Command).ExecuteC /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 github.com/spf13/cobra.(*Command).Execute /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887 main.main /home/circleci/helm.sh/helm/cmd/helm/helm.go:93 runtime.main /usr/local/go/src/runtime/proc.go:203 runtime.goexit /usr/local/go/src/runtime/asm_amd64.s:1373 UPGRADE FAILED main.newUpgradeCmd.func2 /home/circleci/helm.sh/helm/cmd/helm/upgrade.go:156 github.com/spf13/cobra.(*Command).execute /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:842 github.com/spf13/cobra.(*Command).ExecuteC /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 github.com/spf13/cobra.(*Command).Execute /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887 main.main /home/circleci/helm.sh/helm/cmd/helm/helm.go:93 runtime.main /usr/local/go/src/runtime/proc.go:203 runtime.goexit

nitinSophos commented 2 years ago

Update: As a workaround, I tried putting the content of the .tpl file inside the updater.yaml, it works and is picking up the charts and crds. ( manually hardcoded the values )

  1. But I am still facing an issue with the pre-upgrade hook, the job never runs and hence the upgrade fails as crds are not installed
  2. I tested pre-install, this works, but it's not actually needed, as helm install automatically picks content in crds/
  3. I did not see namespace in your tpl, I had to manually add it to each of them to make it work.
turip commented 2 years ago

Can you please somehow share the helm chart in question?