2 minutes
Using Gitea Webhook for Fleet Repository Sync

By default, Fleet polls Git repositories (default: every 15 seconds) to sync changes. While this approach works well for a small number of repositories, it may lead to inefficiencies in setups with tens or hundreds of repositories. Additionally, polling introduces latency between a Git push and Fleet reacting to it. To improve performance and reduce latency, configuring webhooks in Gitea is recommended.
Pre-requisites
- Before starting, ensure you have completed the Get Started with Fleet and Gitea in Kubernetes tutorial
Configuration
- Edit your
GitReporesource to disable polling by settingdisablePollingtotrue. This ensures Fleet no longer automatically polls the repository.
apiVersion: fleet.cattle.io/v1alpha1
kind: GitRepo
metadata:
name: sample
namespace: fleet-local
spec:
repo: "http://gitea-http.gitea.svc.cluster.local:3000/testing/testing.git"
branch: main
paths:
- simple
targetNamespace: default
disablePolling: true
- Run the port-forward to access Gitea
kubectl port-forward svc/gitea-http -n gitea 3000:3000
- Go to http://localhost:3000
- Go to repository settings and webhooks option
- Add a new webhook
- Set the URL to http://gitjob.cattle-fleet-system.svc.cluster.local, other settings can be left at their defaults.
- Save the webhook and test it using the “Test Delivery” option
- If configured correctly, the webhook test should return a
200status code with a message statingsucceededin the response tab. - Now, every time you push changes to the repository, the webhook will trigger automatically, and Fleet will deploy the updates to the
defaultnamespace
References
kubernetes devops fleet gitea gitops
219 Words
2025-01-27 00:00 +0000 (Last updated: 2025-06-26 23:10 +0000)
2696f8c @ 2025-06-26
Read other posts