Re: Helm Chart Kubernetes Versioning


Matt Farina
 

There is a Capabilities object available in Charts that has some information about the Kubernetes cluster including the version. You can use this to detect different Kuberentes versions and handle them differently.

Here’s an example used in a helper file. If you search in the charts repo for Capabilities you can find other examples.

Note, in the semver comparison example there is a -0 on the end of the version. Adding a pre-release in causes pre-release versions of Kubernetes to be supported in comparisons. This is important if you run in some places (e.g., GKE) where they use pre-releases to denote their environmental build rather than build metadata. They are breaking from the semver spec so the -0 allows us to work around it.

-- 
Matt Farina
mattfarina.com



Join cncf-helm@lists.cncf.io to automatically receive all group messages.