xtruder / kubenix

Replaced by https://github.com/hall/kubenix
MIT License
300 stars 34 forks source link

Add support for Kubernetes 1.19 -> 1.23, and document #34

Closed kalbasit closed 1 year ago

kalbasit commented 2 years ago

This PR adds support for Kubernetes v1.19 to v1.23 and documents the process for obtaining the specification for future versions of Kubernetes.

closes #33

kalbasit commented 2 years ago

Hmm, it seems to be failing because of Istio. Not sure how to update that one.

kalbasit commented 2 years ago

@offlinehacker, how did you generate the Istio OpenAPI spec?

offlinehacker commented 2 years ago

I used this project to somehow get https://github.com/snowdrop/istio-java-api json schema. Are you using istio, maybe we can just remove it for now?

Also thanks for pull request :)

kalbasit commented 2 years ago

Are you using istio, maybe we can just remove it for now?

No, I don't use it, but I wasn't certain if removing it is a good idea. I'll go ahead and remove it.

Also thanks for pull request :) Of course.

offlinehacker commented 2 years ago

This looks good, I did check it and I don't see any issues, do you think it's ready to get merged?

kalbasit commented 2 years ago

This looks good, I did check it and I don't see any issues, do you think it's ready to get merged?

The test is failing though, and I'm not sure why pkgs isn't getting sent

❯ nix eval -f ./ci.nix --arg release.e2e false test-check
error: attribute 'pkgs' missing

       at /nix/store/zdajwqf0577sqjws80ad294l7aczbjy6-source/lib/modules.nix:487:28:

          486|         builtins.addErrorContext (context name)
          487|           (args.${name} or config._module.args.${name})
             |                            ^
          488|       ) (lib.functionArgs f);
(use '--show-trace' to show detailed location information)
kalbasit commented 2 years ago

This looks good, I did check it and I don't see any issues, do you think it's ready to get merged?

The test is failing though, and I'm not sure why pkgs isn't getting sent

❯ nix eval -f ./ci.nix --arg release.e2e false test-check
error: attribute 'pkgs' missing

       at /nix/store/zdajwqf0577sqjws80ad294l7aczbjy6-source/lib/modules.nix:487:28:

          486|         builtins.addErrorContext (context name)
          487|           (args.${name} or config._module.args.${name})
             |                            ^
          488|       ) (lib.functionArgs f);
(use '--show-trace' to show detailed location information)

@offlinehacker can you reproduce the issue?

offlinehacker commented 2 years ago

Didn't had time to test it yet, do tests event work on master with latest nixpkgs? Do you think this could be the culprit? https://github.com/xtruder/kubenix/pull/34/files#diff-751539391bd459b986922691ca861a8478249e5d92315ce616350836cee5de76R130

I will try to debug this some time today/tomorrow

kalbasit commented 2 years ago

I think I fixed the issue, 🤞🏽the CI will pass.

kalbasit commented 2 years ago

@offlinehacker I don't see the CI triggering, can you see it on your end?

arijoon commented 2 years ago

Can this PR be merged? I can review or run it on my side if you'd like additional feedback

kalbasit commented 2 years ago

Can this PR be merged? I can review or run it on my side if you'd like additional feedback

Another set of eyes/testing would be great, thank you.

grex-gh commented 1 year ago

Will this get merged/fixed?

GCP is treating kubernetes 1.21 as EOL and resource generation from kubenix is going to fail with v1beta1 versions.

I've tried @kalbasit support-k8s-1.18-1.23 branch to build compatible JSON with kubernetes +1.21 but build fails for me:

error: undefined variable 'applyModuleArgsIfFunction'

       at /nix/store/325l85lhqbnpvf1z9ghbi9ws8cnxf97q-kubenix-src/modules/legacy.nix:28:42:

           27|       injectModuleAttrs = module: attrs: (
           28|         if isFunction module then args: (applyModuleArgsIfFunction file module args) // attrs
             |                                          ^
           29|         else if isAttrs mkOptionDefault.module then module // attrs
(use '--show-trace' to show detailed location information)
xpliz commented 1 year ago

I managed to get pass that problem only new to arise with some version(s) resource definition (CRD, ingress) not existing

adrian-gierakowski commented 1 year ago

@grex-gh do you have a complete example? Ideally a repo which someone could clone and run nix-build in to reproduce?

btw you could try this as well: https://github.com/hall/kubenix

adrian-gierakowski commented 1 year ago

@xpliz for CRDs you can always import a plain yaml, or create a resource without a schema (you’d not get nix eval time validation and or smart merging but it’s better than nothing)

xpliz commented 1 year ago

@grex-gh do you have a complete example? Ideally a repo which someone could clone and run nix-build in to reproduce?

btw you could try this as well: https://github.com/hall/kubenix

I managed to get past that error and had build running but it fails on certain resources.

Sadly it's a private repo so I can't share it. I'll try suggested repo to see if it behaves differently. But I presume it's a problem in some missing some nix definition.

@xpliz for CRDs you can always import a plain yaml, or create a resource without a schema (you’d not get nix eval time validation and or smart merging but it’s better than nothing)

It's not just CRDs, but about 80 resources which are not compatible with kubernetes 1.22. Also it's a part of CI pipeline so tad harder to implement without a lot changes to the pipeline. Most problematic are CRDs and Ingress definitions others could be simply solved by using 'sed' or something alike.

offlinehacker commented 1 year ago

This repo has been deprecated, since I stopped maintaining it some time ago. There is a fork maintained by @hall available at https://github.com/hall/kubenix, that has better documentation and looks like a way further.