# containers/fetchit architecture

> Architecture diagram of the GitHub repository containers/fetchit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/containers/fetchit
- Repository: https://github.com/containers/fetchit

## Overview

FetchIt is a scheduled GitOps reconciler for Podman hosts. Its principal workflow is to load target configuration, retrieve and compare Git state, then dispatch configured methods that apply workloads or host artifacts through Podman/systemd; optional lifecycle cleanup and rollback handle removed or failed changes. The graph preserves documented deployment, storage, source-authentication, monitoring, and recovery capabilities. Some method wiring is not present in the sampled excerpts, so those documented relationships cite the README; unsampled implementation details are not inferred.

Main entry points: [`pkg/engine/fetchit.go`](https://github.com/containers/fetchit/blob/main/pkg/engine/fetchit.go) (Scheduled targets), [`pkg/engine/systemd.go`](https://github.com/containers/fetchit/blob/main/pkg/engine/systemd.go) (Systemd services), [`cmd/fetchit/main.go`](https://github.com/containers/fetchit/blob/main/cmd/fetchit/main.go) (CLI entry), [`pkg/engine/apply.go`](https://github.com/containers/fetchit/blob/main/pkg/engine/apply.go) (Git fetch and diff)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime orchestration"]
  node_entry["CLI entry<br/>[main.go]"]
  node_engine["Engine commands<br/>[fetchit.go]"]
  node_config["Target configuration<br/>[config.go]"]
  node_scheduler["Scheduled targets<br/>[fetchit.go]"]
end

subgraph group_sources["Git sources"]
  node_gitstate["Git fetch and diff<br/>[apply.go]"]
  node_gitaccess["Git auth and mirrors<br/>[gitauth.go]"]
end

subgraph group_deploy["Deployment methods"]
  node_raw["Raw containers<br/>[raw.go]"]
  node_kube["Kube workloads<br/>[kube.go]"]
  node_quadlet["Quadlet bundles<br/>[quadlet.go]"]
  node_filetransfer["File transfer<br/>[filetransfer.go]"]
  node_ansible["Ansible method<br/>[ansible.go]"]
end

subgraph group_host["Host operations"]
  node_systemd["Systemd services<br/>[systemd.go]"]
  node_hostartifacts["Host artifacts<br/>[host_artifacts.go]"]
  node_volumes["Named volumes<br/>[volumes.go]"]
end

subgraph group_support["State and observability"]
  node_lifecycle["Removal cleanup<br/>[removals.go]"]
  node_rollback["Apply rollback<br/>[rollback.go]"]
  node_status["Status endpoints<br/>[status.go]"]
end

node_operator(("Host operator"))
node_podman["Podman API"]
node_systemd_mgr["Host systemd"]

node_operator -->|"starts"| node_entry
node_entry -->|"executes"| node_engine
node_engine -->|"loads"| node_config
node_engine -->|"schedules"| node_scheduler
node_scheduler -->|"reconciles"| node_gitstate
node_gitstate -.->|"authenticates"| node_gitaccess
node_scheduler -.->|"dispatches"| node_raw
node_scheduler -.->|"dispatches"| node_kube
node_scheduler -->|"dispatches"| node_quadlet
node_scheduler -->|"dispatches"| node_filetransfer
node_scheduler -->|"dispatches"| node_ansible
node_scheduler -->|"dispatches"| node_systemd
node_scheduler -->|"dispatches"| node_hostartifacts
node_raw -->|"creates containers"| node_podman
node_kube -->|"plays workloads"| node_podman
node_systemd -->|"runs helper"| node_podman
node_systemd -->|"manages services"| node_systemd_mgr
node_scheduler -->|"provisions"| node_volumes
node_scheduler -->|"cleans removals"| node_lifecycle
node_scheduler -->|"can roll back"| node_rollback
node_engine -->|"exposes status"| node_status

click node_entry "https://github.com/containers/fetchit/blob/main/cmd/fetchit/main.go"
click node_engine "https://github.com/containers/fetchit/blob/main/pkg/engine/fetchit.go"
click node_config "https://github.com/containers/fetchit/blob/main/pkg/engine/config.go"
click node_scheduler "https://github.com/containers/fetchit/blob/main/pkg/engine/fetchit.go"
click node_gitstate "https://github.com/containers/fetchit/blob/main/pkg/engine/apply.go"
click node_gitaccess "https://github.com/containers/fetchit/blob/main/pkg/engine/gitauth.go"
click node_raw "https://github.com/containers/fetchit/blob/main/pkg/engine/raw.go"
click node_kube "https://github.com/containers/fetchit/blob/main/pkg/engine/kube.go"
click node_quadlet "https://github.com/containers/fetchit/blob/main/pkg/engine/quadlet.go"
click node_filetransfer "https://github.com/containers/fetchit/blob/main/pkg/engine/filetransfer.go"
click node_ansible "https://github.com/containers/fetchit/blob/main/pkg/engine/ansible.go"
click node_systemd "https://github.com/containers/fetchit/blob/main/pkg/engine/systemd.go"
click node_hostartifacts "https://github.com/containers/fetchit/blob/main/pkg/engine/host_artifacts.go"
click node_volumes "https://github.com/containers/fetchit/blob/main/pkg/engine/volumes.go"
click node_lifecycle "https://github.com/containers/fetchit/blob/main/pkg/engine/removals.go"
click node_rollback "https://github.com/containers/fetchit/blob/main/pkg/engine/rollback.go"
click node_status "https://github.com/containers/fetchit/blob/main/pkg/engine/status.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_engine,node_config,node_scheduler toneBlue
class node_gitstate,node_gitaccess toneAmber
class node_raw,node_kube,node_quadlet,node_filetransfer,node_ansible,node_podman toneMint
class node_systemd,node_hostartifacts,node_volumes toneRose
class node_lifecycle,node_rollback,node_status,node_operator,node_systemd_mgr toneIndigo
```

## Components

### Runtime orchestration

- [CLI entry](https://github.com/containers/fetchit/blob/main/cmd/fetchit/main.go): `cmd/fetchit/main.go`
- [Engine commands](https://github.com/containers/fetchit/blob/main/pkg/engine/fetchit.go): `pkg/engine/fetchit.go`
- [Target configuration](https://github.com/containers/fetchit/blob/main/pkg/engine/config.go): `pkg/engine/config.go`
- [Scheduled targets](https://github.com/containers/fetchit/blob/main/pkg/engine/fetchit.go): `pkg/engine/fetchit.go`

### Git sources

- [Git fetch and diff](https://github.com/containers/fetchit/blob/main/pkg/engine/apply.go): `pkg/engine/apply.go`
- [Git auth and mirrors](https://github.com/containers/fetchit/blob/main/pkg/engine/gitauth.go): `pkg/engine/gitauth.go`

### Deployment methods

- [Raw containers](https://github.com/containers/fetchit/blob/main/pkg/engine/raw.go): `pkg/engine/raw.go`
- [Kube workloads](https://github.com/containers/fetchit/blob/main/pkg/engine/kube.go): `pkg/engine/kube.go`
- [Quadlet bundles](https://github.com/containers/fetchit/blob/main/pkg/engine/quadlet.go): `pkg/engine/quadlet.go`
- [File transfer](https://github.com/containers/fetchit/blob/main/pkg/engine/filetransfer.go): `pkg/engine/filetransfer.go`
- [Ansible method](https://github.com/containers/fetchit/blob/main/pkg/engine/ansible.go): `pkg/engine/ansible.go`

### Host operations

- [Systemd services](https://github.com/containers/fetchit/blob/main/pkg/engine/systemd.go): `pkg/engine/systemd.go`
- [Host artifacts](https://github.com/containers/fetchit/blob/main/pkg/engine/host_artifacts.go): `pkg/engine/host_artifacts.go`
- [Named volumes](https://github.com/containers/fetchit/blob/main/pkg/engine/volumes.go): `pkg/engine/volumes.go`

### State and observability

- [Removal cleanup](https://github.com/containers/fetchit/blob/main/pkg/engine/removals.go): `pkg/engine/removals.go`
- [Apply rollback](https://github.com/containers/fetchit/blob/main/pkg/engine/rollback.go): `pkg/engine/rollback.go`
- [Status endpoints](https://github.com/containers/fetchit/blob/main/pkg/engine/status.go): `pkg/engine/status.go`

### Other components

- **Host operator**
- **Podman API**
- **Host systemd**

## Connections

- Host operator → CLI entry: starts (evidence: `README.md`)
- CLI entry → Engine commands: executes (evidence: `cmd/fetchit/main.go`)
- Engine commands → Target configuration: loads (evidence: `README.md`)
- Engine commands → Scheduled targets: schedules (evidence: `pkg/engine/fetchit.go`)
- Scheduled targets → Git fetch and diff: reconciles (evidence: `README.md`)
- Git fetch and diff → Git auth and mirrors: authenticates
- Scheduled targets → Raw containers: dispatches
- Scheduled targets → Kube workloads: dispatches
- Scheduled targets → Quadlet bundles: dispatches (evidence: `README.md`)
- Scheduled targets → File transfer: dispatches (evidence: `README.md`)
- Scheduled targets → Ansible method: dispatches (evidence: `README.md`)
- Scheduled targets → Systemd services: dispatches (evidence: `README.md`)
- Scheduled targets → Host artifacts: dispatches (evidence: `README.md`)
- Raw containers → Podman API: creates containers (evidence: `pkg/engine/raw.go`)
- Kube workloads → Podman API: plays workloads (evidence: `pkg/engine/kube.go`)
- Systemd services → Podman API: runs helper (evidence: `pkg/engine/systemd.go`)
- Systemd services → Host systemd: manages services (evidence: `README.md`)
- Scheduled targets → Named volumes: provisions (evidence: `README.md`)
- Scheduled targets → Removal cleanup: cleans removals (evidence: `README.md`)
- Scheduled targets → Apply rollback: can roll back (evidence: `README.md`)
- Engine commands → Status endpoints: exposes status (evidence: `README.md`)
