Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Update chart dependencies before installing #1450

Merged
merged 4 commits into from
Oct 23, 2018

Conversation

squaremo
Copy link
Member

@squaremo squaremo commented Oct 16, 2018

This addresses #1278, for the "alpha" series (i.e., not for #1382). It simply calls helm dep build in the chart directory, when installing or upgrading a release.

Note that it bakes in a repositories.yaml file (which specifies the repo URLs, and is necessary for the helm commands to function). This file specifies only the conventional "stable" repo. We will need to figure out how to allow other repos to be specified; it is not quite good enough to mount your own file, since it lives in a directory helm wants to write to (and the mount would mean it's read-only).

We want to be able to update the dependencies of a Helm chart. Helm
(whether the client library or the command-line tool) makes it
difficult to do this without also having other equipment, notably the
repositories.yaml file which records aliases and possibly credentials
for Helm repos (e.g., "stable").

This commit adds a default repositories.yaml file to the image,
containing just the conventional location of "stable".
This makes trouble-shooting a bit easier, since you can exec into the
container and have a look around with `helm`.
The easiest thing to do is use the Helm binary; since there's no
communication with Tiller involved, there are fewer compatibility
pitfalls (possibly none).
@squaremo
Copy link
Member Author

squaremo commented Oct 17, 2018

I need to make sure this can cover a couple of scenarios aside from the bare basics:

Can you set it up to use a repo other than stable?

This will probably mean mounting a repositories.yaml file; but,

  • those tend to have local paths in them
  • .. and possibly refer to certificates which would also need to be present
  • .. and, Helm really wants this file to be in the same directory as where it's downloading charts, but if you're mounting it from a volume, it'll be read-only

How do you provide credentials for the repo?

Credentials get put in the repositories.yaml file; so again, if you want to supply credentials, you'd have to mount that file from a secret, with the problems as above.

@squaremo
Copy link
Member Author

Can you set it up to use a repo other than stable?

This will probably mean mounting a repositories.yaml file; but,

  • those tend to have local paths in them
  • .. and possibly refer to certificates which would also need to be present
  • .. and, Helm really wants this file to be in the same directory as where it's downloading charts, but if you're mounting it from a volume, it'll be read-only

How do you provide credentials for the repo?

Credentials get put in the repositories.yaml file; so again, if you want to supply credentials, you'd have to mount that file from a secret, with the problems as above.

I've tried both of these things (in one go). You can mount a repositories.yaml file into the expected location $HELM_HOME/repository/repositories.yaml, so long as you:

  • mount another, writable volume at $HELM_HOME/repository/cache/, so helm has a writable directory in which to put its cached things, and
  • adapt the repositories.yaml file, so that each entry has a field cache pointing at the expected location of the index cache.

On that second thing: Helm seems to expect a specific value in the cache field, that is $HELM_HOME/repository/cache/$repo-index.yaml. If you exclude the cache field, helm tries to use $HELM_HOME/repository/cache as a file while updating the repo index, and breaks because it's a directory. If you provide something other than the expected value, it breaks while releasing the chart because there's no file at the expected location. (We use a recent revision of the helm go package, but an older version of the helm binary, so perhaps the differing expectations are due to that mismatch).

@squaremo
Copy link
Member Author

I could do the dependency update in code to try and work around the oddnesses, but it would be a drastic step, because the helm go library also assumes the repositories.yaml, index files, and cache are inextricably tied (they all get calculated relative to a value helmhome.Home). It would involve reimplementing all the bits that make that assumption :-(

Apparently 2.8.2 didn't support authentication for chart repos; 2.9.1
does.
@squaremo
Copy link
Member Author

I've pushed the image quay.io/squaremo/helm-operator:pr-1450 for anyone who wants to try this out.

@skurtzemann
Copy link

I've pushed the image quay.io/squaremo/helm-operator:pr-1450 for anyone who wants to try this out.

I've try your image and requirements are correctly installed 👍

Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM tested with public repos

@squaremo squaremo merged commit 8dd22bc into master Oct 23, 2018
@squaremo squaremo deleted the issue/1278-helm-resolve-deps branch October 23, 2018 09:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants