Contributing to Kubeformation
Thanks for your interest in Kuberformation. Follow the steps below to contribute.
- Go 1.10 (not required if using Docker)
- Docker (optional)
- Dep for managing vendor-ed packages
- GNU Make for build/test rules
Fork the repo
Fork the repo and clone it into your
$ mkdir -p $GOPATH/src/github.com/hasura $ cd $GOPATH/src/github.com/hasura $ git clone email@example.com:<username>/kubeformation.git $ cd kubeformation
Add upstream as a remote to pull new changes:
$ git remote add upstream https://github.com/hasura/kubeformation.git
Kuberformation has two interfaces, a command line tool and a web api. All the
common code, including the conversion on spec to templates are organised in
pkg/ while the cli
and api code is in
cmd/. More details
about code organisation and packages can be found in
The spec that denotes the Kubernetes cluster is versioned. Any backwards compatible changes can be made to the same version spec itself, but a breaking change should result in a new version.
The logic of converting the spec into the structure that provider takes is also implemented in this package. For any breaking change to the spec, a new version has to be created.
Each managed Kubernetes service provider has it's own package, which contains
the templates and the context to render the template. The context is called
Each provider should implement the interface called
which has a method
MarshalFiles() (map[string]byte, error). It returns a map
of filenames and content, the rendered template.
kubeformation cli implements a command that takes the cluster spec, renders
the template for a provider and writes the files into a directory.
The API accepts JSON by POST and responds with either a map of files and contents in JSON or a ZIP file that downloads.
Write unit tests as much as you can.
Build & Test
go run cmd/api/kubeformation.go- test out api
go run cmd/cli/kubeformation.go- test out cli
All build and test rules are written in Makefile.
make build-api-localbuilds api server using local go installation
make build-clibuilds the cli tool
make testruns the unit tests
If everything looks well, submit a PR ☺