> ## Documentation Index
> Fetch the complete documentation index at: https://sariva.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# The GitOps approval loop

> How a change request becomes reviewed, applied infrastructure — with a human in the loop.

Every infrastructure change flows through your Git repository and your CI, with a human approving before anything is applied. Sariva proposes; you decide.

```mermaid theme={null}
sequenceDiagram
  participant U as You (Slack)
  participant S as Sariva
  participant G as GitHub repo
  participant CI as GitHub Actions
  participant K as Kafka / AWS
  U->>S: "add a cluster / topic"
  S->>G: open pull request (Terraform)
  S->>U: PR link in #kafka-approvals
  U->>G: review & merge
  G->>CI: trigger workflow
  CI->>K: terraform apply
  S-->>G: poll workflow run (outbound)
  S->>U: confirms — registered & observable
```

## Why it's shaped this way

* **Human approval is mandatory.** The agent generates the change; a person merges the PR and owns the `terraform apply`. Nothing is applied autonomously.
* **Git is the source of truth.** Your cluster and topic definitions live in your repo; Sariva contributes PRs to it, and a background watcher registers what actually got applied.
* **Outbound-only.** Your CI applies Terraform and Sariva *polls* GitHub for the result — but GitHub Actions never calls back into the Sariva pod. This keeps the Sariva platform's network surface closed.
* **Credentials by reference.** When a change needs a new credential, Terraform writes it to *your* secret store and Sariva records only a *reference* — it never stores the secret value. (Full model: [Connecting Kafka clusters](https://sariva.mintlify.site/connecting-clusters/overview.md).)

## Closing the loop: the watcher

After CI finishes `terraform apply`, something has to tell Sariva that the new (or changed) cluster exists, so it becomes observable. That's the **watcher** — an optional background component that closes the loop automatically (the `poll workflow run` step in the diagram above).

When enabled, the watcher:

1. **polls** the GitHub Actions run for your apply — every **60 seconds** by default (`gitops.workflow_watcher.poll_interval_seconds`). This is **polling, not a push**: Sariva reaches out to GitHub on a cadence; GitHub never calls in, so there's no inbound webhook or public endpoint to expose,
2. reads the **Terraform outputs** that run published (the `tf-outputs-<stage>` artifact), and
3. **auto-registers** the resulting cluster with Sariva, so lag, health, and alerts light up with no manual step.

Without the watcher, the same result is a manual step: download the run's `terraform-outputs.json` artifact and register the cluster yourself. Either way the registration is **outbound-only** — Sariva reaches out to GitHub; GitHub never reaches in.

The watcher is **opt-in** (`workflow_watcher.enabled`) and needs the Sariva platform's GitHub token to include the `Actions: read` scope. Configuration lives in [CI → AWS auth](https://sariva.mintlify.site/install-setup/ci-aws-auth.md).

> [!NOTE]
>
> A few growth operations need one or two manual follow-ups (e.g. a real cluster endpoint only exists after the first apply). The PR's checklist spells these out — see [Using Sariva](https://sariva.mintlify.site/using-sariva/overview.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.