Skip to content

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.yaml

Enabling GitOps Mode

Set the following environment variables:

bash
FEATURE_GITOPS_ENABLED=true
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx

The GITHUB_TOKEN must have contents:read permission on the target repository.

How It Works

  1. SLOzy polls the configured Git repository on a periodic basis (or listens for webhooks).
  2. It reads YAML files from a well-known path (e.g. slos/ and teams/).
  3. It diffs the local state against the Git state and applies changes.
  4. 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 endpoints

Drift 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.
  • internal/gitops/ — Git repository sync logic
  • FEATURE_GITOPS_ENABLED env var toggle
  • GITHUB_TOKEN for repository authentication