gitcontroller watches Kubernetes Deployments which use one or more gitRepo
volumes and then watches for changes in the associated git repository and branch.
When there are changes in git the gitcontroller
will perform a rolling upgrade of the Kubernetes Deployments to use the new configuration git repository revision; or rollback. The rolling upgrade policy (e.g. speed and number of concurrent pods which update and so forth) is all specified by your rolling update configuration in the Deployment specification.
Here is an example of how to add a gitRepo
volume to your application; in this case a spring boot application to load the application.properties
file from a git repository.
You can either run gitcontroller
as a microservice in your namespace or you can use the gitcontroller
binary at any time or as part of your CI / CD Pipeline process.
Note we recommend using separate git based configuration repository only for things which truly are environment specific. Its simpler to include all other configuration data with your microservice source code and then use a more regular CI / CD Pipeline from a single git repository to build your code, create the configuration files and package it all into an immutable docker image.
An alternative approach to using a git repository for environmental configuration and gitcontroller
is to use ConfigMap such as the ConfigMap PropertySource for spring. On the plus side ConfigMap
is supported natively inside Kubernetes; though the downside is ConfigMap has no versioning or history; so once a ConfigMap is changed you've lost track of who changed what and when which makes it harder to track changes.
So if history or tracking changes in your configuration is important we recommend git
over ConfigMap
.
To use gitcontroller
as a command, such as in a CI / CD pipeline download a binary of gitcontroller then use the following command:
gitcontroller check
This will check all Deployments in the current namespace for gitRepo
volumes and perform rolling upgrades if they have changed.
You can specify a label selector expression via the --selector
command line option which will filter the deployments that are checked.
The gitcontroller
microservice is now included in the fabric8 release so you can install and run gitcontroller via the fabric8 developer console via the Run...
button on the Runtime
view or the gofabric8 installer via:
gofabric8 deploy -y --app=gitcontroller --domain=vagrant.f8
You can also run the gitcontroller
microservice locally on your machine via the following (adding a --selector
selector to filter the deployments watched if you prefer)
gitcontroller run
Install go version 1.5.1
git clone git@github.com:fabric8io/gitcontroller.git $GOPATH/src/github.com/fabric8io/gitcontroller
./make
Make changes to *.go files, rerun make
and run the generated binary..
e.g.
./build/gitcontroller help