devspace
devspace copied to clipboard
Allow customizing the `helm dependency update` command
Is your feature request related to a problem?
We use a private helm repository for some library charts, which is stored in AWS S3. In order to run helm dependency update
successfully during devspace deploy
, we need to have AWS_PROFILE=<helm-repo-profile>
. We can export AWS_PROFILE=<>
before running devspace deploy
, but we really only want AWS_PROFILE
set for the helm dependency update
command and nothing else, since setting AWS_PROFILE
can have implications for other commands in our pipelines.
This is really somewhat of a limitation of the helm s3 plugin or helm itself, since ideally when we add the repo helm keeps track of which profile needs to be used for which repo. But that's unlikely to be implemented.
Which solution do you suggest?
It seems like a generic solution that could work here is to allow the user to specify an override command for helm dependency update
. In our case, we'd just set it to AWS_PROFILE=<helm-repo-profile> helm dependency update
- but others may customize it to whatever they want.
Something like
deployments:
one:
helm:
chart:
dependencyCommand: "AWS_PROFILE=<helm-repo-profile> helm dependency update"
...
Not sure I like that terminology, but that's the idea at least.
Which alternative solutions exist?
An alternative could be to add hooks
that happen right before and right after the helm dependency update
command, so a user could export AWS_PROFILE
before to set it, and after to unset it.
Additional context
/kind feature
@tobalsgithub we never call helm dependency update
, but you could use this snippet to do that in v6:
pipelines:
deploy: |-
AWS_PROFILE=<helm-repo-profile> helm dependency update
run_default_pipeline deploy
@FabianKramm I think you do actually call helm dependency update
here. I can tell cause we never call it explicitly today, and yet we're able to install helm charts that have dependencies.
I can also see the dependency update happen in the logs right before the upgrade
.
13:23:02 deploy:test Execute 'helm dependency update --kube-context arn:aws:eks:us-east-1:<redacted>:cluster/redoxlocal-eks-cluster'
13:23:15 deploy:test Execute 'helm upgrade translation-sets-test --values /var/folders/9z/25lc8jjn6mj7c4_yj7nyj1fw0000gp/T/917462865 --install --namespace tc /Users/tc/code/redox-services/services/translation-sets/helm/translation-sets --wait --timeout=600s --kube-context arn:aws:eks:us-east-1:<redacted>:cluster/redoxlocal-eks-cluster'
Having this dependency update built in is really quite useful because it automatically happens inside the chart directory, wherever that happens to be specified. And the deploy
pipeline doesn't have to be directory aware. In our case we just need to be able to customize it ever so slightly.
Using a pipeline for this certainly would be possible, but ideally we could just bake this into the configuration of the deployment.
@tobalsgithub ah yes, you are correct! It seems like you just want to add an environment variable to that command though, which I believe is better done through either pipelines or a variable:
vars:
AWS_PROFILE=<helm-repo-profile> # Should now be passed automatically as an environment variable to the helm dependency update command
EDIT: this will only work with the newest DevSpace beta release that enables the pass through for environment variables