Documentation
¶
Overview ¶
Package fleet declares, in code, which Proxmox container runs which service, so a push deploy job can prove it is touching the right container and a nightly check can catch the fleet drifting away from the code.
A Fleet synthesizes to .yawn/fleet.json (data only, no secrets). The deploy job on the Proxmox host reads that file at a verified commit; Discover and Diff compare it with what `pct` reports.
Index ¶
Constants ¶
const SchemaVersion = 1
SchemaVersion of fleet.json.
Variables ¶
This section is empty.
Functions ¶
func ParsePctList ¶
ParsePctList reads `pct list` output into CTID -> status.
func ParseUpdateEntrypoint ¶
ParseUpdateEntrypoint extracts the community-scripts slug from a container's /usr/bin/update: SCRIPT_SLUG in current entrypoints, otherwise the ct/<name>.sh an older entrypoint downloads. Unsafe values return "".
Types ¶
type Container ¶
type Container struct {
// Node is the Proxmox node name, e.g. "kratos".
Node string `json:"node"`
// CTID is the Proxmox container ID.
CTID int `json:"ctid"`
// Hostname must match the container's configured hostname.
Hostname string `json:"hostname"`
// IP is the container's IPv4 address; the deploy job checks the running
// container really holds it.
IP string `json:"ip"`
// Unprivileged containers are expected; privileged ones must say so.
Privileged bool `json:"privileged,omitempty"`
}
Container is a Proxmox LXC as it must look before any deploy touches it.
type Finding ¶
type Finding struct {
Severity Severity `json:"severity"`
Service string `json:"service,omitempty"`
CTID int `json:"ctid,omitempty"`
Message string `json:"message"`
}
Finding is one difference between code and the live fleet.
type Fleet ¶
type Fleet struct {
// contains filtered or unexported fields
}
Fleet is the declared set of services.
func Load ¶
Load parses fleet.json, refusing unknown fields and other schema versions, and re-validates every entry exactly as Add does.
func (*Fleet) Add ¶
Add declares a service. It panics on invalid input or a duplicate ID, CTID, IP or route, like the other cdk constructs.
type Kind ¶
type Kind string
Kind is how a service is installed, which decides how it is updated.
const ( // CommunityScript was installed by a community-scripts.org script; it // updates through the /usr/bin/update entrypoint the script wrote. CommunityScript Kind = "community-script" // Compose runs as Docker Compose inside the container. Compose Kind = "compose" // Custom has a bespoke, reviewed deploy script (e.g. the Caddy edge). Custom Kind = "custom" // Unmanaged is recorded for identity and drift only; deploys refuse it. Unmanaged Kind = "unmanaged" )
type Observed ¶
type Observed struct {
Node string `json:"node"`
CTID int `json:"ctid"`
Hostname string `json:"hostname"`
IP string `json:"ip"`
// DHCP is true when net0 uses ip=dhcp; IP is then the live address.
DHCP bool `json:"dhcp,omitempty"`
// MAC is net0 hwaddr (lowercase), for DHCP reservations.
MAC string `json:"mac,omitempty"`
Status string `json:"status"`
Unprivileged bool `json:"unprivileged"`
Tags []string `json:"tags,omitempty"`
// Script is the community-scripts slug from /usr/bin/update (SCRIPT_SLUG,
// or the ct/<name>.sh an older entrypoint references), empty if absent.
Script string `json:"script,omitempty"`
// BindMounts counts mpN entries with a host path (data a pct snapshot
// would not cover). Paths themselves are not recorded.
BindMounts int `json:"bind_mounts"`
}
Observed is what the Proxmox host reports about one container. Discovery fills it from `pct list`, `pct config <id>` and the container's /usr/bin/update; it never contains secrets or environment values.
func ParsePctConfig ¶
ParsePctConfig reads the output of `pct config <ctid>` (current section only; snapshot sections in [brackets] are ignored). Only the fields fleet needs are kept, so descriptions or other free text never leave the host.
type Service ¶
type Service struct {
ID string `json:"id"`
Container Container `json:"container"`
Kind Kind `json:"kind"`
// Script is the community-scripts slug recorded in the container's
// /usr/bin/update (SCRIPT_SLUG), e.g. "immich". Required for CommunityScript.
Script string `json:"script,omitempty"`
// Routes are the edge hostnames served by this container (from john/ops
// edge/routes.json), e.g. ["photos"].
Routes []string `json:"routes,omitempty"`
// Health is an HTTP(S) URL that must answer 2xx/3xx after a deploy.
Health string `json:"health,omitempty"`
// Secrets are the xyOps secret IDs granted to this service's deploy event.
Secrets []string `json:"secrets,omitempty"`
// Snapshot before each deploy so a failed health check rolls back.
// Defaults to true; containers with bind mounts may need false (pct
// snapshots do not cover bind-mounted data).
NoSnapshot bool `json:"no_snapshot,omitempty"`
Notes string `json:"notes,omitempty"`
}
Service is one application and how to reach, identify and update it.