Skip to content

Improvements to Kubernetes related code generation #2909

Open

Description

Is your feature request related to a problem? Please describe.

K0s uses Kubebuilder's controller-tools to generate the CRD manifests and deepcopy code, as well as the standard Kubernetes code-generator to auto-generate the typed go clients for its Custom Resource types.

The way k0s does it right now is a bit different than other projects, including Kubernetes itself do it. That makes it a bit challenging to work with k0s's CRDs, as things don't work the way they work elsewhere.

Describe the solution you would like

Use the code generation tools in a more standard way. Moreover, there are even more code generation features available in the aforementioned libraries which might have a positive impact on the k0s codebase.

Some fixes/improvements that may be worthwhile to implement:

  • Make package-level annotations work
  • Have shorter package paths
  • Have a look into the other code-generators
    • defaulter-gen might help streamlining the hand-made defaulting code in k0s
    • register-gen generates register.go files

Describe alternatives you've considered

No response

Additional context

There's also conversion-gen, which allows for evolving API versions by generating boilerplate to convert between multiple external versioned representations of a CRD and the internal unversioned representation of a CRD. Maybe that might help in sorting out the "node config vs. cluster config" difficulty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions