0

If I have a chart, say ChartA, that has a dependency on ChartB, I want to only install ChartB if it hasn't been installed already.

Why? Let's say I run 2 copies of ChartA, and they both need a special server in ChartB, but that server is meant to be a singleton between the two instances of ChartA.

How can I accomplish this? So far my ChartA's requirements.yaml looks like:

dependencies:
  - name: chartb
    version: "0.1.0"
    repository: "https://my.repository.url/charts/"

If I go and run helm install charta --name instance-a it finds chartb just fine and installs it, but if I run the install a second time with helm install charta --name instance-b it fails with Error: release instance-b failed: services "chartb" already exists

In other words, instead of recognizing the chartb service was already installed and working, it tried to install it again and failed.

How can I ensure that Helm only installs the chartb dependency if it isn't already installed and running (i.e. from a previous instance being started up of charta)?

5
  • Wouldn't a line such as chartb: {enabled: false} be an option in the values.yaml of charta for the second installation? – LLlAMnYP Apr 26 '20 at 14:28
  • @LLlAMnYP That would require knowing the dependency has already been installed, which I may not know a-priori. It would also require modifying the helm chart when installing chartb. – stix Apr 27 '20 at 17:58
  • @stix so, usually if there is a dependency cannot avoid it, without that application might not work, but in case the same dependency for multiple charts, I usually override the dependency chart name, which lets me install the dependency in a different name. lots of charts provide this option:nameOverride if it's your custom you have to work on that chart to add this. – Saikat Chakrabortty May 8 '20 at 4:54
  • @SaikatChakrabortty The point is that having it as a dependency breaks the 2nd copy of ChartA because it can't detect that the dependency chartB is already installed. – stix May 10 '20 at 2:54
  • @stix True. as of now, I don't see any option to install the chart only if not exist. the only thing I can think of is, you install the dependency with some other name. if you only looking for the option that let you install only if not exist, use the same otherwise. you have to make your own service for the same. – Saikat Chakrabortty May 10 '20 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.