Manage test environments for pull requests
Make sure you have GO installed and configured your GOPATH.
$ git clone [email protected]:kolonialno/pr-deployment-controller.git $GOPATH/src/github.com/kolonialno/pr-deployment-controller
$ cd $GOPATH/src/github.com/kolonialno/pr-deployment-controller
$ make vendor # Install dependencies
The pr-deployment-controller uses the operator-pattern to watch test environments inside the Kubernetes cluster. The controller is responsible for the following tasks:
- Answer GitHub webhooks and update status checks
- Build docker container for each environment
- Create a separate environment for each pull-request
- Provide terminal access to the environment
- Remove stale builds
- Orchestrate creation of databases, including data preparation
To do this, the pr-deployment-controller consist of the following packages:
- apis: Kubernetes api definitions for custom resources
- builder: Background worker orchestrating docker builds
- cleanup: Background worker used to detect old environments
- controller: Custom Kubernetes controller responsible for cluster resource management
- databaseprovisioner: Provision postgres databases for the test environments
- debug: Debug server used to expose application metrics
- github: Interface for interacting with GitHub
- internal: Internal utils
- k8s: Kubernetes api client
- status: Serves a statuspage before the environment is ready for traffic and a web-based terminal
- webhook: GitHub webhook server
$ make test
$ make build
$ make push
kubebuilder create api --group testenvironment --version v1alpha1 --kind Resource
- docker/docker/client - Docker client
- google/go-github - GitHub client
- k8s.io/apimachinery - Kubernetes API definitions
- sigs.k8s.io/controller-runtime - Kubernetes operator framework