-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
You may need to run helm dependency build
to fetch missing dependencies: found in Chart.yaml, but missing in charts/ directory
#508
Comments
If you look at the docs https://argocd-vault-plugin.readthedocs.io/en/stable/usage/#with-helm it is recommended to run That error is coming from Helm. When you use AVP you do lose some of the built in Helm features because of the way the CMPs work in Argo CD. |
yes but i m using sidecare the init is only for argocd-cm right ?
|
No, the init is in both. https://argo-cd.readthedocs.io/en/stable/operator-manual/config-management-plugins/#sidecar-plugin |
I did what you asked me, I hope I didn't make any mistake, but I still have an error Note: this command is run before any Helm templating is done, therefore the logic is to checkif this looks like a Helm chartdiscover:
init:
generate:
lockRepo: false error with helm repo update : error without helm repo update in the configmap thank you |
any update ? |
Your init command is off. Your running this command |
For anyone searching, you can add and build the chart in the init block, like below.
|
on my side this config work: (I had to add I still don't know where @shazinahmed found the syntax: avp-helm.yaml: |
---
apiVersion: argoproj.io/v1alpha1
kind: ConfigManagementPlugin
metadata:
name: argocd-vault-plugin-helm
spec:
allowConcurrency: true
# Note: this command is run _before_ any Helm templating is done, therefore the logic is to check
# if this looks like a Helm chart
discover:
find:
command:
- sh
- "-c"
- "find . -name 'Chart.yaml' && find . -name 'values.yaml'"
init:
command:
- sh
- "-c"
- |
helm repo add chartname chart-repo;
helm dependency build;
generate:
# **IMPORTANT**: passing `${ARGOCD_ENV_HELM_ARGS}` effectively allows users to run arbitrary code in the Argo CD
# repo-server (or, if using a sidecar, in the plugin sidecar). Only use this when the users are completely trusted. If
# possible, determine which Helm arguments are needed by your users and explicitly pass only those arguments.
command:
- sh
- "-c"
- |
helm template $ARGOCD_APP_NAME -n $ARGOCD_APP_NAMESPACE ${ARGOCD_ENV_HELM_ARGS} . |
argocd-vault-plugin generate -
lockRepo: false |
to be honest the "good" syntax is: init:
command:
- bash
- "-c"
- |
chartname=$(helm dependency list | tr -s '[:space:]' | tail -n 1 | tr -s '[:space:]' | cut -f1);
chartrepo=$(helm dependency list | tr -s '[:space:]' | tail -n 1 | tr -s '[:space:]' | cut -f3);
helm repo add $chartname $chartrepo;
helm dependency build; |
This init command is only working for charts with exactly one dependency though. Additional ones are ignored. If the chart has none, then this will fail, since it will try to use the header line in the command ( Also I would not recommend to use the chart name as the name of the repository. You could have multiple dependencies from the same repository. And adding the same repo multiple times with different names will fail as well. My take on this is the following: init:
command:
- /bin/sh
- -c
- |
#!/usr/bin/env bash
set -Eeuo pipefail
# add all repositories from this chart
for REPO_URL in $(helm dependency list | tail -n+2 | tr -s '[:space:]' | cut -f3)
do
helm repo add $(echo -n "${REPO_URL}" | base64) "${REPO_URL}"
done
# finally downloading the charts dependencies
helm dependency build (the trailing Using the base64 encoded URL as name for the repository makes sure, that a second execution of EDIT: Changed to |
I spent quite some time trying to set this plugin up for applications with dependencies. Turns out it's easier to not go through all these hoops to restore default behavior and instead use https://github.com/crumbhole/argocd-lovely-plugin which has a nice feature to chain plugins. There's also a build of it which has this vault plugin bundled and ready to use out of the box. |
Describe the bug
I have created my own Helm dependency that I call in another Helm repository in the Chart.yaml. When I don't use the argocd-vault-plugin plugin (sidecar), argocd pull and execute my chart correctly. But when I use it, I get an error message
Unable to create application: application spec for abj is invalid: InvalidSpecError: Unable to generate manifests in h1: rpc error: code = Unknown desc = plugin sidecar failed. error generating manifests in cmp: rpc error: code = Unknown desc = error generating manifests:
sh -c helm template $ARGOCD_APP_NAME -n $ARGOCD_APP_NAMESPACE ${ARGOCD_ENV_HELM_ARGS} . | argocd-vault-plugin generate -
failed exit status 1: Error: An error occurred while checking for chart dependencies. You may need to runhelm dependency build
to fetch missing dependencies: found in Chart.yaml, but missing in charts/ directory: app-web Error: No manifests Usage: argocd-vault-plugin generate [flags] Flags: -c, --config-path string path to a file containing Vault configuration (YAML, JSON, envfile) to use -h, --help help for generate -s, --secret-name string name of a Kubernetes Secret in the argocd namespace containing Vault configuration data in the argocd namespace of your ArgoCD host (Only available when used in ArgoCD). The namespace can be overridden by using the format :The text was updated successfully, but these errors were encountered: