Skip to content
Kubernetes code generator docker image
Go Shell Dockerfile Makefile
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Kube code generator Docker Repository on Quay

A kubernetes code generator ready container to create your CRD autogenerated code like clients or openapi specs.

This uses the official util created by Kubernetes to autogenerate the code required by Kubernetes resources.

What can generate

  • CRD based Go codes like Kubernetes clients.
  • CRD manifest YAMLs to register your CRs on the cluster.
  • OpenAPI spec.

Docker image versions

Docker image
Kubernetes v1.18 docker pull
Kubernetes v1.17 docker pull
Kubernetes v1.16 docker pull
Kubernetes v1.15 docker pull
Kubernetes v1.14 docker pull
Kubernetes v1.13 docker pull
Kubernetes v1.12 docker pull
Kubernetes v1.11 docker pull
Kubernetes v1.10 docker pull
Kubernetes v1.9 docker pull

You can use docker pull for master branch.

Getting started

The best way to start is by checking an example of how to generate Go code for a CRD.

For a detailed explanation of how to use it continue reading.

Kubernetes type code generation

Env vars required

  • PROJECT_PACKAGE: The project package path.
  • CLIENT_GENERATOR_OUT: The client generated out path.
  • APIS_ROOT: The path where our API/resources are.
  • GROUPS_VERSION: The groups of the resources.
  • GENERATION_TARGETS: The wanted generated code. [(deepcopy,defaulter,client,lister,informer) or "all"].


Having a project that would be on, wants to generate the client on, has its resources on, has the resources and and wants only deepcopy and client autogenerated code this would be: && \
docker run -it --rm \
    -v ${PWD}:/go/src/${PROJECT_PACKAGE}\
    -e GROUPS_VERSION="test:v1alpha1 test2:v1" \
    -e GENERATION_TARGETS="deepcopy,client" \

Kubernetes CRD manifests

Env vars required

  • GO_PROJECT_ROOT: The project root (does not depend on GOPATH).
  • CRD_TYPES_PATH: The path to the CRDs (searches in the path).
  • CRD_OUT_PATH: The output path for the CRD manifest.


docker run -it --rm \
    -v ${PWD}:/src \
    -e GO_PROJECT_ROOT=/src \
    -e CRD_TYPES_PATH=/src/apis \
    -e CRD_OUT_PATH=/src/manifests \

Kubernetes type openapi spec generation

Env vars required

  • CRD_PACKAGES: The packages where all the CRD types are (comma separated).
  • OPENAPI_OUTPUT_PACKAGE: The output package where the open api spec will be created.


Having a project that would be on, wants to generate the openapi spec for its types on, has its resources on, has the resources and autogenerated spec this would be: && \
docker run -it --rm \
    -v ${PWD}:/go/src/${PROJECT_PACKAGE}\
    -e CRD_PACKAGES=${PROJECT_PACKAGE}/apis/test/v1alpha1,${PROJECT_PACKAGE}/apis/test2/v1 \
You can’t perform that action at this time.