Error: found in requirements.yaml, but missing in charts/ directory: dependency-chart - kubernetes

I'm getting the following error
Error: found in requirements.yaml, but missing in charts/ directory: dependency-chart
when I try to install a chart. The chart has a dependency on dependency-chart.
requirements.yaml:
dependencies:
- name: dependency-chart
repository: "#some-repo"
version: 0.1.0
Commands performed:
rm -rf charts
helm dep up
helm upgrade --install chart-to-install . --debug
Output:
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "some-repo" chart repository
Update Complete. ⎈Happy Helming!⎈
Saving 1 charts
Downloading dependency-chart from repo gs://some-repo
Deleting outdated charts
[debug] Created tunnel using local port: '65477'
[debug] SERVER: "127.0.0.1:65477"
Error: found in requirements.yaml, but missing in charts/ directory: dependency-chart
charts/ directory contains dependency-chart-0.1.0.tgz
I have many other charts which depends on dependency-chart and they work just fine. helm lint does not help:
==> Linting .
[ERROR] Chart.yaml: directory name (helm) and chart name (dependency-chart) must be the same
[INFO] Chart.yaml: icon is recommended
[WARNING] templates/: directory not found
Error: 1 chart(s) linted, 1 chart(s) failed
The ERROR is reported by the linter in other charts where the helm install command works, so it's not really helping me.
I've tried to point to the local chart in the requirements.yaml instead of from the aliased repository, same result.
I've run out of things to try to debug the issue as well, any suggestion?

I've started debugging the Helm project locally and I stumbled upon this:
// If a .helmignore file matches, skip this file.
if rules.Ignore(n, fi) {
return nil
}
This reminded me that, for some reason, I've added charts/ to the .helmignore file. And that is the reason why it was not seeing the downloaded dependencies :(

Related

How can I create my own helm chart package from the kube-prometheus-stack charts on github

I'm trying to create my own helm chart package for prometheus and its components but I am trying to reuse parts of the kube-prometheus-stack helm chart on github : https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack
I've modified the templates to my liking but when I try to create a package for them which I can then upload it to my repo I get the following :
helm package prometheus-chart/
Error: found in Chart.yaml, but missing in charts/ directory: alertmanager, kube-state-metrics, prometheus-node-exporter, prometheus-pushgateway
How can I get the templates from that repo, and create a deployable package from my local machine which I can then share it?
These components alertmanager, kube-state-metrics, prometheus-node-exporter, prometheus-pushgateway are added as dependencies in the Chart.yaml. So the helm will check whether these dependencies are built or not.
So you need to build the dependencies as well by using this command
$ helm dependency build CHARTNAME
Example:
$ helm dependency build alertmanager
Once the dependencies are built you can update them using update command
$ helm dependency update CHARTNAME
For more detailed information refer to this official documents doc1 doc2
There are dependencies added in the Chart.yml file that are not downloaded, you need to run the command helm dependency build <CHART> in order to fetch them

Helm looks in a different repository then the one I specify with a --repo flag

If I perform the following command it looks in "https://github.com/grafana/" instead of the one I specified - "https://grafana.github.io/helm-charts"
Here is what I run and the results:
helm3 upgrade --install grafana grafana --dry-run --repo https://grafana.github.io/helm-charts --wait
Release "grafana" does not exist. Installing it now.
Error: failed to download "https://github.com/grafana/helm-charts/releases/download/grafana-6.16.14/grafana-6.16.14.tgz"
Why is it looking in "github.com/grafana" instead of where I told it to look with the repo flag - "grafana.github.io"?
My co worker runs the same command and it works.
I list the repositories and grafana is not there so I would assume that would force this to work?
helm3 repo list
NAME URL
stable https://charts.helm.sh/stable
local http://127.0.0.1:8879/charts
eks https://aws.github.io/eks-charts
bitnami https://charts.bitnami.com/bitnami
cluster-autoscaler https://kubernetes.github.io/autoscaler
kube-dns-autoscaler https://kubernetes-sigs.github.io/cluster-proportional-autoscaler
cluster-proportional-autoscaler https://kubernetes-sigs.github.io/cluster-proportional-autoscaler
external-dns https://charts.bitnami.com/bitnami
kube2iam https://jtblin.github.io/kube2iam/
kubernetes-dashboard https://kubernetes.github.io/dashboard/
incubator https://charts.helm.sh/incubator
My coworker has the same repo list output as above.
The below commands will work in my system however I want to know why for me it will not work when I use the --repo flag as in the above example (all of our code has that flag in it and they do not want to change it) :
helm3 repo add grafana https://grafana.github.io/helm-charts
"grafana" has been added to your repositories
kconfig_et helm3 upgrade --install grafana grafana/grafana --dry-run --wait
I executed your Helm command but with --debug flag to get this error:
helm upgrade --install grafana grafana --dry-run --repo https://grafana.github.io/helm-charts --wait --debug
history.go:56: [debug] getting history for release grafana
Release "grafana" does not exist. Installing it now.
install.go:178: [debug] Original chart version: ""
Error: no cached repo found. (try 'helm repo update')
Then I simply executed helm repo update as suggested. I then retried the same helm upgrade command and it successfully installed the chart.
You coworker did not encounter the error because at some point he/she has executed helm repo update at least once. (Mine was a freshly installed Helm)
I solved it - I added "--debug" to the command and saw this -
Error: no cached repo found. (try 'helm repo update'): open /Users/mysystem/Library/Caches/helm/repository/local-index.yaml: no such file or directory
I next copied the one in .helm over to the location in the debug message -
cp ~/.helm/repository/local/index.yaml /Users/mysystem/Library/Caches/helm/repository/local-index.yaml
All worked after this!

