jx-git-operator is an operator which polls a git repository for changes and triggers a Kubernetes Job to process changes in git.
It can be used to install/upgrade any environment (development, staging, production) via some GitOps approach using some set of tools (kubectl, helm, helmfile, kpt, kustomize etc).
This operator will poll for git commits in git repositories. If a new git commit sha is detected in the repository, the repository is cloned and a Job is triggered.
The Job to trigger is defined in the .jx/git-operator/job.yaml file inside the git repository.
Here is an example repository so you can see how it works
The jx-admin command line will install the operator for you and setup the Git URL Secret so try one of these commands:
- jx-admin operator if you already have a git repository and just want to install the operator
To install the git operator by hand using helm 3 then try:
Setup a namespace:
helm repo add jx3 https://storage.googleapis.com/jenkinsxio/charts
helm upgrade --install \
--set url=$GIT_URL \
--set username=$GIT_USER \
--set password=$GIT_TOKEN \
jx-git-operator --create-namespace jxgo jx3/jx-git-operatorTo see the logs of the operator try:
kubectl logs -f -l app=jx-git-operatoryou should see it polling your git repository and triggering Job instances whenever a change is deteted
You can run the jx-git-operator locally on the command line if you want. Actions will be created as Kubernetes Jobs even if you run the binary locally - it is just the git polling which runs locally.
Download the jx-git-operator binary for your operating system and add it to your $PATH.