Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support all Kubernetes versions 1.20 through 1.30 #107

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

thomasjm
Copy link
Contributor

I noticed that when trying to use certain Kubernetes endpoints with this library (such as DELETE of a Service), the response would fail to parse.

Looking into it, I found it's because kubernetes-client-core is currently generated against K8S release 1.20, which is rather old at this point. The K8S API is pretty stable, but not stable enough that such an old version will work flawlessly against a newer cluster (mine is 1.27).

So, I decided to generate kubernetes-client-core for all versions from 1.20 through 1.30. These are now stored in the folders ./kubernetes-1.xx. I think it would be nice to publish all of these to Hackage using their version numbers, but for now it's easy to use in a stack.yaml like this:

# stack.yaml
# ...

extra-deps:
# For a project targeting Kubernetes 1.27
- git: https://github.com/codedownio/kubernetes-client-haskell.git
  commit: 47d88d7061cda5227c8f7819e3a640c7dea247f3
  subdirs:
  - kubernetes-1.27
  - kubernetes-client

I also:

  • Made it easier and more reproducible to run the generation code, by introducing a Nix flake. You can run generate_all.sh and it will generate all the versions, using Nix to obtain a pinned version of the gen repo. This step formerly needed to be done by hand. Adding a new K8S version in the future should be a 1-line change.
  • Updated the CI to run a big build matrix, testing Cabal and Stack, a range of GHC versions, and a range of K8S API versions. This CI is fully green.
  • Fixed all GHC warnings for the configurations in the build matrix (except for a few in the generated code).
  • Moved superfluous files like swagger.json and openapi.yaml to .gitignore, as these are only needed at generation time and not to use the library.

I think the results are good. You can now easily choose the version of the K8S API you want to target. And a git clone is still plenty fast, with each autogenerated folder only contributing around 6MB uncompressed.

CC @jonschoning @akshaymankar @guoshimin

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 20, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: thomasjm
Once this PR has been reviewed and has the lgtm label, please assign brendandburns for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 20, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @thomasjm. Thanks for your PR.

I'm waiting for a kubernetes-client member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants