Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .docs-lint-scope
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ docs/attribution-setup-guide.md
docs/kcp-workspaces.md
docs/push-webhook.md
docs/team-onboarding.md
docs/for-platform-teams.md
docs/for-application-teams.md
docs/audit-setup/cluster/readme.md
docs/sops-age-guide.md
docs/commit-signing.md
Expand Down
11 changes: 11 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ These pages are organized by what you want to do. If you are new, read the
Not sure this is the right tool? [Alternatives](alternatives.md) compares nearby tools and says when
another approach fits better.

## Who uses GitOps Reverser

- **Platform teams** run Kubernetes with a GitOps repository, and want people and tools to change
the cluster through the Kubernetes API while Git stays the record. Start with
[let teams change the cluster through Kubernetes](for-platform-teams.md).
- **Application teams** offer their users or customers an API, such as per-customer settings, and
want every change reviewable, attributed, and in their own Git repository. Start with
[offer your users an API, with every change in Git](for-application-teams.md).

Both continue with **Get started** below.

## 1. Get started

Pick a setup path with one question: **does Flux or Argo CD apply the same folder GitOps Reverser
Expand Down
145 changes: 145 additions & 0 deletions docs/for-application-teams.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# Offer your users an API, with every change in Git

This page is for a software team whose application has settings or objects that people outside the
team change: a customer's settings in a SaaS product, a menu, limits, the integrations a tenant has
turned on. It shows how to serve those through the Kubernetes API, and how GitOps Reverser keeps a
reviewable, attributed record of every change in your own Git repository.

It explains the shape and where each piece comes from. The steps live in the guides it links.

## The problem

Settings that people change at runtime usually end up in one of these places:

- **A file in the application image:** every change is a release.
- **An admin backend and a database you build:** you write validation, permissions, an audit log, a
history view, and an export, and you operate all of it.
- **A feature-flag or configuration service:** fast to adopt, but the data, its history, and its
schema live in somebody else's system.
- **A values file in a GitOps repository:** history and review, but every change is a pull request
that someone has to know how to write.

## The idea: the Kubernetes API as the backend

Kubernetes already provides most of what a settings backend needs. Describe each kind of setting as
a custom resource, and the API server serves it:

| What a settings backend needs | Where it comes from |
| --- | --- |
| A schema, enforced on every write | The CRD's OpenAPI schema and CEL validation rules |
| Who may read and who may write, per kind and per namespace | Kubernetes RBAC |
| Rules that span fields or objects | Admission policies, or a controller that reports in `status` |
| Live updates for the application and for open browser pages | The watch API |
| History, the author of each change, and the reason for it | **GitOps Reverser**: a commit per change, in your repository |
| Review before a change goes live | A Git branch and a pull request |
| Rollback | A Git revert |

GitOps Reverser fills the rows Kubernetes leaves empty. It mirrors your custom resources into a
folder of your repository. With author attribution, each commit names the person the API server
authenticated for that change. With a `CommitRequest`, the application can pass on the user's own
explanation as the commit message. The data, its history, and its schema stay in your repository,
readable without any of this software.

```mermaid
flowchart LR
U["Users: a browser app,<br/>a CLI, an agent"] -->|"typed writes,<br/>under RBAC"| K["Kubernetes API<br/>(your CRDs)"]
K -->|"watch"| R["GitOps Reverser"]
R -->|"attributed commits"| G["Your Git repository"]
K -->|"watch: live settings"| A["Your application"]
G -->|"review, then apply<br/>or package"| A
```

## An example: the coffee bar menu

