Code Monkey home page Code Monkey logo

Comments (4)

danielhoherd avatar danielhoherd commented on June 12, 2024 2

@rikatz here is a link to the helm template documentation where you can see:

-a, --api-versions stringArray Kubernetes api versions used for Capabilities.APIVersions

However, it looks like there is now a --kube-version arg that was just released in helm 3.6.0 today where you can specify the kube version to use. With that in mind, it looks like this should just be a quick docs fix. @mteodori

from kubepug.

rikatz avatar rikatz commented on June 12, 2024

Hi @mteodori thanks for raising this.

Can you provide me some more specific steps to reproduce, so I can take a look here? I'm shamefully not much aware of helm behavior :)

Thank you!

from kubepug.

rikatz avatar rikatz commented on June 12, 2024

Or I can take a look into the original issue in helm :)

from kubepug.

hobti01 avatar hobti01 commented on June 12, 2024

Unfortunately, the helm --kube-version argument does not work like kubepug --k8s-version.

KubePug uses --k8s-version to determine the swagger.json for the requested Kubernetes version and from there extracts all the supported API Versions.

Helm on the other hand simply uses --kube-version as the value for .Capabilities.KubeVersion. It does not determine all the supported API Versions for that Kubernetes Version and populate .Capabilities.ApiVersions. Helm uses the API Versions for the compiled-in kubectl version

Unfortunately, this means that (using Helm 3.10.2) this command will template a chart with API Versions for kubernetes 1.25.2 (because of the compiled in version of kubectl) while KubePug will be validating for API Versions for kubernetes 1.22.0
helm template . | kubepug --k8s-version v1.22.0 --input-file=-

If we use helm template . --kube-version 1.22.0 | kubepug --k8s-version v1.22.0 --input-file=- this only changes .Capabilities.KubeVersion in the Helm templating - it does not affect the values of .Capabilities.APIVersions.

In order to have helm use the API Versions for the desired kubernetes version, we must use helm template argument --api-versions. For the current kubernetes cluster, that looks like
helm template $(kubectl api-versions | awk '{printf "--api-versions %s ",$0}') . | kubepug --k8s-version v1.22.0 --input-file=-

However, there is no mechanism to get the api-versions for a non-running cluster. We want to test our charts against the current cluster version and the next 2 minor versions, e.g. 1.22.0, 1.23.0, 1.24.0. But this is simply not possible with Helm unless you have a cluster of each version running.

It would be a great kubepug feature to output the api-versions for a given Kubernetes version so that we could feed that into helm template because kubepug has already parsed this information from the swagger.json.

For example, it would be great if we could do this:

for K8S_VERSION in v1.22.0 v1.23.0 v1.24.0; do
  helm template --kube-version=$K8S_VERSION \
    $(kubepug api-versions --k8s-version $K8S_VERSION | awk '{printf "--api-versions %s ",$0}') . |
    kubepug --k8s-version $K8S_VERSION --input-file=-
done

from kubepug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.