helm: found in Chart.yaml, but missing in charts/ directory: postgresql,

I try to follow the kubernetes install README of ReportPortal
guettli#yoga15:~/projects/reportportal-kubernetes/reportportal$ mv v5 reportportal
guettli#yoga15:~/projects/reportportal-kubernetes/reportportal$ helm install ./reportportal
Error: must either provide a name or specify --generate-name
guettli#yoga15:~/projects/reportportal-kubernetes/reportportal$ helm install ./reportportal --generate-name
Error: found in Chart.yaml, but missing in charts/ directory: postgresql, rabbitmq-ha, elasticsearch, minio
Here is the v5 directory.
What needs to be done now?
I found the solution:
cd reportportal
helm dependency update
Adding a bit of a background.
Chart dependencies that are specified in the Chart.yaml should be download to disk before executing the installation of the parent chart.
This is done by helm dependency update which verifies that the required charts, as expressed in Chart.yaml, are present in charts/ and are at an acceptable version.
It will pull down the latest charts that satisfy the dependencies, and clean up old dependencies.

Confused with Helm dependency management

In my parent chart Chart.yaml I have
dependencies:
- name: postgresql11
repository: "#myrepo"
version: 8.9.7
condition: postgresql11.enabled
- name: postgresql12
repository: "#myrepo"
version: 8.9.7
condition: postgresql12.enabled
In the same parent chart values.yaml I have:
postgresql11:
enabled: true
postgresql12:
enabled: false
My problem is that unless I run helm dep update neither subchart is downloaded and installed (I'm expecting the postgresql11 subchart to be installed). If I run helm dep update both subcharts are pulled, ignoring my ruleset which indicates that only postgresql11 should be installed.
Can anybody shed some light on what I'm doing wrong here, and what the relationship is between helm dependency build/update and the conditional rules in Chart.yaml? I'm also curious why there is an enabled field in Chart.yaml which seems redundant with the condition field? I'm running Helm 3.2.4.
Thanks in advance!
The command helm dep update does not use values.yaml and that is why your dependencies are updated even if you have them disabled in values.yaml.
To understand the enabled for dependencies, read the section "Tags and Condition fields in dependencies" in the Helm: Charts documentation.
helm dependency update command will download all the subchart specified in the dependencies option and download it to the charts/ directory, even you have them disabled in values.yaml. However, only enabled charts will be installed.
To release the new changes/version you need to run the command helm upgrade <chart-name> <chart-dir-location>.
Please refer https://helm.sh/docs/helm/helm_upgrade/
Helm Dependency Update:
Update the on-disk dependencies to mirror Chart.yaml.
This command verifies that the required charts, as expressed in 'Chart.yaml', are present in 'charts/' and are at an acceptable version. It will pull down the latest charts that satisfy the dependencies, and clean up old dependencies.
On successful update, this will generate a lock file that can be used to rebuild the dependencies to an exact version.
Helm Dependency Build:
Build out the charts/ directory from the Chart.lock file.
Build is used to reconstruct a chart's dependencies to the state specified in the lock file. This will not re-negotiate dependencies, as 'helm dependency update' does.
If no lock file is found, 'helm dependency build' will mirror the behavior of 'helm dependency update'.

Error: found in Chart.yaml, but missing in charts/ directory: elasticsearch, kibana, filebeat, logstash

I would like to deploy elastic-stack into Kubernetes cluster. I git clone the chart, use default settings. But, I got errors.
git clone https://github.com/helm/charts
Create namespace
kubectl create namespace elastic-stack
At $HOME/charts
$ helm install elastic-stack stable/elastic-stack --namespace=elastic-stack
Error: found in Chart.yaml, but missing in charts/ directory: elasticsearch, kibana, filebeat, logstash, fluentd, fluent-bit, fluentd-elasticsearch, nginx-ldapauth-proxy, elasticsearch-curator, elasticsearch-exporter
helm version
version.BuildInfo{Version:"v3.3.0-rc.1"
Have you enabled the stable repo for helm ? you can check this by running helm repo list
If not, please add using helm repo add stable https://charts.helm.sh/stable