GitOps and Declarative Configuration
Part of platform and delivery.
Question: how do you change a running system so that every change is reviewed, recorded, reversible, and applied the same way every time?
GitOps answers this with three moves:
- Describe the desired state of the system declaratively.
- Keep that description in version control.
- Let an automated agent make the running system match it.
The term was coined at Weaveworks in 2017. The principles now live in the vendor-neutral OpenGitOps project.
Declarative desired state
A declarative system has two parts:
- a specification that states what should be true;
- an engine that works out how to make it true and keeps it true.
The declarative design notes describe the same split, with desired-state systems as one family alongside query languages and functional programs.
Kubernetes is the common example. Controllers compare the desired state of each resource with the actual state of the cluster and adjust the cluster to close the gap, in a loop that never ends. See maintaining desired state and declarativity in the Kubernetes notes. The general pattern is the control plane.
Imperative versus declarative changes:
- Imperative: run these commands in this order. The result depends on the starting state, and the history lives in someone’s shell.
- Declarative: this is the state I want. The same declaration applied twice gives the same result, and the declaration itself is the record.
The Kubernetes notes describe switching from imperative kubectl commands to manifest files by exporting existing resources.
The four OpenGitOps principles
The principles do not require Git specifically; Git is the usual store because review, history, and revert come with it.
Push versus pull
Pull-based reconciliation is what GitOps usually means. Push-based pipelines that read declarations from Git share the review and history benefits but not continuous reconciliation.
Drift
Drift is any difference between the declared and the actual state, such as a manual hotfix, a change made through a console, or a controller that failed partway.
A reconciling agent either reverts drift or reports it. Reverting a hotfix someone made during an incident can reopen the incident. Decide which resources are reconciled strictly and how emergency changes get back into Git.
Environments and promotion
Each environment gets its own declaration, usually as a shared base plus per-environment overlays: Kustomize overlays, or Helm values per environment.
Promotion is a change to the next environment’s declaration, made through a pull request. Rollback is a revert.
This follows the Twelve-Factor split:
- what is the same everywhere belongs in the build artifact;
- what varies per deploy belongs in configuration.
Salatino’s book builds this as environment pipelines: separate pipelines that manage the declaration of each environment, distinct from the service pipelines that build artifacts.
Secrets
Secrets cannot sit in a Git repository in plain text, so GitOps makes the Twelve-Factor secrets problem sharper. The common options:
- Encrypted in Git: Sealed Secrets or SOPS store ciphertext that only the cluster can decrypt.
- Referenced from Git: an operator, such as External Secrets, reads a declared reference and fetches the value from a secret manager at runtime.
The second matches the Twelve-Factor note’s advice: keep secrets apart from configuration and fetch them at runtime from a manager that authenticates the workload.
Infrastructure in the same model
Infrastructure as code tools such as Terraform are declarative but usually run as push: someone runs plan and apply, and a state file records what exists.
Crossplane brings cloud infrastructure into the Kubernetes reconciliation model, so infrastructure resources can be declared and reconciled like workloads. Salatino uses it for multi-cloud infrastructure.
Limits
- Imperative steps: database migrations and one-off jobs don’t converge; they run once, in order. Model them as jobs triggered by a declared version rather than as state.
- Ordering: resources that depend on each other need explicit ordering or must tolerate starting in any order. The 12 Fractured Apps advice on startup retries applies.
- Change rate: Git suits changes made by people at review speed. It does not suit values that change every few seconds, such as autoscaling targets or traffic weights, which belong to a controller.
- Visibility: a merged change is not a deployed change. Developers need to see reconciliation status, not just the commit.
Applied to AI system configuration
The AI design notes propose the same model for AI systems: declarative system configuration and configuration publishing and version identity. The proposal has four parts:
- Git stores the authored desired state of a system: its prompts, components, and versions.
- A build step resolves references and defaults into an immutable resolved revision with its own fingerprint.
- Deployment, evaluation, and workbench runs consume that resolved revision; environment bindings are kept separate from the system’s identity.
- Runtime traces, outputs, metrics, and secrets live elsewhere.
That is Twelve-Factor’s build-release-run separation and GitOps applied to a system definition rather than to infrastructure. The distinction between the source commit and the resolved revision is the same as between a Git commit and an image digest.
Leads to
- Control plane: the reconciler is a control plane, and its outage must not stop the running system.
- Developer experience: pull requests as the interface to the platform.
- Deployment: progressive delivery on top of declared state, for example traffic weights managed by a controller.
Sources
- OpenGitOps principles.
- Argo CD and Flux documentation.
- Salatino 2024: environment pipelines and Crossplane.
Library sources
- Salatino 2024, Platform Engineering on Kubernetes – on Environments and promotion and Infrastructure in the same model
- Chankramath et al. 2026, Effective Platform Engineering – policy as code and the platform control plane
Further reading:
- Beyer et al. 2016, Site Reliability Engineering: How Google Runs Production Systems – chapter 8, “Configuration Management”: ways to ship configuration, and the skew between checked-in and running configuration