mumoshu/helm-x

feat: adhoc dependency

Closed this issue · 0 comments

The idea is that running e.g. helm x apply --add-adhoc-dependency flagger/canary:1.2.3 myrepo/myapp myrelease so that the denoted adhoc dependency flagger/canary of version 1.2.3 is added to the requirements.yaml of the temporary local chart myapp generated from the remote chart myrepo/myapp.

This allows you to make your remote chart an umbrella chart without forking it.

One of expected use-cases is to add weaveworks/flagger's Canary custom resource to your app chart, without making your app chart coupled/modified to Flagger itself.

Expected Use-case 1. Weaveworks/Flagger

When using Flagger, you usually update your chart to include a Canary resource while disabling the creation of Service, so that Flagger is able to handle atuomated canary deployments backed by two generated deployments AND one generated Service for you.

To me, the biggest(but not too big of course) blocker for this usage is that you have to update all your charts to be able to handle Canary via chart values.

So that something like this works(normal Flagger usage):

helm upgrade -i frontend yourchartsrepo/yourchart \
--namespace test \
--set nameOverride=frontend \
--set backend=http://backend.test:9898/echo \
--set canary.enabled=true \
--set canary.istioIngress.enabled=true \
--set canary.istioIngress.gateway=public-gateway.istio-system.svc.cluster.local \
--set canary.istioIngress.host=frontend.istio.example.com

This helm-x feature "adhoc dependecy" allows you to achieve the same goal without updating your chart at all by running:

helm x upgrade -i frontend yourchartsrepo/yourchart \
--namespace test \
--set nameOverride=frontend \
--set backend=http://backend.test:9898/echo \
--set canary.enabled=true \
--set canary.istioIngress.enabled=true \
--set canary.istioIngress.gateway=public-gateway.istio-system.svc.cluster.local \
--set canary.istioIngress.host=frontend.istio.example.com \
--adhoc-dependency canary=yourchartsrepo/canary:1.2.3 \

Under the hood, helm-x reads --adhoc-dependency canary=yourchartsrepo/flaggercanary:1.2.3 and adds the following snippet to the generated requirements.yaml:

dependencies:
- name: flaggercanary
  repository: https://yourcharts.example.com
  version: '1.2.3'
  condition: canary.enabled