GitOps Integration
SLOzy supports managing SLO definitions declaratively through a Git repository, following GitOps principles.
Concept
Instead of creating and editing SLOs through the UI, you can define them as YAML files in a Git repository. SLOzy watches the repository and synchronises the state automatically, so your SLO definitions are version-controlled, reviewed, and auditable.
slozy-config/
slos/
api-service.yaml
database-service.yaml
frontend-latency.yaml
teams/
platform.yaml
backend.yaml
notification-policies.yamlEnabling GitOps Mode
Set the following environment variables:
bash
FEATURE_GITOPS_ENABLED=true
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxThe GITHUB_TOKEN must have contents:read permission on the target repository.
How It Works
- SLOzy polls the configured Git repository on a periodic basis (or listens for webhooks).
- It reads YAML files from a well-known path (e.g.
slos/andteams/). - It diffs the local state against the Git state and applies changes.
- Conflicts or validation errors are reported as alerts.
Example SLO Definition
yaml
apiVersion: slozy.io/v1
kind: ServiceLevelObjective
metadata:
name: api-availability
team: platform
spec:
targetPercentage: 99.9
window: 30d
indicator:
type: prometheus
query: |
sum(rate(http_requests_total{status!~"5.."}[5m]))
/ sum(rate(http_requests_total[5m]))
description: API availability SLO for production endpointsDrift Detection
When a user modifies an SLO through the UI while GitOps is enabled, the change is flagged as drift. The operator can either:
- Push the change back to the Git repository (outbound sync), or
- Revert the change to match the repository state (inbound reconcile)
This prevents configuration drift and keeps the Git repository as the single source of truth.
Limitations
- GitOps mode is additive — some configuration (e.g. secrets, user management) must still be done through the UI or API.
- Webhook support requires the SLOzy instance to be reachable from GitHub/GitLab.
- The current implementation uses polling (configurable interval), not streaming.
Related Files
internal/gitops/— Git repository sync logicFEATURE_GITOPS_ENABLEDenv var toggleGITHUB_TOKENfor repository authentication