Search code examples
kubernetesrepositorykubernetes-helmnexushelmfile

How to have helm / helmfile install the most recent chart version from a repo?


I am testing helm packaging & helm package installations, and I have pushed several versions to my helm repository (Sonatype Nexus). These are the versions that I have pushed:

  • version 1.0.0 / appVersion 1.0.0
  • version 1.0.1-RC / appVersion 1.0.1-RC
  • version 1.0.2-RC / appVersion 1.0.2-RC
  • version 1.3.0-dev-RC / appVersion 1.3.0-RC
  • version 1.3.0-staging-RC / appVersion 1.3.0-RC
  • version 1.3.0-dev-RELEASE / appVersion 1.3.0-RELEASE

Now when I do

helm upgrade --install myRepo/myChart

I will get version 1.0.0 installed. I can, however, do

helm upgrade --install myRepo/myChart --version 1.3.0-dev-RC

and it will install that version 1.3.0-dev-RC just fine.

Same issue for helmfile. Given this helm file:

releases:
- name: myChart
  chart: myRepo/myChart
  version: ">=1.0.0"

When applying, I will also get version 1.0.0 deployed.

Why is this? I would assume that helm will install the most recent version if I don't specify one.


Solution

  • The version numbers with hyphens are semantic versioning pre-releases (§9). The helm install documentation notes

    [Helm] will install the latest stable version of that chart until you specify '--devel' flag to also include development version (alpha, beta, and release candidate releases), or supply a version number with the '--version' flag.

    Helmfile has similar rules on using stable versions only, or has a devel: true option paralleling helm install --devel.

    If you want the latest not-necessarily-release version, then you can use these options

    helm upgrade --install --devel myRelease myRepo/myChart
    
    releases:
    - name: myChart
      chart: myRepo/myChart
      devel: true
    

    Note that --devel and --version can't be usefully combined, and --devel is equivalent to setting --version '>=0.0.0-0'. Also note that, by the semver rules, 1.3.0-dev-RC is less than version 1.3.0; so if you need any pre-1.3-or-later version, but not a 1.2 release, you need a syntax like

    helm upgrade --install --version '>= 1.3.0-0' ...