The [k8s-trail](https://github.com/ConfigButler/k8s-trail) repository is the record of a live demo
where a room full of people changed a cluster from their phones. One of its kinds is a
`CoffeeConfig`, the coffee bar's menu:

1. A person signs in to the app and edits the menu. The app writes the `CoffeeConfig` through the
Kubernetes API with that person's own token, so RBAC and validation answer the request.
2. When the person saves, the app asks for a reason and passes it on with the change.
3. GitOps Reverser commits the change to the branch `coffee-change`. The commit's author is the
person who made the edit, and its message is the reason they typed.
4. Someone opens a pull request from `coffee-change` to `main` and merges it with a merge commit,
which keeps every person's authorship.
5. Flux applies `main`'s `configs/coffee/` folder to the production cluster.

Every other kind in that demo is written straight to `main`. The coffee menu shows the choice you
make per kind: record the change, or record it and review it before it goes live.

## What you build, and what GitOps Reverser does

**You build:**

- The CRDs for your settings, with their schema and validation rules.
- The Roles that decide who may read and change each kind.
- Any controller or admission policy your domain needs.
- The user interface, and how the application reads its settings.

**GitOps Reverser does:**

- Writes each selected object's `spec` and trimmed `metadata` as YAML into a folder you choose. It
never writes `status`. Each change becomes a commit within seconds, and
[commit windows](../README.md#commit-windows) group a burst of edits into one.
- Names the author of each change, with [author attribution](attribution-setup-guide.md).
- Uses the user's own reason as the commit message, through a
[`CommitRequest`](demo/commit-window.md).
- Holds a branch with a [`GitBranch`](configuration.md#one-tenant-end-to-end), so changes can wait
on a branch for review.
- Coordinates with Flux or Argo CD when they apply the same folder back: GitOps Reverser then
decides when the applier applies. See [bi-directional GitOps](bi-directional.md).

## Pieces GitOps Reverser leaves to others

GitOps Reverser does not serve your API, host a user interface, or deliver settings to your
workloads. These open-source projects from the same authors cover those parts. Check each project's
status before you depend on it.

- **Browser access:** [krm-foyer](https://github.com/ConfigButler/krm-foyer) signs users in through
OIDC and proxies their Kubernetes requests with their own credential, so a browser app needs no
backend of its own. It is a working prototype.
- **Live views in the browser:** [krm-stream](https://github.com/ConfigButler/krm-stream) keeps a
live, recoverable view of resources in a page, and merges incoming changes with a user's local
edits.
- **Settings for a workload:** an application can watch its settings live through the API. Or
[settings-image](https://github.com/ConfigButler/settings-image) builds the Git folder into a small
OCI image that a pod mounts by digest, so a settings change rolls out, and rolls back, like any
image change.

## One API per customer: why kcp

When each customer changes their own settings, each customer needs their own space in the API.
There are two ways to give them one:

- **A namespace per customer, on one cluster.** This is enough when every customer uses the same
CRDs, at the same version, and namespace-level RBAC is the isolation you need. CRDs are
cluster-wide, so a schema change reaches every customer at once.
- **A [kcp](https://www.kcp.io) workspace per customer.** A workspace is a customer's own Kubernetes
API, with its own namespaces, RBAC, and CRDs, but without a cluster of its own to run. It suits a
product with many customers, where each one should see only their own API.

GitOps Reverser runs once, in an ordinary cluster beside kcp. It reaches each workspace through its
own `KubeProvider`, and writes each one to its own folder or repository. kcp sends the audit events
of all its workspaces in one shared stream, and GitOps Reverser can tell from each event which
workspace it came from, so every commit still names the right author.
[Mirror kcp workspaces](kcp-workspaces.md) has the steps.

## Before you choose this

- **Git is the record; the API serves the live state.** A change is in effect as soon as the API
accepts it, and reaches Git within seconds. When a change needs review first, record it on its
own branch and apply it only after the merge, as in the coffee example.
- **Author attribution needs the API server's audit settings.** Managed control planes that hide
them cannot name authors, and commits then carry the configured committer. On kcp, you set them
on each shard.
- **Your application depends on the API server being reachable**, unless it reads settings that
were already delivered, such as a mounted settings image.

## Next steps

1. Install GitOps Reverser and see a first commit: the [quick start](quickstart.md).
2. Mirror your custom resources: a `WatchRule` selects them like any other type. See
[start mirroring a team's resources](team-onboarding.md) for the objects involved.
3. Name the author of each change: [the attribution guide](attribution-setup-guide.md).
4. Serve one API per customer: [mirror kcp workspaces](kcp-workspaces.md).
5. When Flux or Argo CD applies the folder: [bi-directional GitOps](bi-directional.md).
106 changes: 106 additions & 0 deletions docs/for-platform-teams.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Let teams change the cluster through Kubernetes, with Git as the record

This page is for a platform team that runs Kubernetes with a GitOps repository, usually applied by
Flux or Argo CD, and serves application teams who change what runs there. It shows what GitOps
Reverser changes for them, how one installation serves many teams, and which guides to follow in
which order.

## The problem

GitOps keeps the desired state in Git, so every change has to arrive as a commit. That works for the
people who know the repository, and creates friction for everyone else:

- A developer who needs a ConfigMap changed has to know the folder layout, the overlays, and the
review rules, or file a ticket and wait.
- A portal, a CI job, or an AI agent that changes the cluster needs a Git client, credentials, and
knowledge of where each file lives.
- A `kubectl` fix during an incident either gets reverted at the next apply or lives on as drift.
- An existing cluster holds state that was never committed anywhere.

## What changes

People and tools change the cluster through the Kubernetes API: `kubectl`, a portal, a CI job, or an
agent. Kubernetes RBAC and admission decide what each of them may do. GitOps Reverser writes each
change into the right folder as a commit within seconds, and Flux or Argo CD keeps deploying from
the repository.

- **Files keep their shape.** An update edits the existing YAML document in place, and in a
supported Kustomize layout it edits the source manifest. See
[what it can write](../README.md#what-it-can-write).
- **Each commit can name its author.** With [author attribution](attribution-setup-guide.md), the
commit names the identity the API server authenticated.
- **A commit can say why.** A [`CommitRequest`](demo/commit-window.md) groups a set of edits into one
commit with the author's own message.
- **The applier waits for Git.** When Flux or Argo CD applies a folder that GitOps Reverser writes,
an applier claim lets GitOps Reverser decide when the applier applies, so a live edit reaches Git
before the folder is applied again. See [bi-directional GitOps](bi-directional.md).

## One installation, many teams

One GitOps Reverser installation serves every team. The platform keeps the objects that hold
credentials in its own namespace, and lends them to teams through **grants**:

- A `GitProvider` holds the repository credential, and grants which namespaces may hold which
branches.
- A `GitBranch` holds one branch, and grants which namespaces may write through it.
- A `KubeProvider` connects a cluster, and grants which namespaces may mirror which source
namespaces.

Each team then creates its own `GitTarget`, which names its folder, and `WatchRule`s, which select
what to mirror, in its own namespace.

![A platform namespace holds the shared GitProvider with its credentials Secret, a KubeProvider and
a GitReceiver; each team namespace has its own WatchRule and GitTarget writing its own branch of that
repository, and a push event is routed by repository and branch to the GitTarget that writes
it](images/config-platform-shared.excalidraw.svg)

A team cannot reach a credential, branch, or cluster that the platform has not granted it, and it
decides everything else about its own folder. [The grants](configuration.md#the-grants) explains
every shape.

## Adopt it in three stages

Each stage stands on its own, so you can stop after any of them.

**1. Mirror.** Start with folders that nothing applies: an audit trail of a namespace, or the first
commit of an existing cluster's state. Nothing about your current GitOps setup changes.

- [Quick start](quickstart.md): install, and see a first commit.
- Connect your Git host: [GitHub](github-setup-guide.md) or
[Azure DevOps](azure-devops-getting-started.md).
- [Start mirroring a team's resources](team-onboarding.md): the grants, the branch, the team's
folder, and how to adopt an existing repository on a scratch branch first.

**2. Coordinate.** Let GitOps Reverser write a folder that Flux or Argo CD applies, so a change can
come from either side.

- [Bi-directional GitOps](bi-directional.md), then the [Flux](bi-directional-flux.md) or
[Argo CD](bi-directional-argocd.md) setup.
- [React promptly to Git pushes](push-webhook.md), so a push to the repository is applied within
seconds.

**3. Explain.** Name who made each change, and why.

- [Attribute commits to Kubernetes users](attribution-setup-guide.md), through the API server's
audit settings.
- [Group changes into one commit](demo/commit-window.md) with a `CommitRequest`.

Alongside the stages: [encrypt Secrets with SOPS](sops-age-guide.md),
[sign commits](commit-signing.md), [narrow the controller's permissions](rbac.md), and
[monitor it](interpreting-metrics.md).

## Before you choose this

- **Git history is a record of the selected state, not of every event.** Commit windows group a
burst of edits into one commit, and a restart resyncs instead of replaying every change.
- **Author attribution needs the API server's audit settings.** Managed control planes that hide
them cannot name authors; commits then carry the configured committer.
- **Mirror what people author, and leave out what controllers generate.** A `Deployment` belongs
in Git; its `ReplicaSet`s and `Pod`s do not. See
[installing apps as KRM](installing-apps-as-krm.md).
- **Some layouts are refused.** GitOps Reverser edits plain manifests and a supported Kustomize
subset. It refuses a folder of Helm templates before writing anything.

If your team offers an API to users or customers rather than running clusters for other teams,
[offer your users an API, with every change in Git](for-application-teams.md) is the better
starting point.
20 changes: 19 additions & 1 deletion docs/future/task-oriented-docs-and-website.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ Organize the reader-facing navigation around outcomes. A reader should be able t
step without already knowing names such as `GitTarget`, attribution, or API-first publication.
Keep architecture and configuration reference available alongside the task guides.

## Two personas

The docs serve two kinds of reader, and each has a page that starts from its problem before any
setup:

- **Platform teams** run Kubernetes with a GitOps repository and serve application teams:
[let teams change the cluster through Kubernetes](../for-platform-teams.md).
- **Application teams** offer their users or customers an API, such as per-customer settings:
[offer your users an API, with every change in Git](../for-application-teams.md). This is the page
that explains why a product would serve one kcp workspace per customer.

A persona page explains GitOps Reverser's part, and links the sibling projects for the parts it
leaves to others (browser access, live views, delivering settings to workloads) instead of
documenting them here. An example earns its place on a persona page when it shows a decision GitOps
Reverser makes.

## The four main categories

These categories form the documentation landing page and the website's documentation navigation.
Expand Down Expand Up @@ -121,8 +137,10 @@ even where source material does. Proposed guides are named by task, not by filen
| `docs/README.md` | Documentation landing page | Exists: organized around the four categories; link each new guide as it lands |
| Root `README.md` | Homepage | Exists: reuse the product explanation and demo |
| `alternatives.md` | Homepage: is this right for me? | Exists: link from adoption guidance |
| `for-platform-teams.md` | Homepage and landing page: who uses it | Exists: the platform-team persona, the grants model, and the three adoption stages with their guides |
| `for-application-teams.md` | Homepage and landing page: who uses it | Exists: the application-team persona, the Kubernetes API as a settings backend, the k8s-trail example, sibling projects, and why kcp |
| `quickstart.md` | Get started: mirror | Exists: verify a first commit without an applier claim or push webhook |
| `team-onboarding.md` | Get started: mirror | Exists: grants, branch, folder, selection, scratch-branch adoption, deletion policy; asks whether an applier deploys the folder |
| `team-onboarding.md` | Get started: mirror | Exists: one worked example for the platform administrator, with a handoff to the team at step 5; grants, branch, folder, selection, scratch-branch adoption, deletion policy |
| `github-setup-guide.md` | Get started: Git host | Exists: link to the push webhook guide |
| `push-webhook.md` | Get started: coordination | Exists: receiver listener, route, `GitReceiver`, GitHub webhook, verification, rotation, and the Azure DevOps limit |
| `azure-devops-getting-started.md` | Get started: Git host | Exists: state the push webhook limit described below |
Expand Down
4 changes: 3 additions & 1 deletion docs/kcp-workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

This guide mirrors the resources of one or more [kcp](https://www.kcp.io) workspaces into Git, and
optionally names the workspace user who made each change as the commit author. It is for a
platform administrator who runs kcp and installs GitOps Reverser beside it.
platform administrator who runs kcp and installs GitOps Reverser beside it. Why a product would
serve one workspace per customer is in
[offer your users an API, with every change in Git](for-application-teams.md#one-api-per-customer-why-kcp).

The guide has two parts, and you can stop after the first:

Expand Down
Loading