Helm Chart Kubernetes Versioning


wnatasha@...
 

How do Helm charts handle differences in K8S API objects between different K8S/OpenShift versions? For example, for the apiVersion parameter, is there a way for Helm to know what version to put in depending on what version of K8S or OpenShift they have?


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




wnatasha@...
 

Thank you for this information, Matt!

Besides the capabilities object for Kubernetes versions, is there a way to decipher between Kubernetes and OpenShift versions?

--
Natasha


Matt Farina
 

> Besides the capabilities object for Kubernetes versions, is there a way to decipher between Kubernetes and OpenShift versions?

I’m not familiar enough with OpenShift to be able to know.

As CRDs, and their versions, take off I can imagine the landscape for “feature” or some other form of detection taking off.


-- 
Matt Farina
mattfarina.com




Adam Kaplan
 

Besides the capabilities object for Kubernetes versions, is there a way to decipher between Kubernetes and OpenShift versions?

I don't think Helm has any means of obtaining the OpenShift version, as this is usually obtained via the openshift CLI (`oc version`). Doesn't look like the Cababilities object only supports data on Kube and Tiller.

As an FYI OpenShift versions tend to track the underlying Kubernetes version it distributes (3.9 distributes k8s 1.9, 3.7 distributes 1.7, etc.).


On Thu, Jul 5, 2018 at 2:09 PM Matt Farina <matt@...> wrote:
> Besides the capabilities object for Kubernetes versions, is there a way to decipher between Kubernetes and OpenShift versions?

I’m not familiar enough with OpenShift to be able to know.

As CRDs, and their versions, take off I can imagine the landscape for “feature” or some other form of detection taking off.


-- 
Matt Farina
mattfarina.com





--

ADAM KAPLAN

SENIOR SOFTWARE ENGINEER - OPENSHIFT

Red Hat

100 E Davie St Raleigh, NC 27601 USA

adam.kaplan@...    T: +1-919-754-4843     IM: adambkaplan