To build all components of the operator run:
# With E2E tests mvn clean install jib:dockerBuild # Without E2E tests mvn clean install -DskipTests jib:dockerBuild
First all CustomResourceDefinitions have to be deployed:
kubectl apply -f target/classes/META-INF/fabric8/*-v1.yml
Then the operator and associated RBAC rules can be deployed:
kubectl apply -f k8s/operator.yaml
k8s/operator.yaml
contains a basic deployment of the operator. Resources, docker image name etc. might have to be adapted.
An example of a GitGc-CustomResource can be found at k8s/gitgc.sample.yaml
. To install it into the cluster run:
kubectl apply -f k8s/gitgc.sample.yaml
The operator will create a CronJob based on the provided spec.
apiVersion: "gerritoperator.google.com/v1alpha1" kind: GitGarbageCollection metadata: name: gitgc spec: ## Container image containing the git gc script. Expected to be the one maintained ## by the k8sgerrit project (default: k8sgerrit/git-gc) image: k8sgerrit/git-gc ## Cron schedule defining when to run git gc (mandatory) schedule: "*/5 * * * *" ## List of projects to gc. If omitted, all projects not handled by other Git GC ## jobs will be gc'ed. Only one job gc'ing all projects can exist. (default: []) projects: [] # - All-Projects # - All-Users ## Resource requests/limits of the git gc container ## (https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) ## (optional) resources: requests: cpu: 100m memory: 256Mi limits: cpu: 100m memory: 256Mi ## Name of an existing PVC that will be used to store the logs (mandatory) logPVC: logs-pvc ## Name of an existing PVC that claims the volume containing the git repositories ## to be gc'ed (mandatory) repositoryPVC: git-repositories-pvc