Giter Club home page Giter Club logo

kube-code-generator's Introduction

Kube code generator

Kubernetes release

Introduction

When we speak about Kubernetes operators or controllers, normally Go code, CR, CRDs... are required. To create all the autogenerated Kubernetes Go code (Clients, helpers...) and manifests (CRD), the process is a bit painful.

This small project tries making easy this process, by creating a small layer between Kubernetes official tooling that are used to get all this autogenerated stuff, and abstract options and infer some others, making a better UX for the user.

The projects that are used under the hood are:

Why and when use this

  • You don't like, need or use kubebuilder for your CRDs.
  • You want simple tooling to generate Kubernetes CRD Go clients and manifests.
  • You like safe standards and simple things.
  • You use CRDs for more/other things than operators (e.g: generating CLIs, storing state on k8s as APIs...).
  • You don't want to do hacky and ugly stuff to start creating Kubernetes tooling.

Features

  • Small API/configuration.
  • Safe standards
  • Ready to use Docker images.
  • Generates Go code like clients and informers (Used to implement operators, CLIs...).
  • Generates CRD manifests (Used for API registration on k8s clusters).

How to use it

The easiest way is to use the provided Docker image as it has all the required upstream dependencies.

Here is an example that mounts the current directory (a Go project) and generates the Go code and the CRDs by providing the APIs input directory and the generation output directories:

docker run -it --rm -v ${PWD}:/app ghcr.io/slok/kube-code-generator \
 --apis-in ./apis \
 --go-gen-out ./gen \
 --crd-gen-out ./gen/manifests

However, the best way to know how to use it is with a full example, you have it in _example dir.

Kubernetes versions

It's suggested that if you don't have an old Kubenretes version, you try the latest kube-code-generator (latest), however the ones described on the table here are known to work correctly on the specific version.

Kubernetes Docker image
v1.30 docker pull ghcr.io/slok/kube-code-generator:v0.2.0
v1.29 docker pull ghcr.io/slok/kube-code-generator:v0.2.0
v1.28 docker pull ghcr.io/slok/kube-code-generator:v0.2.0
v1.27 docker pull ghcr.io/slok/kube-code-generator:v0.2.0

Versions <v1.27

With the release of Kubernetes v1.30, this app was rewritten from bash hacky scripts into a proper Go application, that is easier, more extendable and safer to use.

In case you tested this new refactor and isn't working for you, Inwould suggest to try the previous versions, check the previous Readme.

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.