GitOps Practice Folder

Status: Active
Last Updated: 2026-08-29
Category: GitOps
Prerequisites: ../cicd/cicd-concepts, ../basics/git-fundamentals
Tags: gitops, infrastructure, flux, argo, drift, reconciliation, policy, merge

Summary

This directory holds the operational playbooks that make Git the single source of truth for fogserv.cloud. It covers the governing GitOps workflow, drift detection and triage, merge discipline, and policy-as-code enforcement across CI and admission layers.

Context / Why This Matters

GitOps replaces imperative scripts and tribal knowledge with a declarative, auditable model: the Git repository is the desired state, and operators (Flux or Argo CD) continuously reconcile live cluster state toward it. This produces a complete audit trail, trivially reproducible infrastructure, and fast rollback via git revert.

However, GitOps only delivers these guarantees when the workflow is rigorous: commits must be atomic and ticket-linked, drift must be detected and triaged systematically, merge discipline must keep deployment history clean, and guardrails must prevent regressions from bypassing the pipeline. The articles in this folder codify each of those obligations.

Contents

Article Status Last Updated Purpose
gitops.md Active 2026-01-30 Governing workflow, Forgejo Actions pipeline, campsite rule
drift-detection-runbook.md Active 2026-08-26 Detect, classify, and resolve configuration drift
merge-strategies.md Active 2026-08-26 Atomic commits, squash discipline, release tagging
policy-as-code.md Active 2026-08-26 Kyverno admission + Conftest CI policy enforcement

Article Map

gitops.md                    (entry point — start here)
    ├── merge-strategies.md   (commit hygiene upstream of merge)
    ├── drift-detection-runbook.md
    │       ├── merge-strategies.md  (reduces accidental drift commits)
    │       └── policy-as-code.md    (prevents drift at admission time)
    └── policy-as-code.md
            └── drift-detection-runbook.md  (policy violations → drift incidents)

Implementation / Core Principles

The GitOps Contract

Every change to fogserv.cloud's running infrastructure follows this contract:

  1. Ticket first — no infrastructure change is made without a Forgejo Issue; the ticket number appears in the branch name, commit subject, and MR title.
  2. Declarative manifests only — no imperative kubectl apply in normal operations; everything lives in clusters/*/.
  3. Pipeline gate — Forgejo Actions lints, renders (kustomize build), and optionally dry-runs before merge; checks must pass.
  4. Squash merge to main — the deployment history is the commit history; each MR produces exactly one revertable commit.
  5. Reconciler owns drift — Flux or Argo CD pulls changes from main and corrects drift automatically; manual intervention is the exception, never the rule.
  6. Campsite rule — leave surrounding code, tests, and docs cleaner than you found them before closing the ticket.

Tooling Summary

Tool Role Where
Forgejo + Actions MR pipeline, render checks, conftest policy tests CI layer
Flux CD or Argo CD Pull-based reconciler; drift detection + auto-heal Cluster layer
Kyverno Admission policies (Enforce/Audit) Cluster admission
Conftest / OPA Rego-based manifest linting CI layer
Kustomize Overlay-based environment promotion CI + reconciler

Enforcement Points

Update Rules

Common Pitfalls

Pitfall Prevention
Hotfix applied by hand, never committed Forgejo Actions denies non-MR pushes to protected branches; drift sweep catches it within 24 h
Large merge commits polluting deployment history Repository settings enforce squash-merge only on protected main
Policy too strict on day one, causing outage Kyverno starts in Audit; Enforce activated only after violation review
Divergent staging/prod overlays Overlay promotion via Kustomize bases; never hand-edit clusters/prod/ directly
Drift reappears after reconcile Find the writer (managedFields / audit logs) before reconciling again

Next Steps / Ops Actions

  1. First session: read gitops.md end-to-end, then configure Forgejo branch protection and Actions render gate.
  2. Second session: schedule the drift-sweep script (see drift-detection-runbook) and wire it to alerting.
  3. Third session: enable Kyverno in Audit mode on staging; review violations at next ops sync.
  4. Ongoing: every MR touching clusters/prod/ must pass render + conftest checks; enforce via branch protection, not culture.

Sources & Related Articles

External references consulted:

Related knowledge-base articles:

Change Log

2026-08-29

Choose Theme

Your selection is saved locally.

Neural Cacophony
Aperture v2
Flux v1
Mosaic Chaos
Nexus v1
Nexus Zest
Prism v2
Synapse