diff --git a/README.md b/README.md index f3ab23e..999dac5 100644 --- a/README.md +++ b/README.md @@ -1,136 +1,73 @@ # HomeK8s -A three-node Kubernetes cluster: two machines on a home network and one cloud -VPS, joined with kubeadm and reconciled from this repository by Flux CD. The -manifests here run the public sites listed below, plus the git server and CI -that build them. +Home Kubernetes cluster (kubeadm), same GitOps layout as `lab/`. -## Architecture +Flux CD will take over once Forgejo is back. Until then apply with kustomize: -```mermaid -flowchart LR - net([Internet]) --> cf["Cloudflare TLS"] - cf --> t["cloudflared
rpi, host service"] - t --> gw["Cilium Gateway
gateway-system/public
10.10.0.2:8080"] - gw --> rt["HTTPRoute"] - rt --> svc["Service"] - svc --> pod["Pods
siriussec"] +```bash +kubectl apply -k infrastructure/home ``` -Public requests terminate at Cloudflare and are carried by a cloudflared tunnel -on `rpi` to the Cilium Gateway on `siriussec` at `http://10.10.0.2:8080`, where a -Gateway API HTTPRoute selects the Service. The tunnel is the only public ingress. +## Cluster -Nodes and pods reach each other over a WireGuard mesh in `10.10.0.0/24`. Cilium -routes pod traffic natively across that tunnel — `10.244.0.0/16`, no VXLAN -overlay, and kube-proxy is replaced by Cilium's BPF data path. +| Node | WG IP | Roles | Notes | +|-------------|------------|--------------------------|--------------------------------------------| +| siriussec | 10.10.0.2 | control-plane, worker | default scheduling | +| rpi | 10.10.0.1 | traffic, worker | `dedicated=network:PreferNoSchedule` | -## Nodes +- CNI: Cilium 1.18.13, kube-proxy replacement, Gateway API hostNetwork on `dedicated=network` +- Overlay: WireGuard `10.10.0.0/24` (API only on WG) +- Ingress: Cloudflare tunnel → `127.0.0.1:8080` on rpi → Gateway `gateway-system/public` +- Storage: local-path on siriussec (`/opt/local-path-provisioner`) -| Node | Roles | WireGuard IP | Architecture | OS, kernel | Runtime | -|------|-------|--------------|--------------|------------|---------| -| `siriussec` | control-plane, gateway, worker | `10.10.0.2` | amd64 | Arch Linux, 6.18.50-2-lts | containerd 2.3.5 | -| `rpi` | traffic, worker | `10.10.0.1` | arm64 | Debian 13, 6.18.39+rpt-rpi-2712 | containerd 2.3.4 | -| `linode` | none | `10.10.0.5` | amd64 | Debian 13, 6.12.113+deb13-amd64 | containerd 2.3.5 | +Pin traffic / light workloads to the Pi: -`siriussec` is the only node carrying the `gateway` role: Cilium's host-network -Envoy must run on the same node as the backends, so every public workload is -pinned there along with the default `local-path` volume. `rpi` is the WireGuard -hub and runs the cloudflared tunnel host service; it is arm64 and carries -network-adjacent pods, marked with a `dedicated=network:PreferNoSchedule` -preference so the application nodes are used first. - -`linode` is a cloud worker and is the least permanent node of the three — -confirm the current node list with `kubectl get nodes` rather than relying on -this table. - -## Stack - -| Layer | Component | Version | -|-------|-----------|---------| -| Cluster | Kubernetes (kubeadm) | v1.36.4 | -| CNI and data path | Cilium | chart 1.20.1 | -| GitOps | Flux CD | six Kustomizations, watching `master` | -| Ingress | Cloudflare Tunnel into Cilium Gateway API | — | -| Monitoring | kube-prometheus-stack | chart 92.14.0 | -| Databases | CloudNativePG | operator 1.30.0, `postgresql:16` | -| Container runtime | containerd | 2.3.5 (2.3.4 on `rpi`) | - -Storage is the Rancher `local-path` provisioner, the default StorageClass, backed -by `/opt/local-path-provisioner` on `siriussec`. Host-path volumes that must stay -on the Pi use a second, static `local-static` StorageClass with `Retain`. - -## Services - -Public hostnames, all terminating on the Gateway above: - -| Hostname | Route | What it serves | -|----------|-------|----------------| -| `forgejo.siriusdevops.com` | `forgejo/forgejo` | Forgejo git server and container registry | -| `siriusdevops.com`, `www.siriusdevops.com` | `siriusdevops/siriusdevops` | Static site and contact API | -| `siriusgrowthsolutions.com`, `www.siriusgrowthsolutions.com` | `sirius-growth/sirius-growth` | Static site, contact API, client portal | -| `piedmonthomesvc.com`, `www.piedmonthomesvc.com` | `piedmont/piedmont` | Static site and contact API | - -The git server and the client portal each run a single-instance CloudNativePG -cluster (`forgejo/pg`, `sirius-growth/portal`). CI runs on the cluster itself: -three Forgejo Actions runners execute jobs inside their own Docker-in-Docker -sidecars, covering both arm64 and amd64. - -Two services are deliberately not public. They answer on the bare WireGuard -address, with no hostname and no `Host` header, and are reachable only from -inside the tunnel: - -| Service | Route | Address | Response | -|---------|-------|---------|----------| -| Grafana | `monitoring/grafana` → `internal` | `http://10.10.0.2:8081/` | 302 to `/login` | -| Hubble UI | `kube-system/hubble-ui` → `hubble-ui` | `http://10.10.0.2:8084/` | 200 | - -Each needs its own Gateway object: Cilium renders one route table per Gateway, -so two hostname-less routes sharing a Gateway would answer for either backend. -The host firewall, not the Gateway, is the access boundary. - -## Repository layout - -Flux watches `master` and runs six Kustomizations from these paths: - -| Path | Kustomization | Contents | -|------|---------------|----------| -| `clusters/homek8s` | `flux-system` | Bootstrap and the top-level Kustomization list | -| `infrastructure/home` | `infrastructure` | Storage, Cilium, internal gateways, node tuning | -| `infrastructure/networking/gateway-api` | `gateway-api-crds` | Gateway API CRDs | -| `infrastructure/databases/base` | `databases` | CloudNativePG operator, vendored and patched | -| `apps/home` | `apps` | The workloads this cluster runs | -| `monitoring/controllers/home` | `monitoring` | Prometheus, Grafana, dashboards, alert rules | - -A new app is a directory under `apps/base//` holding its namespace, workload, -Service and HTTPRoute, plus one line in `apps/home/kustomization.yaml`. Push to -`master` and Flux applies it. - -## Reference - -[`docs/cluster-overview.md`](docs/cluster-overview.md) is the longer operator -write-up. It is a snapshot and will drift; where it disagrees with `kubectl`, -`kubectl` wins. - -## Audit - -Read live on 2026-10-29 01:21 America/New_York, at commit -`aa0f67fe33394bd565b1f07813ed4355fa926934` on `master`. - -Commands behind the tables above: - -``` -kubectl get nodes -o wide -kubectl version -o json -kubectl -n flux-system get kustomizations -kubectl get hr -A -kubectl get httproute -A -kubectl get cluster -A -kubectl get deploy -A -kubectl get storageclass -curl -H 'Host: ' http://10.10.0.2:8080/ # 200 for all seven -curl http://10.10.0.2:8081/ # 302 → /login -curl http://10.10.0.2:8084/ # 200 +```yaml +nodeSelector: + dedicated: network ``` -If this file disagrees with `kubectl`, `kubectl` wins. +## Layout + +``` +homek8s/ +├── apps/ +│ ├── base/ # app definitions +│ └── home/ # overlay applied to this cluster +├── clusters/ +│ └── home/ # Flux Kustomizations (bootstrap later) +│ ├── flux-system/ # flux bootstrap (after Forgejo) +│ ├── apps.yaml +│ ├── infrastructure.yaml +│ └── monitoring.yaml +├── infrastructure/ +│ ├── home/ # kubectl apply -k target (no HelmRelease) +│ ├── networking/ +│ │ ├── cilium/ # HelmRelease for Flux +│ │ └── gateway/ # Cilium Gateway API +│ ├── storage/ # local-path provisioner +│ ├── controllers/ +│ └── databases/ +└── monitoring/ +``` + +## Apply (now) + +```bash +kubectl apply -k infrastructure/home +``` + +That installs storage + the public Gateway. Cilium is already running; its HelmRelease is only for Flux. + +## Flux (later) + +When Forgejo is up: + +```bash +flux bootstrap git \ + --url=ssh://git@forgejo.siriusdevops.com:222/sirius/homek8s.git \ + --branch=master \ + --path=clusters/home +``` + +`clusters/home/*.yaml` already point at `./apps/home`, `./infrastructure/home`, and `./monitoring/controllers/home`. diff --git a/apps/base/customer1/README.md b/apps/base/customer1/README.md deleted file mode 100644 index 9d13b97..0000000 --- a/apps/base/customer1/README.md +++ /dev/null @@ -1,423 +0,0 @@ -# customer1 — lab replica of the Customer 1 client stack - -A **development/audit sandbox** shaped like Customer 1 Inc.'s production stack — -not a copy of their traffic, and not their architecture. Odoo 18 + a plain -PostgreSQL + Metabase, WireGuard-only, in namespace `customer1`. - -| Service | URL over WireGuard | Bare IP? | Notes | -|---|---|---|---| -| Odoo 18 | `http://10.10.0.2:8086/` | yes, any `Host` | `http://10.10.0.2:8086/web/login` | -| Metabase | `http://10.10.0.2:8087/` | yes, any `Host` | secondary instance, 1 GiB heap | -| PostgreSQL | `pg.customer1.svc.cluster.local:5432` | in-cluster only | no NodePort, no gateway | - -`10.10.0.2` is siriussec, the only node labelled `gateway=true` (the only node -running `cilium-envoy`). Nothing here has a public hostname, a tunnel entry or a -DNS record — same posture as the `:8085` evaluation Metabase. - -## What is deliberately *not* like the homelab - -The client runs **Odoo 18 + PostgreSQL on two on-prem Proxmox VMs**, plus -Metabase and a Shopify integration containerised alongside. No Kubernetes. -This namespace is our sandbox for developing and auditing against *their* shape: - -- **Postgres is a plain container (`postgres:16`) on one `local-path` volume, - not a CloudNativePG Cluster.** No operator, no replicas, no WAL archive — - because the client's database is a bare VM install. Do not "improve" it into - CNPG; that would test an architecture they do not run. -- **Odoo runs `workers=0`** (see below), where production may run several. -- **One Postgres, two databases**: `odoo` (the Odoo database, owner and app role - `odoo`) and `metabase` (Metabase's own application DB, owner `metabase`). - -## Layout - -| Object | File | -|---|---| -| Namespace | `namespace.yaml` | -| `pg` Deployment + Service + `pg-data` PVC (10Gi) | `postgres.yaml` | -| First-boot roles/databases (`/docker-entrypoint-initdb.d`) | `postgres-init.yaml` | -| Odoo Deployment/Service, `odoo-data` (10Gi) + `odoo-extra-addons` (5Gi) PVCs | `odoo.yaml` | -| Idempotent Odoo provisioning script (initContainer) | `odoo-init.yaml` | -| Metabase Deployment + Service | `metabase.yaml` | -| Two hostname-less HTTPRoutes | `httproute.yaml` | - -Gateways live with the other internal listeners: -`infrastructure/networking/internal/gateway-customer1-odoo.yaml` (8086) and -`gateway-customer1-metabase.yaml` (8087). **Each bare-IP service gets its own -Gateway**: Cilium renders one RouteConfiguration per Gateway and merges every -hostname-less route inside it into a weighted route, so two services sharing a -Gateway answer for each other at random. The host firewall -(`infrastructure/networking/internal/host-firewall/`, nft on siriussec + ufw on -rpi) carries 8086/8087 and was installed *before* the Gateways were pushed, so -there was never a window where Envoy's `0.0.0.0` bind was open on the LAN. - -## First boot / how the database comes up - -The `odoo` Deployment's initContainers do all provisioning — there is no -separate Job to race against: - -1. `render-config` renders `/etc/odoo-runtime/odoo.conf` from the ConfigMap - values plus Secret `pg-users`, and fixes PVC ownership (uid 100 / gid 101). - Odoo has no env-var support for `db_password`, hence the rendering step. -2. `init-db` (script in `odoo-init.yaml`): - - waits for Postgres; - - **if the `odoo` database has no tables**, runs - `odoo -d odoo -i base,web --without-demo=all --stop-after-init`; - - `CREATE EXTENSION IF NOT EXISTS unaccent` as the database owner; - - (re)applies the read-only BI grants and credential-table revokes, every - start, so tables added by a later module install are covered too; - - sets the admin login/password from Secret `customer1/odoo-admin` via - `odoo shell`. - -Restarting the pod is safe and visibly idempotent: -`== odoo already initialised: skipping -i base ==`. - -Metabase's own tables are created by Metabase in database `metabase` on first -start; nothing pre-creates them. - -## Custom modules (the client has some) - -Copy the module directory into the `odoo-extra-addons` PVC, then install it -through the ORM: - -```bash -POD=$(kubectl -n customer1 get pod -l app=odoo -o name | head -1) -kubectl -n customer1 cp ./client_module "${POD#pod/}:/mnt/extra-addons/client_module" -c odoo -kubectl -n customer1 exec -i deploy/odoo -c odoo -- \ - odoo shell -c /etc/odoo-runtime/odoo.conf -d odoo --no-http --shell-interface=python <<'EOF' -m = env['ir.module.module'].search([('name', '=', 'client_module')]) -m.button_immediate_install() -env.cr.commit() -print(m.state) -EOF -``` - -Then `kubectl -n customer1 delete pod -l app=odoo` once, so `init-db` re-applies -the `metabase_ro` SELECT grants to the tables the module just created (grants -are re-applied on every pod start; `ALTER DEFAULT PRIVILEGES` covers tables -created after the grant but not before it). - -The PVC is why a module survives a restart: an installed module whose directory -disappears from `addons_path` makes Odoo refuse to load it. - -`/mnt/enterprise-addons` is an **emptyDir**, already on `addons_path` and -unused. Whether the client actually runs Enterprise is still an open question; -drop an EE addons tree there (or turn it into a PVC) only once that is answered. - -## `list_db=False`, and how to flip it - -`list_db = False` mirrors the client's production posture: the database manager -(`/web/database/manager`, database create/duplicate/drop) is not reachable from -a browser. `dbfilter = ^odoo$` pins the served database. - -For development work that needs the database manager (e.g. duplicating the DB -before a risky migration), change the `list_db` line in the `render-config` -script in `odoo.yaml` to `True`, push, let Flux roll the pod — do not -`kubectl exec`-edit the rendered config, it is re-rendered on every start. -Flip it back afterwards: with `list_db=True` and `proxy_mode=True` the manager -is reachable by anyone on the WireGuard mesh. - -## Why `workers=0` (and what production needs) - -`workers=0` runs Odoo as a single process (threaded). It is the honest setting -for a one-user lab replica on a laptop: multi-worker needs its own gevent/bus -port and much more RAM. - -**Production shape**: `workers = (2 × cores) + 1`, capped by available RAM at -roughly **512 MB per worker** (plus the 1.5 GiB hard limit for the main -process), with `max_cron_threads` counted separately. - -Going multi-worker here requires exposing the **gevent/bus port 8072** through -its own Gateway listener *and* its own host-firewall entry — a plain -`workers=N` without 8072 breaks longpolling/bus (the web client silently loses -notifications). 8072 is deliberately not opened while `workers=0`. - -## Filestore (where attachments actually live) - -`data_dir = /var/lib/odoo` on PVC `odoo-data`, so attachment bytes live at -`/var/lib/odoo/filestore/odoo/<2-char>/` inside the Odoo pod -(`ir_attachment.store_fname` = `<2-char>/`). Verified: an `ir.attachment` -created over XML-RPC appears as a 697-byte file at exactly that path. - -**The DB is not the filestore.** `ir_attachment` rows hold metadata; the bytes -are files. A database-only restore comes back looking healthy and every -attachment, image and rendered artefact is gone. - -## Backups — the client's shape, implemented and measured - -`backup.yaml` implements the **standard shape of the client's stated practice** -(a bash script on cron that dumps the database). It is *not* a copy of the -client's script — theirs has not been seen yet (Week 3 read-only audit item) — -and the label matters: everything below is what the *described* method does and -does not give you. - -### Schedule, retention, location - -| Item | Value | -|---|---| -| CronJob | `customer1/pg-backup` | -| Schedule | `17 3 * * *`, `timeZone: America/Los_Angeles` (nightly) | -| Guard rails | `concurrencyPolicy: Forbid`, `startingDeadlineSeconds: 600`, `backoffLimit: 1`, `activeDeadlineSeconds: 1800`, history 3 ok / 3 failed | -| Databases | `odoo` **and** `metabase`, one `pg_dump -Fc` each | -| Filename | `/backups/-.dump`, e.g. `odoo-20261122T074011Z.dump` | -| Retention | **14 days** (`RETENTION_DAYS=14`, `find /backups -name '*.dump' -mtime +14 -delete`) | -| Storage | PVC `backup-data`, 10 Gi, `local-path`, mounted at `/backups` | -| Script | ConfigMap `pg-backup-script` (`backup.sh`), no ServiceAccount/RBAC (default SA, token not mounted) | -| Credentials | `pg-app` Secret via env (`PGUSER`/`PGPASSWORD`) — never in git or in the manifest | - -Per-run log line (the only evidence a run happened; it lands in the Job pod log): - -``` -backup: ok db=odoo file=odoo-20261122T074011Z.dump size=2202025B toc_entries=4876 duration=1s -backup: ok db=metabase file=metabase-20261122T074011Z.dump size=1274779B toc_entries=2923 duration=0s -backup: retention sweep, deleting *.dump older than 14 days -backup: run complete rc=0 total=1s dumps_on_disk=2 -``` - -The script fails the Job (`rc=1`) if any `pg_dump` fails **or** if the archive -comes back with an empty TOC — a broken backup turns red instead of silently -succeeding, which a bare `pg_dump >> log 2>&1` cron does not do. - -**Where the dumps actually are:** `/opt/local-path-provisioner/pvc-8f164f6c-…_customer1_backup-data` -on **siriussec only**. `local-path` is node-local, so the backup dies with the -node. No off-box copy is implemented: the Garage S3 API at -`http://10.10.0.1:3900` is reachable from a pod, but it needs a bucket plus -credentials that are not part of this namespace, so it was not wired in one -pass. That absence is deliberate — it is the same absence in the client's -described setup. - -Trigger a run on demand (what the manual proof below did): - -```bash -kubectl -n customer1 create job --from=cronjob/pg-backup pg-backup-manual-1 -kubectl -n customer1 logs job/pg-backup-manual-1 -``` - -### Restore — it is TWO steps, and the second one is the one people forget - -**1. Database** (dumps live on the `backup-data` PVC; mount it in a throwaway pod -or exec where it is mounted): - -```bash -createdb -h pg -U postgres -pg_restore -h pg -U postgres -d /backups/odoo-.dump -psql -h pg -U postgres -d -tAc 'select count(*) from res_users' -``` - -Restoring into the same cluster works without extra flags because the `odoo` -role and the schema already exist; into a *different* cluster use -`--no-owner --no-privileges` (then re-assign ownership). `-Fc` archives are -also readable with `pg_restore --list` and can be inspected without touching a -database. - -**2. Filestore** — this backup does **not** contain it. Copy the attachment -bytes from the Odoo PVC by hand: - -```bash -# from the Odoo pod (uid 100): tar the filestore directory, not the DB -kubectl -n customer1 exec deploy/odoo -- \ - tar czf - -C /var/lib/odoo filestore | gzip -d | tar xzf - -C -``` - -The directory name is the **database name**: `/var/lib/odoo/filestore/odoo`. -Restoring the dump into `odoo_restore_probe` makes Odoo look in -`/var/lib/odoo/filestore/odoo_restore_probe`, which does not exist — renaming or -copying the filestore tree to match the restored DB name is a required manual -step. - -### Proof from the 2026-11-22 run (numbers, not assertions) - -| Check | Result | -|---|---| -| Job | `pg-backup-manual-1` — `Complete 1/1`, pod `Completed` | -| odoo dump | 2,202,025 B, `pg_restore --list` = **4876** entries | -| metabase dump | 1,274,779 B, `pg_restore --list` = **2923** entries | -| Restore probe | `createdb odoo_restore_probe` → `pg_restore -d` → **rc 0** | -| Row counts | live `res_users`=**5** vs restored=**5**; live `ir_attachment`=**22** vs restored=**22** | -| Cleanup | `odoo_restore_probe` dropped; probe pods deleted | -| Retention sweep | 30-day-old `*.dump` deleted by the exact `find`, fresh file kept | - -### The gap this method carries — demonstrated, not asserted - -After the restore above, the database is complete and healthy. The attachments -are not: - -- Restored DB references **22** `ir_attachment` rows, **21** of them with a - `store_fname` (file bytes). -- The backup volume holds exactly **2** files: the two `.dump` archives. - **0 of the 21 referenced files** exist anywhere under `/backups` (checked - every `store_fname` against the volume). -- `pg_restore --list` contains **0** filestore/blob entries — the dump carries - rows, not bytes. -- The live filestore is **23 files / 732 KiB** under - `/var/lib/odoo/filestore/odoo`; none of it is in the backup. -- End-to-end: the same attachment id fetched from the **live** instance and from - a throwaway Odoo bound to the **restored** database: - - ``` - live /web/content/15 -> 200 25613B (res.partner 2, image_1024) - restored DB /web/content/15 -> 500 265B - live /web/content/22 -> 200 447998B (web assets bundle) - restored DB /web/content/22 -> 500 265B - ``` - - and the restored instance's log names the missing file exactly: - - ``` - FileNotFoundError: [Errno 2] No such file or directory: - '/var/lib/odoo/filestore/odoo_restore_probe/a3/a305c7712711bdddb2561500d8fcab0ead92ebd6' - ``` - -**User-visible consequence:** after a DB-only restore the database looks -perfectly healthy — users, invoices and records are all there — but every -invoice PDF, pricelist, product image and attachment download **404s or 500s**. -The client would discover this at the moment they need the backup, not before. - -### RPO / consistency statement - -- Nightly dump, **no WAL archiving, no PITR**: worst-case **RPO is 24 hours** of - orders, invoices and attachments. Anything written after 03:17 is gone. -- The dump is a single `pg_dump` per database and is **not point-in-time - consistent with the filestore**: files written while the dump runs are either - present on disk and absent from the DB, or referenced by the DB after the - dump snapshot but missing from any earlier filestore tar — even a correct - DB+filestore restore has a skew window. -- There is no automated restore test, no checksum/encryption, and no alert on a - failed cron run beyond the Job's own status. A silent `pg_dump` failure on a - cron is invisible until the day it is needed. - -### What the client's stated method does not cover (Week 3 remediation register) - -| # | Not covered | Impact | -|---|---|---| -| 1 | Filestore / attachment bytes | 22 attachment rows, 0 bytes restorable; all downloads/PDFs/images break after restore | -| 2 | WAL archiving / PITR | up to 24 h data loss; no restore to a point before a bad import/delete | -| 3 | Off-box copy | dumps sit on the same host as the database; host/disk/ransomware loss takes both | -| 4 | Restore testing | untested dumps are hypotheses; no evidence they restore | -| 5 | Point-in-time consistency DB↔filestore | skewed restores even when both are copied | -| 6 | Failure alerting/verification | a failed cron dump is silent; Job status is the only signal here | -| 7 | Encryption at rest / access control on dumps | plain `.dump` files readable by anyone with the volume | -| 8 | Retention policy enforcement beyond 14 d | unbounded growth or, if scripts differ, no policy at all | - -Closing these (barman/PITR, object storage, filestore tar+checksum, scheduled -restore drills) is an **architectural recommendation for the client**, not a -change to this replica — no CNPG/barman is added here on purpose: the replica -exists to reproduce the client's exposure. - -## PDF reports - -The pinned image (`odoo:18.0-20261112`) ships **`wkhtmltopdf 0.12.6.1 (with -patched qt)`** at `/usr/local/bin/wkhtmltopdf`, so no derived image is needed -and PDF rendering is not a gap here. Proven end-to-end over the gateway: -`GET /report/pdf/product.report_pricelist/1` → `200`, `application/pdf`, -16 032 bytes, 13 pages. - -If a future image drops wkhtmltopdf, the fix is a derived image -`FROM odoo:18.0-` installing the *patched-qt* build (the Debian -`wkhtmltopdf` package is not patched and renders headers/footers badly), built -`runs-on: docker-amd64` and pinned by tag in `odoo.yaml`. - -## Metabase (secondary instance) - -- Image `metabase/metabase:v0.65.6.3`, `JAVA_OPTS=-Xmx1024m`, container limit - 2 GiB — this is a *second* Metabase next to the `metabase` namespace - evaluation instance and does not repeat its 1.5 GiB heap on this laptop. -- State lives in the same Postgres, database `metabase`, user `metabase`. -- **`MB_ENCRYPTION_SECRET_KEY` is set** (Secret `customer1/metabase-secret-key`) - so stored data-source passwords are not encrypted with Metabase's default key. - Keep it stable: rotating it makes every stored datasource password - undecryptable. -- Set up entirely through the API (`/api/session/properties` → `POST /api/setup` - → `POST /api/session` → `POST /api/database` → `sync_schema`), one data source: - **`customer1 odoo`** → `pg.customer1.svc.cluster.local:5432/odoo` as - `metabase_ro`. -- Metabase has no per-database "read-only" switch for PostgreSQL sources; the - read-only guarantee here is the **role**, which is stronger (see below). - -### The read-only BI role (practice, not shortcut) - -`metabase_ro` is created by `postgres-init.yaml` and re-secured by -`odoo-init.yaml` on every pod start: - -```sql --- role-level defaults -ALTER ROLE metabase_ro SET default_transaction_read_only = on; -ALTER ROLE metabase_ro SET statement_timeout = '60s'; -ALTER ROLE metabase_ro SET idle_in_transaction_session_timeout = '60s'; --- CONNECTION LIMIT 10 --- database/schema -REVOKE CREATE ON SCHEMA public FROM PUBLIC; -- PG16 keeps PUBLIC=CREATE when -REVOKE ALL ON SCHEMA public FROM metabase_ro; -- the DB was made by a non-superuser -GRANT USAGE ON SCHEMA public TO metabase_ro; -GRANT SELECT ON ALL TABLES IN SCHEMA public TO metabase_ro; -ALTER DEFAULT PRIVILEGES FOR ROLE odoo IN SCHEMA public - GRANT SELECT ON TABLES TO metabase_ro; -``` - -Why the schema revokes matter: `default_transaction_read_only` is a role -*default*, and the role may lift it with `SET default_transaction_read_only = -off`. Without the revoke, `metabase_ro` could create tables in `public` -(observed on 2026-11-22 — this was a real gap, now closed). With it, a create -fails twice over: read-only transaction, and `permission denied for schema -public`. - -Credential-bearing tables are **revoked, not just unqueried**. The set is -computed at every start (a static list plus anything whose columns match -`password|secret|token|api_key|private_key`) and logged: - -``` -metabase_ro: SELECT granted on 224 tables; revoked on -['auth_totp_wizard','change_password_own','fetchmail_server','iap_account', - 'ir_attachment','ir_config_parameter','ir_mail_server','mail_guest', - 'res_config_settings','res_groups','res_users_apikeys','res_users_identitycheck'] -``` - -`ir_config_parameter` is the one that matters most (integration API keys and -tokens). `res_users` stays readable on purpose — it carries only a password -*hash* and Metabase needs it for user counts. - -## Secrets (out of band, in the cluster only) - -Created before the Kustomization applies; never in git, never printed: - -| Secret | Keys | Used by | -|---|---|---| -| `pg-app` | `username`=postgres, `password` | Postgres bootstrap superuser | -| `pg-users` | `odoo_password`, `metabase_password`, `metabase_ro_password` | role passwords (initdb + workloads) | -| `odoo-config` | `admin_passwd` | Odoo database master password | -| `odoo-admin` | `email`, `password` | Odoo web admin login (uid 2) | -| `metabase-admin` | `email`, `password` | Metabase's own login (**email**, no username) | -| `metabase-data-source-creds` | `username`=metabase_ro, `password` | the `customer1 odoo` data source | -| `metabase-secret-key` | `MB_ENCRYPTION_SECRET_KEY` | Metabase at-rest encryption | - -## Shopify — integration surface only, blocked on client credentials - -Shopify is SaaS: **there is nothing to deploy in this cluster**, and this -namespace deliberately contains no stub service and no unauthenticated webhook -listener. What the replica needs before a connector can exist: - -1. **Store domain** (e.g. `.myshopify.com`) and the store's plan — Lance - has not seen the store. -2. **Admin API access token** with scopes for the resources the connector - syncs (products/orders/inventory read-write; webhooks write), created in the - store's custom-app settings. Stored as a Secret, never in git. -3. The **Odoo Shopify connector module** (the client has custom modules; the - QSIT/Shopify connector is a separate module) copied into - `/mnt/extra-addons` — see "Custom modules". -4. **Webhook path through the ingress.** Shopify must POST to a reachable - HTTPS URL. This namespace is WireGuard-only, so a webhook path needs a - public hostname + tunnel entry *and* HMAC verification — a decision that - must be made explicitly for the replica, not inherited from prod. - -Status: **blocked on client credentials** (store domain + Admin API token + -the connector module). Until then the Odoo side stays unconfigured on purpose. - -## Deviations from the card, recorded - -- The card's build section names db `odoo` (owner `odoo`), §4 grants on - database `odoo`, and Metabase's data source is `…:5432/odoo`, while the Odoo - config bullet said `db_name=customer1`. Those cannot both hold; the stack is - aligned on **`odoo`** (`db_name`, `dbfilter=^odoo$`, `ODOO_DB_NAME`, the BI - grants and the Metabase source all say `odoo`). -- `base,web` are installed (not `base` alone) so `/web/login` serves a real web - client. `product` was installed to create the acceptance product; a fresh - build installs `base,web` only. diff --git a/apps/base/customer1/backup.yaml b/apps/base/customer1/backup.yaml deleted file mode 100644 index 4ed7a84..0000000 --- a/apps/base/customer1/backup.yaml +++ /dev/null @@ -1,171 +0,0 @@ -# Nightly logical backup of BOTH databases — the *standard shape* of the client's -# stated practice (bash script on cron that dumps the database). -# -# This is NOT a copy of the client's script: theirs has not been seen yet -# (Week 3 read-only audit item). It implements what Lance described — a nightly -# `pg_dump` per database, timestamped files, an age-based retention sweep and a -# per-run log line — and nothing more. -# -# Deliberately absent, because the client's method has none of it: -# - WAL archiving / PITR -> worst-case RPO is 24 h (see README) -# - filestore (attachment bytes)-> the dump carries rows, not files (see README) -# - off-box copy -> dumps live on siriussec's local-path disk -# (the Garage S3 API at http://10.10.0.1:3900 is reachable from a pod, but it -# needs a bucket + credentials that are not part of this namespace; copy is -# therefore NOT implemented and backups die with the node — on purpose, so -# the replica shows the real exposure.) -# -# No RBAC: the default ServiceAccount, with its token not even mounted. This pod -# talks to Postgres over the ClusterIP Service and writes to its own PVC. ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: backup-data - namespace: customer1 - labels: - app.kubernetes.io/part-of: customer1 -spec: - accessModes: [ReadWriteOnce] - storageClassName: local-path - resources: - requests: - storage: 10Gi ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: pg-backup-script - namespace: customer1 - labels: - app.kubernetes.io/part-of: customer1 -data: - backup.sh: | - #!/bin/sh - # Nightly pg_dump -Fc of each database + age-based retention. - # Exit non-zero if ANY dump fails or comes back with an empty TOC, so a - # broken backup turns the Job red instead of silently succeeding. - set -eu - : "${PGHOST:=pg}" - : "${PGPORT:=5432}" - : "${PGUSER:=postgres}" - : "${BACKUP_DIR:=/backups}" - : "${RETENTION_DAYS:=14}" - DATABASES="${DATABASES:-odoo metabase}" - - ts="$(date -u +%Y%m%dT%H%M%SZ)" - mkdir -p "$BACKUP_DIR" - run_start="$(date +%s)" - rc=0 - - echo "backup: run start ts=$ts databases='$DATABASES' retention=${RETENTION_DAYS}d dir=$BACKUP_DIR" - for db in $DATABASES; do - file="$BACKUP_DIR/$db-$ts.dump" - start="$(date +%s)" - if pg_dump -h "$PGHOST" -p "$PGPORT" -U "$PGUSER" -d "$db" -Fc -f "$file"; then - dur=$(( $(date +%s) - start )) - bytes="$(stat -c %s "$file")" - toc="$(pg_restore --list "$file" | wc -l)" - if [ "$toc" -gt 0 ]; then - echo "backup: ok db=$db file=$db-$ts.dump size=${bytes}B toc_entries=$toc duration=${dur}s" - else - echo "backup: FAIL db=$db file=$db-$ts.dump empty archive TOC" >&2 - rc=1 - fi - else - echo "backup: FAIL db=$db pg_dump did not complete" >&2 - rc=1 - fi - done - - echo "backup: retention sweep, deleting *.dump older than ${RETENTION_DAYS} days" - find "$BACKUP_DIR" -maxdepth 1 -type f -name '*.dump' -mtime +"$RETENTION_DAYS" -print -delete || rc=1 - - echo "backup: run complete rc=$rc total=$(( $(date +%s) - run_start ))s dumps_on_disk=$(ls -1 "$BACKUP_DIR"/*.dump 2>/dev/null | wc -l)" - exit "$rc" ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: pg-backup - namespace: customer1 - labels: - app.kubernetes.io/part-of: customer1 -spec: - # Parked with the stack (see odoo.yaml): no dumps while Postgres is at 0. - suspend: true - # 03:17 America/Los_Angeles — one run per night, off the hour so it does not - # collide with Odoo's own cron threads or Metabase syncs at :00. - schedule: "17 3 * * *" - timeZone: America/Los_Angeles - concurrencyPolicy: Forbid - startingDeadlineSeconds: 600 - successfulJobsHistoryLimit: 3 - failedJobsHistoryLimit: 3 - jobTemplate: - spec: - backoffLimit: 1 - activeDeadlineSeconds: 1800 - template: - metadata: - labels: - app: pg-backup - app.kubernetes.io/part-of: customer1 - spec: - restartPolicy: Never - automountServiceAccountToken: false - nodeSelector: - kubernetes.io/hostname: siriussec - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - # local-path hands out root-owned directories; the pod writes the PVC - # as root. It only runs pg_dump + pg_restore (client tools) and find. - securityContext: - runAsUser: 0 - runAsGroup: 0 - containers: - - name: pg-dump - image: postgres:16 - imagePullPolicy: IfNotPresent - command: ["/bin/sh", "/opt/backup/backup.sh"] - env: - - name: PGHOST - value: pg.customer1.svc.cluster.local - - name: PGPORT - value: "5432" - - name: PGUSER - valueFrom: - secretKeyRef: - name: pg-app - key: username - - name: PGPASSWORD - valueFrom: - secretKeyRef: - name: pg-app - key: password - - name: RETENTION_DAYS - value: "14" - - name: TZ - value: America/Los_Angeles - resources: - requests: - cpu: 50m - memory: 128Mi - limits: - memory: 512Mi - volumeMounts: - - name: backups - mountPath: /backups - - name: script - mountPath: /opt/backup - readOnly: true - volumes: - - name: backups - persistentVolumeClaim: - claimName: backup-data - - name: script - configMap: - name: pg-backup-script - defaultMode: 0555 diff --git a/apps/base/customer1/httproute.yaml b/apps/base/customer1/httproute.yaml deleted file mode 100644 index b870d0e..0000000 --- a/apps/base/customer1/httproute.yaml +++ /dev/null @@ -1,44 +0,0 @@ -# Two separate HTTPRoutes and two separate Gateways, on purpose. -# -# A hostname-less route answers on the bare WireGuard address -# (http://10.10.0.2:8086/ and :8087/) for ANY Host header, because a phone -# cannot edit /etc/hosts. Cilium renders ONE RouteConfiguration per Gateway and -# merges every hostname-less route in it into a single weighted route, so two -# services sharing one Gateway serve each other's traffic at random regardless -# of listener port. Hence gateway-customer1-odoo.yaml (8086) and -# gateway-customer1-metabase.yaml (8087) in infrastructure/networking/internal/. -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: odoo - namespace: customer1 -spec: - parentRefs: - - name: customer1-odoo - namespace: internal - rules: - - matches: - - path: - type: PathPrefix - value: / - backendRefs: - - name: odoo - port: 8069 ---- -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: metabase - namespace: customer1 -spec: - parentRefs: - - name: customer1-metabase - namespace: internal - rules: - - matches: - - path: - type: PathPrefix - value: / - backendRefs: - - name: metabase - port: 3000 diff --git a/apps/base/customer1/kustomization.yaml b/apps/base/customer1/kustomization.yaml deleted file mode 100644 index b25ead7..0000000 --- a/apps/base/customer1/kustomization.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - namespace.yaml - # Secrets are created out of band, before this Kustomization applies: - # customer1/pg-app basic-auth, postgres superuser - # customer1/pg-users odoo/metabase/metabase_ro role passwords - # customer1/odoo-config admin_passwd (database master password) - # customer1/odoo-admin email, password (web admin login) - # customer1/metabase-admin email, password (Metabase's own login) - # customer1/metabase-data-source-creds username=metabase_ro + password - # customer1/metabase-secret-key MB_ENCRYPTION_SECRET_KEY - # None of them appear in git; they are not managed (or pruned) by Flux. - - postgres-init.yaml - - postgres.yaml - - odoo-init.yaml - - odoo.yaml - - metabase.yaml - - backup.yaml - - httproute.yaml diff --git a/apps/base/customer1/metabase.yaml b/apps/base/customer1/metabase.yaml deleted file mode 100644 index 0fac78f..0000000 --- a/apps/base/customer1/metabase.yaml +++ /dev/null @@ -1,108 +0,0 @@ -# Metabase for the lab replica — its own state in the SAME plain Postgres -# (database `metabase`), one data source: `customer1 odoo` as `metabase_ro`. -# -# This is a SECOND instance next to the evaluation one in namespace `metabase`. -# The laptop is on a marginal USB-C supply, so it does not repeat that -# instance's 1.5 GiB heap: 1 GiB heap, 2 GiB container limit. -# -# MB_ENCRYPTION_SECRET_KEY is set here on purpose. Without it Metabase encrypts -# stored data-source passwords with a key derived from its own default, so a -# copy of the app DB is enough to read them. The key lives in Secret -# `customer1/metabase-secret-key` and must stay stable for the life of the app -# DB — rotating it makes every stored datasource password undecryptable. -apiVersion: apps/v1 -kind: Deployment -metadata: - name: metabase - namespace: customer1 -spec: - # Parked 2026-11-22 (power budget) — see apps/base/customer1/odoo.yaml. - replicas: 0 - selector: - matchLabels: - app: metabase - template: - metadata: - labels: - app: metabase - app.kubernetes.io/part-of: customer1 - spec: - nodeSelector: - kubernetes.io/hostname: siriussec - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - containers: - - name: metabase - image: metabase/metabase:v0.65.6.3 - imagePullPolicy: IfNotPresent - ports: - - name: http - containerPort: 3000 - env: - - name: JAVA_OPTS - value: "-Xmx1024m" - - name: MB_DB_TYPE - value: postgres - - name: MB_DB_HOST - value: pg.customer1.svc.cluster.local - - name: MB_DB_PORT - value: "5432" - - name: MB_DB_DBNAME - value: metabase - - name: MB_DB_USER - value: metabase - - name: MB_DB_PASS - valueFrom: - secretKeyRef: - name: pg-users - key: metabase_password - - name: MB_ENCRYPTION_SECRET_KEY - valueFrom: - secretKeyRef: - name: metabase-secret-key - key: MB_ENCRYPTION_SECRET_KEY - - name: MB_JETTY_PORT - value: "3000" - - name: TZ - value: America/Los_Angeles - readinessProbe: - httpGet: - path: /api/health - port: http - initialDelaySeconds: 20 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 6 - livenessProbe: - httpGet: - path: /api/health - port: http - initialDelaySeconds: 120 - periodSeconds: 30 - timeoutSeconds: 10 - failureThreshold: 3 - resources: - requests: - cpu: 250m - memory: 1Gi - limits: - # Capped with the main Metabase: see apps/base/metabase/deployment.yaml - cpu: "1" - memory: 2Gi ---- -apiVersion: v1 -kind: Service -metadata: - name: metabase - namespace: customer1 -spec: - type: ClusterIP - selector: - app: metabase - ports: - - name: http - port: 3000 - targetPort: http - protocol: TCP diff --git a/apps/base/customer1/namespace.yaml b/apps/base/customer1/namespace.yaml deleted file mode 100644 index 0fed73f..0000000 --- a/apps/base/customer1/namespace.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: customer1 - labels: - app.kubernetes.io/part-of: customer1 - sirius.dev/purpose: lab-replica-of-client-stack diff --git a/apps/base/customer1/odoo-init.yaml b/apps/base/customer1/odoo-init.yaml deleted file mode 100644 index cd90251..0000000 --- a/apps/base/customer1/odoo-init.yaml +++ /dev/null @@ -1,172 +0,0 @@ -# Odoo provisioning, run as an initContainer on every pod start — idempotent by -# construction, so a restart never re-initialises a live database. -# -# 1. wait for Postgres -# 2. if the `odoo` database has no tables: `odoo -i base,web -# --without-demo=all --stop-after-init` (the "init once" step, done by the -# pod rather than by a separate Job so there is exactly one thing to wait -# on and no ordering race between a Job and the Deployment) -# 3. CREATE EXTENSION unaccent, as the database owner -# 4. (re)apply the read-only BI grants over every table Odoo just created, -# including revoking the tables that carry credentials -# 5. set the admin login/password from Secret `customer1/odoo-admin` -# -# Step 4 runs unconditionally, not only on first install: it is what picks up -# tables added by a later module install (`-i`/`-u` from /mnt/extra-addons), and -# `ALTER DEFAULT PRIVILEGES` alone does not cover tables created before the -# grant. Nothing here writes a credential to stdout. -apiVersion: v1 -kind: ConfigMap -metadata: - name: odoo-init - namespace: customer1 -data: - init_db.py: | - #!/usr/bin/env python3 - """Idempotent first-run provisioning of the Customer 1 lab Odoo database.""" - import os - import subprocess - import sys - import time - - import psycopg2 - - HOST = os.environ["DB_HOST"] - PORT = int(os.environ.get("DB_PORT", "5432")) - SUPER_USER = os.environ["PG_SUPERUSER"] - SUPER_PW = os.environ["PG_SUPERPASS"] - DB = os.environ.get("ODOO_DB_NAME", "odoo") - CONF = "/etc/odoo-runtime/odoo.conf" - ADMIN_LOGIN = os.environ["ODOO_ADMIN_LOGIN"] - ADMIN_PASSWORD = os.environ["ODOO_ADMIN_PASSWORD"] - - # Tables that hold credentials looking like data. `ir_config_parameter` is - # the one the card calls out (API keys/tokens for integrations); the rest - # are the same class of column. `res_users` is deliberately NOT in this - # list: it carries a password *hash* only, and Metabase needs it for user - # counts. Everything found by inspection at runtime is added and logged. - CREDENTIAL_TABLES = [ - "ir_config_parameter", - "ir_mail_server", - "fetchmail_server", - "res_users_apikeys", - "payment_provider", - "res_users_identitycheck", - ] - - def connect(dbname, user, password): - conn = psycopg2.connect( - host=HOST, port=PORT, dbname=dbname, user=user, password=password, - connect_timeout=10, - ) - conn.autocommit = True - return conn - - def wait_for_pg(): - for _ in range(90): - try: - connect("postgres", SUPER_USER, SUPER_PW).close() - return - except psycopg2.Error: - time.sleep(2) - sys.exit("postgres unreachable") - - def tables(cur): - cur.execute( - "select table_name from information_schema.tables " - "where table_schema = 'public' and table_type = 'BASE TABLE'" - ) - return {r[0] for r in cur.fetchall()} - - def run(cmd, **kw): - print("+ " + " ".join(cmd), flush=True) - subprocess.run(cmd, check=True, **kw) - - wait_for_pg() - - conn = connect("postgres", SUPER_USER, SUPER_PW) - cur = conn.cursor() - cur.execute("select 1 from pg_database where datname = %s", (DB,)) - exists = cur.fetchone() is not None - conn.close() - - have_tables = False - if exists: - dconn = connect(DB, SUPER_USER, SUPER_PW) - dcur = dconn.cursor() - have_tables = bool(tables(dcur)) - dconn.close() - - if not have_tables: - print(f"== initialising {DB}: base,web (no demo data) ==", flush=True) - run(["odoo", "-c", CONF, "-d", DB, "-i", "base,web", - "--without-demo=all", "--stop-after-init", "--no-http"]) - else: - print(f"== {DB} already initialised: skipping -i base ==", flush=True) - - # unaccent as the database owner (trusted extension in PG16). Odoo uses it - # for accent-insensitive search in the web client. - oconn = connect(DB, "odoo", os.environ["ODOO_DB_PASSWORD"]) - ocur = oconn.cursor() - ocur.execute("CREATE EXTENSION IF NOT EXISTS unaccent") - ocur.execute("select extname, extowner::regrole::text from pg_extension where extname = 'unaccent'") - print("unaccent:", ocur.fetchone(), flush=True) - oconn.close() - - # Read-only BI grants + credential-table revokes. - gconn = connect(DB, SUPER_USER, SUPER_PW) - gcur = gconn.cursor() - # PostgreSQL 16 leaves CREATE on schema public granted to PUBLIC in a - # database created by a NON-SUPERUSER (Odoo creates its own database as - # `odoo`), so `default_transaction_read_only` is the only thing stopping - # metabase_ro from creating tables — and a role may lift its own default - # with `SET default_transaction_read_only = off`. Privileges are the real - # guard: PUBLIC loses CREATE, metabase_ro gets USAGE only. - gcur.execute("REVOKE CREATE ON SCHEMA public FROM PUBLIC") - gcur.execute("REVOKE ALL ON SCHEMA public FROM metabase_ro") - gcur.execute("GRANT USAGE ON SCHEMA public TO metabase_ro") - gcur.execute("GRANT SELECT ON ALL TABLES IN SCHEMA public TO metabase_ro") - gcur.execute( - "ALTER DEFAULT PRIVILEGES FOR ROLE odoo IN SCHEMA public " - "GRANT SELECT ON TABLES TO metabase_ro" - ) - present = tables(gcur) - revoked = sorted({t for t in CREDENTIAL_TABLES if t in present}) - # Inspect rather than assume the static list is complete: anything whose - # columns look like credentials is added to the revoke set (logged below). - gcur.execute( - "select distinct table_name from information_schema.columns " - "where table_schema = 'public' and (" - " column_name ~ '(^|_)(password|secret|token)($|_)' or " - " column_name ~ '(api_key|access_key|private_key)'" - ") and table_name not in ('res_users', 'res_partner')" - ) - for (t,) in gcur.fetchall(): - if t in present and t not in revoked: - revoked.append(t) - revoked = sorted(revoked) - for t in revoked: - gcur.execute("REVOKE SELECT ON public.%s FROM metabase_ro" % t) - gcur.execute( - "select table_name from information_schema.table_privileges " - "where grantee = 'metabase_ro' and privilege_type = 'SELECT' " - "and table_schema = 'public' order by 1" - ) - readable = len(gcur.fetchall()) - gconn.close() - print(f"metabase_ro: SELECT granted on {readable} tables; " - f"revoked on {revoked}", flush=True) - - # Admin login/password from Secret customer1/odoo-admin. `odoo shell` is - # the supported way to set a res.users password without hand-rolling a - # pbkdf2 hash. Re-writing the same value on every start is harmless. - payload = ( - "u = env.ref('base.user_admin')\n" - f"u.write({{'login': {ADMIN_LOGIN!r}, 'password': {ADMIN_PASSWORD!r}}})\n" - "env.cr.commit()\n" - "print('admin uid', u.id, 'login', u.login)\n" - ) - run(["odoo", "shell", "-c", CONF, "-d", DB, "--no-http", - "--shell-interface=python"], input=payload, text=True) - - print("== provisioning complete ==", flush=True) diff --git a/apps/base/customer1/odoo.yaml b/apps/base/customer1/odoo.yaml deleted file mode 100644 index 3ba36d4..0000000 --- a/apps/base/customer1/odoo.yaml +++ /dev/null @@ -1,261 +0,0 @@ -# Odoo 18 — the application half of the Customer 1 lab replica. -# -# Image is pinned to the DATED build, never `18.0`/`latest`: Odoo auto-migrates -# its database schema on start, so a floating tag turns a pod restart into an -# unplanned upgrade of a database you may be auditing. -# -# This image already ships wkhtmltopdf 0.12.6.1 (patched Qt) at -# /usr/local/bin/wkhtmltopdf, so PDF reports/ invoices render without a derived -# image. Verified 2026-11-22 — see README. ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: odoo-data - namespace: customer1 -spec: - accessModes: [ReadWriteOnce] - storageClassName: local-path - resources: - requests: - storage: 10Gi ---- -# Empty by default. This is where the client's custom modules are copied in -# (`kubectl cp ./module customer1/:/mnt/extra-addons/...`), which is -# why it is a PVC and not an emptyDir: a module installed from here must survive -# a pod restart, or the modules table and the addons path disagree and Odoo -# refuses to start the affected modules. -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: odoo-extra-addons - namespace: customer1 -spec: - accessModes: [ReadWriteOnce] - storageClassName: local-path - resources: - requests: - storage: 5Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: odoo - namespace: customer1 -spec: - # Parked 2026-11-22: siriussec's 15 W adapter cannot carry this replica - # stack (Odoo + two JVM/Postgres processes) alongside the public gateway - # workloads. Set back to 1 to bring the client replica up; PVCs are kept. - replicas: 0 - strategy: - type: Recreate - selector: - matchLabels: - app: odoo - template: - metadata: - labels: - app: odoo - app.kubernetes.io/part-of: customer1 - spec: - # Envoy has to reach the backend on the same node it serves from, and the - # filestore PVC is local-path (siriussec-only anyway). - nodeSelector: - kubernetes.io/hostname: siriussec - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - initContainers: - # Odoo has no env-var support for db_password, so the config file is - # rendered from the ConfigMap template + the Secret on every pod start - # into an emptyDir. Runs as root only to fix PVC ownership (the image - # user is uid 100 / gid 101 and local-path hands out root-owned dirs). - - name: render-config - image: odoo:18.0-20261112 - imagePullPolicy: IfNotPresent - securityContext: - runAsUser: 0 - command: - - /bin/sh - - -ec - - | - mkdir -p /mnt/extra-addons /var/lib/odoo /etc/odoo-runtime - chown -R 100:101 /var/lib/odoo /mnt/extra-addons - chmod 0755 /mnt/extra-addons - umask 077 - cat > /etc/odoo-runtime/odoo.conf < rsync -> ssh, no local temp file. -# * Databases are `pg_dump -Fc` streams taken from inside the CNPG primary -# (local socket, `-U postgres`, no password in the manifest and no -# cross-namespace Secret copy) piped straight to the Linode. -# * Credential-free on the DB side is deliberate: nothing in git, nothing to -# rotate. The only secret is the backup SSH key (`cluster-backup-ssh`, -# created out of band, `from=`-restricted on the Linode). -apiVersion: v1 -kind: ServiceAccount -metadata: - name: cluster-backup - namespace: forgejo - labels: - app: cluster-backup ---- -# Dump source in this namespace: find the CNPG primary and run pg_dump in it. -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: cluster-backup - namespace: forgejo - labels: - app: cluster-backup -rules: - - apiGroups: [""] - resources: ["pods"] - verbs: ["get", "list"] - - apiGroups: [""] - resources: ["pods/exec"] - verbs: ["create"] - - apiGroups: ["postgresql.cnpg.io"] - resources: ["clusters"] - verbs: ["get"] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: cluster-backup - namespace: forgejo - labels: - app: cluster-backup -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: cluster-backup -subjects: - - kind: ServiceAccount - name: cluster-backup - namespace: forgejo ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: cluster-backup-scripts - namespace: forgejo - labels: - app: cluster-backup -data: - backup.sh: | - #!/bin/bash - # Nightly state backup: Forgejo data PVC + every CloudNativePG database. - # - # Layout on the Linode: - # /root/cluster-backup/forgejo-data// hardlinked snapshot - # /root/cluster-backup/forgejo-data/latest -> newest snapshot - # /root/cluster-backup/db/--.dump pg_dump -Fc - # /root/cluster-backup/manifests/.txt sizes + sha256 - # - # Everything is streamed: no byte of this backup is staged on siriussec - # (the node runs close to DiskPressure and `local-path` lives on it). - set -euo pipefail - - # alpine/k8s ships kubectl/bash but not rsync/ssh; install them per run - # (~2 s). Nothing else is needed: the DB dumps run inside the CNPG pod. - if ! command -v rsync >/dev/null || ! command -v ssh >/dev/null; then - echo "== installing rsync + openssh-client" - apk add --no-cache rsync openssh-client >/dev/null - fi - - BACKUP_HOST=${BACKUP_HOST:-root@10.10.0.5} - BACKUP_DIR=${BACKUP_DIR:-/root/cluster-backup} - CNPG_TARGETS=${CNPG_TARGETS:-"forgejo/pg sirius-growth/portal"} - # Plain (non-CNPG) Postgres Deployments: /. There is - # no Cluster CR to ask for a primary, and no superuser path from outside, so - # the dump runs inside the pod and reads its own POSTGRES_USER/POSTGRES_DB - # (local socket, trust auth) — no password in git or in this Job. - PG_TARGETS=${PG_TARGETS:-"osint/osint-db"} - DATA_SRC=${DATA_SRC:-/src} - DATA_KEEP=${DATA_KEEP:-7} - DB_KEEP=${DB_KEEP:-14} - MIN_FREE_GB=${MIN_FREE_GB:-8} - STAMP=${STAMP:-$(date -u +%Y%m%dT%H%M%SZ)} - - SSH_OPTS=(-i /keys/id_ed25519 - -o UserKnownHostsFile=/keys/known_hosts - -o StrictHostKeyChecking=yes - -o BatchMode=yes - -o ConnectTimeout=20 - -o ServerAliveInterval=30) - ssh_r() { ssh "${SSH_OPTS[@]}" "$BACKUP_HOST" "$@"; } - - echo "== target: $BACKUP_HOST:$BACKUP_DIR stamp=$STAMP" - ssh_r "mkdir -p '$BACKUP_DIR/forgejo-data' '$BACKUP_DIR/db' '$BACKUP_DIR/manifests'" - avail_gb=$(ssh_r "df -Pk '$BACKUP_DIR' | awk 'NR==2{printf \"%d\", \$4/1048576}'") - avail_gb=${avail_gb:-0} - echo "== remote free space: ${avail_gb} GiB (minimum ${MIN_FREE_GB} GiB)" - if [ "$avail_gb" -lt "$MIN_FREE_GB" ]; then - echo "FAIL: not enough free space on $BACKUP_HOST" - exit 1 - fi - - # First run: --link-dest needs an existing directory to compare against. - ssh_r "cd '$BACKUP_DIR/forgejo-data' && [ -e latest ] || { mkdir -p .empty && ln -sfn .empty latest; }" - - echo "== forgejo-data: /src -> forgejo-data/$STAMP (incremental, link-dest)" - # Forgejo keeps writing while this runs, so a repack/upload can vanish - # mid-copy: rsync reports that as exit 24. That is expected on a live - # instance; anything else (23 = partial transfer, 11/12 = protocol) is a - # real failure. The two transient upload spools are excluded for the same - # reason — they hold half-written packages, never restorable state. - rc=0 - rsync -a --numeric-ids --delete --stats --link-dest=../latest \ - --exclude=/gitea/data/tmp/ \ - --exclude=/gitea/data/repo-archive/tmp/ \ - -e "ssh ${SSH_OPTS[*]}" \ - "$DATA_SRC/" "$BACKUP_HOST:$BACKUP_DIR/forgejo-data/$STAMP/" || rc=$? - case "$rc" in - 0) ;; - 24) echo "== rsync exit 24: files changed during the copy (expected on a live Forgejo)" ;; - *) echo "FAIL: rsync exit $rc"; exit "$rc" ;; - esac - ssh_r "cd '$BACKUP_DIR/forgejo-data' && ln -sfn '$STAMP' latest && du -sh '$STAMP'" - - echo "== databases" - # A previous run killed mid-stream can leave a zero-byte `.part` behind. - ssh_r "find '$BACKUP_DIR/db' -name '*.part' -mmin +60 -delete 2>/dev/null || true" - for target in $CNPG_TARGETS; do - ns=${target%%/*} - cluster=${target##*/} - pod=$(kubectl -n "$ns" get cluster "$cluster" -o jsonpath='{.status.currentPrimary}') - db=$(kubectl -n "$ns" get cluster "$cluster" -o jsonpath='{.spec.bootstrap.initdb.database}') - if [ -z "$pod" ] || [ -z "$db" ]; then - echo "FAIL: $ns/$cluster has no currentPrimary/initdb database" - exit 1 - fi - out="$BACKUP_DIR/db/$ns-$cluster-$STAMP.dump" - echo "-- $ns/$cluster primary=$pod db=$db -> $out" - sha_file=$(mktemp) - kubectl -n "$ns" exec -c postgres "$pod" -- \ - pg_dump -U postgres -d "$db" -Fc -Z6 \ - | tee >(sha256sum | awk '{print $1}' > "$sha_file") \ - | ssh_r "cat > '$out.part'" - local_sha=$(cat "$sha_file"); rm -f "$sha_file" - remote_sha=$(ssh_r "sha256sum '$out.part' | awk '{print \$1}'") - if [ -z "$local_sha" ] || [ "$local_sha" != "$remote_sha" ]; then - echo "FAIL: sha256 mismatch for $out (local=${local_sha:-none} remote=${remote_sha:-none})" - exit 1 - fi - ssh_r "mv '$out.part' '$out'" - echo " sha256=$local_sha" - ssh_r "ls -l '$out'" - done - - echo "== plain Postgres deployments" - for target in $PG_TARGETS; do - ns=${target%%/*} - deploy=${target##*/} - out="$BACKUP_DIR/db/$ns-$deploy-$STAMP.dump" - echo "-- $ns/$deploy -> $out" - sha_file=$(mktemp) - kubectl -n "$ns" exec "deploy/$deploy" -- \ - sh -c 'pg_dump -U "$POSTGRES_USER" -d "$POSTGRES_DB" -Fc -Z6' \ - | tee >(sha256sum | awk '{print $1}' > "$sha_file") \ - | ssh_r "cat > '$out.part'" - local_sha=$(cat "$sha_file"); rm -f "$sha_file" - remote_sha=$(ssh_r "sha256sum '$out.part' | awk '{print \$1}'") - if [ -z "$local_sha" ] || [ "$local_sha" != "$remote_sha" ]; then - echo "FAIL: sha256 mismatch for $out (local=${local_sha:-none} remote=${remote_sha:-none})" - ssh_r "rm -f '$out.part'" - exit 1 - fi - ssh_r "mv '$out.part' '$out'" - echo " sha256=$local_sha" - ssh_r "ls -l '$out'" - done - - echo "== manifest" - ssh_r "cd '$BACKUP_DIR' && { echo \"stamp $STAMP\"; echo \"host \$(hostname -s)\"; \ - echo '--- forgejo-data/latest'; du -shL forgejo-data/latest; \ - echo '--- db'; sha256sum db/*-$STAMP.dump; \ - echo '--- db listing'; ls -l db; } > manifests/$STAMP.txt && cat manifests/$STAMP.txt" - - echo "== retention: last $DATA_KEEP data snapshots, last $DB_KEEP dump files" - ssh_r "cd '$BACKUP_DIR/forgejo-data' && ls -1dt 20* 2>/dev/null | tail -n +$((DATA_KEEP + 1)) | xargs -r rm -rf" - ssh_r "cd '$BACKUP_DIR/db' && ls -1t *.dump 2>/dev/null | tail -n +$((DB_KEEP + 1)) | xargs -r rm -f" - ssh_r "cd '$BACKUP_DIR/manifests' && ls -1t *.txt 2>/dev/null | tail -n +$((DB_KEEP + 1)) | xargs -r rm -f" - ssh_r "df -h '$BACKUP_DIR' | tail -1" - - echo "RESULT=success stamp=$STAMP" ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: cluster-backup - namespace: forgejo - labels: - app: cluster-backup -spec: - # UTC everywhere, same convention as every other CronJob in this repo. - schedule: "37 2 * * *" - timeZone: "Etc/UTC" - concurrencyPolicy: Forbid - # Missed by more than 30 min (cluster down / node rebooting): skip the night - # instead of starting a mirror at a random time. - startingDeadlineSeconds: 1800 - successfulJobsHistoryLimit: 3 - failedJobsHistoryLimit: 3 - jobTemplate: - spec: - # First full mirror of an 18 GiB PVC measured ~15 MB/s over WireGuard - # (~20 min); two hours leaves room for a slow night without being killed - # half-way through a snapshot. - activeDeadlineSeconds: 7200 - backoffLimit: 1 - template: - metadata: - labels: - app: cluster-backup - spec: - restartPolicy: Never - serviceAccountName: cluster-backup - # The forgejo-data PVC is local-path on siriussec; the pod must run - # where the volume is. - nodeSelector: - kubernetes.io/hostname: siriussec - containers: - - name: backup - # alpine/k8s carries kubectl 1.36.4 (== cluster version) so the - # CNPG dumps can be taken through the exec API; rsync + openssh - # are added at start (the pod has normal egress). - image: alpine/k8s:1.36.4 - imagePullPolicy: IfNotPresent - command: ["/bin/bash", "/scripts/backup.sh"] - env: - - name: BACKUP_HOST - value: root@10.10.0.5 - - name: BACKUP_DIR - value: /root/cluster-backup - - name: CNPG_TARGETS - value: "forgejo/pg sirius-growth/portal" - - name: PG_TARGETS - value: "osint/osint-db" - - name: DATA_KEEP - value: "7" - - name: DB_KEEP - value: "14" - volumeMounts: - - name: forgejo-data - mountPath: /src - readOnly: true - - name: keys - mountPath: /keys - readOnly: true - - name: scripts - mountPath: /scripts - readOnly: true - resources: - requests: - cpu: 100m - memory: 128Mi - limits: - # Streaming only — this is a hard cap so a regression can - # never stage the 18 GiB PVC on the T480's root filesystem. - ephemeral-storage: 1Gi - memory: 512Mi - volumes: - - name: forgejo-data - persistentVolumeClaim: - claimName: forgejo-data - readOnly: true - - name: keys - secret: - secretName: cluster-backup-ssh - defaultMode: 0400 - - name: scripts - configMap: - name: cluster-backup-scripts - defaultMode: 0755 diff --git a/apps/base/forgejo/cluster.yaml b/apps/base/forgejo/cluster.yaml index c54411e..17b4478 100644 --- a/apps/base/forgejo/cluster.yaml +++ b/apps/base/forgejo/cluster.yaml @@ -24,19 +24,3 @@ spec: memory: 256Mi limits: memory: 1Gi - # Metrics on :9187 (CNPG's instance manager), scraped by the PodMonitor in - # podmonitor.yaml. `enablePodMonitor` stays false: the operator-generated - # PodMonitor cannot carry the `release: kube-prometheus-stack` label that this - # Prometheus needs, and upstream deprecated the flag in CNPG 1.27. - # - # `customQueriesConfigMap` points at the operator's own default query set plus - # pg-actions-queries.yaml — the Forgejo Actions queue/outcome metrics that only - # this database can answer. - monitoring: - enablePodMonitor: false - disableDefaultQueries: false - customQueriesConfigMap: - - name: cnpg-default-monitoring - key: queries - - name: forgejo-actions-queries - key: queries diff --git a/apps/base/forgejo/custom-public.yaml b/apps/base/forgejo/custom-public.yaml deleted file mode 100644 index ee4232a..0000000 --- a/apps/base/forgejo/custom-public.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# Custom "public" assets served at the site root by Forgejo. -# -# GITEA_CUSTOM in the image is /data/gitea, so Forgejo serves -# /data/gitea/public/* at the root path. Mounting this ConfigMap there makes -# /robots.txt declarative instead of a hand-written file on the PVC -# (docs: forgejo.org/docs/latest/admin/advanced/search-engines-indexation). -# -# Why: self-registration was open until 2026-11-20 and spam profiles -# (/leonabrewton8, /charlinebrando, .../-/packages) were indexed by Google. -# The accounts are gone, but Forgejo's built-in robots.txt only disallows -# /explore/*?* (query strings) and /user/, leaving /explore/repos and -# /search crawlable. This keeps the owner's portfolio repos (/sirius/*) -# indexable and everything else out. -apiVersion: v1 -kind: ConfigMap -metadata: - name: forgejo-custom-public - namespace: forgejo -data: - robots.txt: | - # forgejo.siriusdevops.com - User-agent: * - Disallow: /explore/* - Disallow: /user/* - Disallow: /search* - Disallow: /api/* - Disallow: /*/-/packages - Disallow: /repo/create - Disallow: /repo/migrate - Disallow: /org/create - - Allow: /sirius/* diff --git a/apps/base/forgejo/deployment.yaml b/apps/base/forgejo/deployment.yaml index 1a6c467..680a922 100644 --- a/apps/base/forgejo/deployment.yaml +++ b/apps/base/forgejo/deployment.yaml @@ -55,17 +55,9 @@ spec: value: "true" - name: FORGEJO__packages__ENABLED value: "true" - # Bot signup lockdown: admin-only account creation (web + API). - - name: FORGEJO__service__DISABLE_REGISTRATION - value: "true" volumeMounts: - name: data mountPath: /data - # Custom site-root assets (robots.txt). GITEA_CUSTOM=/data/gitea, - # so Forgejo serves /data/gitea/public/robots.txt at /robots.txt. - - name: custom-public - mountPath: /data/gitea/public - readOnly: true readinessProbe: httpGet: path: / @@ -82,6 +74,3 @@ spec: - name: data persistentVolumeClaim: claimName: forgejo-data - - name: custom-public - configMap: - name: forgejo-custom-public diff --git a/apps/base/forgejo/kustomization.yaml b/apps/base/forgejo/kustomization.yaml index 4c69535..307bfaf 100644 --- a/apps/base/forgejo/kustomization.yaml +++ b/apps/base/forgejo/kustomization.yaml @@ -5,21 +5,8 @@ resources: - httproute.yaml - pvc.yaml - cluster.yaml - - podmonitor.yaml - - pg-actions-queries.yaml - # Site-root custom assets (robots.txt) mounted into the forgejo pod. - - custom-public.yaml - deployment.yaml - service.yaml - runner-configmap.yaml - # Static PVs/PVCs pinned to rpi: dynamic local-path cannot provision there - # (its helper pod is hardcoded to siriussec). Must sort before the runner - # Deployments that consume the claims. - - runner-dind-storage.yaml - runner-arm64.yaml - runner-amd64.yaml - - runner-deploy-arm64.yaml - - prune-cronjob.yaml - # Nightly disaster-recovery backup of forgejo-data + every CNPG database to - # the Linode VPS. Lives here because a PVC cannot be mounted cross-namespace. - - cluster-backup.yaml diff --git a/apps/base/forgejo/pg-actions-queries.yaml b/apps/base/forgejo/pg-actions-queries.yaml deleted file mode 100644 index 0c937a0..0000000 --- a/apps/base/forgejo/pg-actions-queries.yaml +++ /dev/null @@ -1,111 +0,0 @@ -# Custom CNPG monitoring queries for Forgejo's Actions tables. -# -# Why this ConfigMap exists: Forgejo's Actions queue lives in PostgreSQL, not in -# any exporter. `action_run_job` is the only place that knows how many jobs are -# waiting for a runner and how the last N runs ended, so the runner dashboard -# reads it through CNPG's built-in metrics exporter (`:9187`) instead of -# inventing a new exporter. -# -# How it is wired: `Cluster/pg` lists this ConfigMap under -# `spec.monitoring.customQueriesConfigMap` (alongside the operator's own -# `cnpg-default-monitoring`), so every query here runs on the cluster's *main* -# database — `forgejo` for this cluster, per CNPG's initdb.database rule — and is -# exported as `cnpg__` on the instance's metrics port. -# -# Privileges: CNPG runs custom queries as the `cnpg_metrics_exporter` role -# (pg_monitor, NOT superuser). That role cannot read Forgejo's tables until it -# is granted, and the grant is a database-side step that cannot live in this -# file. When the dashboard shows an empty queue metric, run: -# -# GRANT USAGE ON SCHEMA public TO cnpg_metrics_exporter; -# GRANT SELECT ON action_run_job, action_task, -# action_runner TO cnpg_metrics_exporter; -# -# (see docs/monitoring-dashboards.md for the exact kubectl one-liner). -# -# Semantics, verified against this instance rather than guessed (task t_c45b2d73): -# action_run_job.status / action_run.status: 1 = success, 2 = failure, -# 3 = cancelled, 4 = skipped. Cross-checked against -# GET /api/v1/repos/sirius/onionwire/actions/runs, where DB run 1189 -# (status 1) reports conclusion "success" and run 1191 (status 2) "failure". -# A job that has not started yet carries started = 0; a job that has not -# finished carries stopped = 0. Rows for skipped jobs never start, never stop -# and are kept forever, so queue depth deliberately excludes status 4 — -# otherwise the queue would read "3" at all times with nothing queued. ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: forgejo-actions-queries - namespace: forgejo -data: - queries: | - # Queue depth: jobs handed to a runner that have not started, plus the age - # of the oldest of them. Always returns exactly one row, so the panel shows - # a hard 0 instead of "No data" when the queue is empty. - actions_queue: - query: | - SELECT count(*) AS depth - , COALESCE(max(EXTRACT(EPOCH FROM pg_catalog.now())::bigint - NULLIF(j.created, 0)), 0) AS oldest_pending_seconds - FROM action_run_job j - WHERE j.started = 0 - AND j.stopped = 0 - AND j.status <> 4 - metrics: - - depth: - usage: "GAUGE" - description: "Jobs assigned to a runner that have not started yet" - - oldest_pending_seconds: - usage: "GAUGE" - description: "Age in seconds of the oldest not-yet-started job" - # Jobs currently executing (a runner picked them up and has not finished). - actions_running: - query: | - SELECT count(*) AS total - FROM action_run_job j - WHERE j.started > 0 - AND j.stopped = 0 - metrics: - - total: - usage: "GAUGE" - description: "Jobs currently running on a runner" - # Job outcomes inside a rolling window. A rolling count (not a counter): - # Forgejo prunes old rows, so rate() over a row count would lie; asking for - # "stopped within the last hour/day" is always right. - actions_jobs_window: - query: | - SELECT w.label AS window - , s.status AS status - , COALESCE(( - SELECT count(*) - FROM action_run_job j - WHERE j.status = s.status - AND j.stopped > (EXTRACT(EPOCH FROM pg_catalog.now())::bigint - w.secs) - ), 0) AS total - FROM (VALUES ('1h', 3600), ('24h', 86400)) AS w(label, secs) - CROSS JOIN (VALUES (0), (1), (2), (3), (4)) AS s(status) - metrics: - - window: - usage: "LABEL" - description: "Rolling window: 1h or 24h" - - status: - usage: "LABEL" - description: "1 success, 2 failure, 3 cancelled, 4 skipped" - - total: - usage: "GAUGE" - description: "Jobs that finished inside the window with this status" - # How long ago each runner last polled Forgejo. This is the only signal that - # says "the runner process is alive" independently of the pod being Ready — - # a runner that cannot reach the forge stays Running but goes stale here. - actions_runners: - query: | - SELECT r.name AS runner - , COALESCE(EXTRACT(EPOCH FROM pg_catalog.now())::bigint - NULLIF(r.last_online, 0), -1) AS last_online_seconds - FROM action_runner r - metrics: - - runner: - usage: "LABEL" - description: "Runner name as registered with Forgejo" - - last_online_seconds: - usage: "GAUGE" - description: "Seconds since the runner last polled (-1 = never)" diff --git a/apps/base/forgejo/podmonitor.yaml b/apps/base/forgejo/podmonitor.yaml deleted file mode 100644 index d2956a9..0000000 --- a/apps/base/forgejo/podmonitor.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# Prometheus scrape config for the Forgejo Postgres cluster (CNPG). -# -# Hand-written on purpose. CNPG's `spec.monitoring.enablePodMonitor: true` still -# works on operator 1.30 but is deprecated upstream (CloudNativePG 1.27 release -# notes: "we strongly recommend you remove or set enablePodMonitor to false and -# manually create a PodMonitor"), because the operator-owned PodMonitor gives no -# control over labels — and labels are exactly what this stack needs: -# Prometheus here keeps the chart defaults -# (`podMonitorSelectorNilUsesHelmValues: true`), so it only honours PodMonitors -# carrying `release: kube-prometheus-stack`. The Cilium ServiceMonitors in -# kube-system land for the same reason. Owning the PodMonitor in git makes that -# selector contract explicit instead of depending on what the operator decides -# to stamp on the object. -# -# One PodMonitor per cluster, in the cluster's own namespace: the PodMonitor -# namespaceSelector is empty on the Prometheus CRD, so any namespace is honoured. -apiVersion: monitoring.coreos.com/v1 -kind: PodMonitor -metadata: - name: cnpg-pg - namespace: forgejo - labels: - release: kube-prometheus-stack -spec: - selector: - matchLabels: - cnpg.io/cluster: pg - podMetricsEndpoints: - - port: metrics - interval: 30s - # The instance manager serves /metrics on 9187 for the primary; replicas - # serve it too, so a future `instances: 2` needs no change here. diff --git a/apps/base/forgejo/prune-cronjob.yaml b/apps/base/forgejo/prune-cronjob.yaml deleted file mode 100644 index e26fd07..0000000 --- a/apps/base/forgejo/prune-cronjob.yaml +++ /dev/null @@ -1,371 +0,0 @@ ---- -# Disk hygiene for every Docker daemon the Forgejo Actions runners build on. -# -# Two kinds of daemon exist in this lab and the old version of this job only -# ever saw the first one: -# -# 1. the Pi's *host* daemon (arm64 runners bind /var/run/docker.sock), -# reachable from a pod only through a hostPath socket, and -# 2. the in-pod `docker:dind` daemons (amd64 runner today, the arm64 -# migration adds more) which live on their own PVC and are reachable -# only by exec'ing into the pod. -# -# So the Job runs two containers: `host-daemon` mounts the Pi socket, -# `dind-daemons` discovers dind pods by label and prunes each one over the -# Kubernetes exec API with a namespace-scoped ServiceAccount. No pod names are -# hardcoded; a new dind runner is picked up the first night it exists. -# -# The build-cache cap is enforced by *age windows*, not by the capacity flags. -# `--keep-storage` / `--max-storage` / `--max-used-space` are accepted by the -# installed buildx (0.20.1) but do not reclaim anything here (measured -# 2026-10-27: 21.44 GB cache with `--max-used-space 20GB` -> "Total: 0B"; -# 541 MB cache with `--max-used-space 100MB` -> "Total: 0B"). That no-op is -# why the previous job reported `Complete` while 21 GB of builder cache sat -# untouched. `--filter until=` *does* reclaim (541 MB -> 0 with -# `until=1s`), so the script walks the window down from CACHE_AGE_H to 0s and -# stops as soon as the cache is under the cap: newest layers survive, a cold -# cache is the last resort, never the default. -# -# Named volumes are NEVER pruned (docker volume prune is forbidden): they hold -# the shared CI caches (onionwire-target-ci, the Android SDK/Gradle/registry -# volumes). Their sizes are printed every run and their growth is covered by -# the `RunnerDindDisk*` / `NodeFilesystemFillingUp` alerts (per-PVC bytes are -# not exported by kubelet 1.34+, so those alerts are node-filesystem scoped). -apiVersion: v1 -kind: ServiceAccount -metadata: - name: forgejo-prune - namespace: forgejo - labels: - app: forgejo-runner - role: prune ---- -# Least privilege: the job needs to find dind pods (get/list) and to run -# docker inside them (pods/exec create) — in namespace forgejo only. -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: forgejo-prune - namespace: forgejo - labels: - app: forgejo-runner - role: prune -rules: - - apiGroups: [""] - resources: ["pods"] - verbs: ["get", "list"] - - apiGroups: [""] - resources: ["pods/exec"] - verbs: ["create"] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: forgejo-prune - namespace: forgejo - labels: - app: forgejo-runner - role: prune -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: forgejo-prune -subjects: - - kind: ServiceAccount - name: forgejo-prune - namespace: forgejo ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: forgejo-prune-scripts - namespace: forgejo - labels: - app: forgejo-runner - role: prune -data: - host-daemon.sh: | - #!/bin/sh - # Prune the Pi's host Docker daemon (the socket the arm64 runners use). - set -eu - - CAP_BYTES=${CACHE_CAP_BYTES:-20000000000} - CACHE_AGE_H=${CACHE_AGE_H:-72} - IMAGE_AGE_H=${IMAGE_AGE_H:-168} - CONTAINER_AGE_H=${CONTAINER_AGE_H:-48} - BUSY_MINUTES=${BUSY_MINUTES:-180} - - to_bytes() { - awk -v v="$1" 'BEGIN{ - n = v + 0; u = "B"; - if (match(v, /[A-Za-z]+$/)) u = substr(v, RSTART); - m = 1; - if (u == "kB") m = 1e3; else if (u == "MB") m = 1e6; - else if (u == "GB") m = 1e9; else if (u == "TB") m = 1e12; - printf "%.0f\n", n * m }' - } - - cache_bytes() { - docker buildx du 2>/dev/null | awk '/^Total:/{print $2}' | tail -n1 \ - | { read -r v; to_bytes "${v:-0B}"; } - } - - # A build is live if a *running* container was started inside the busy - # window. The Pi's standing containers (sites, garage, registry) are days - # old, so this needs no name whitelist: job containers are minutes old. - busy() { - docker ps --format '{{.Names}}|{{.Status}}' | awk -F'|' -v win="$1" ' - { st = $2; sub(/^Up /, "", st); split(st, a, " "); - if (st ~ /^Less than a second/) age = 0; - else if (st ~ /^About a minute/) age = 60; - else { n = a[1] + 0; u = a[2]; - if (u ~ /^seconds?$/) age = n; - else if (u ~ /^minutes?$/) age = n * 60; - else if (u ~ /^hours?$/) age = n * 3600; - else if (u ~ /^days?$/) age = n * 86400; - else if (u ~ /^weeks?$/) age = n * 604800; - else age = 99999999 } - if (age < win * 60) { print " " $1 " (Up " st ")"; found = 1 } } - END { exit(found ? 0 : 1) }' - } - - echo "== daemon: pi-host (/var/run/docker.sock)" - docker system df - echo "== named volumes (never pruned, listed for growth tracking)" - docker system df -v | sed -n '/Local Volumes/,$p' - echo "== df -h / (before)"; df -h / | tail -n1 - - if busy "$BUSY_MINUTES"; then - echo "BUSY: a build looks live on this daemon (running container younger than ${BUSY_MINUTES}m above)" - echo "SKIP: not pruning pi-host tonight (job exits 0 by design)" - exit 0 - fi - - echo "== container prune (exited > ${CONTAINER_AGE_H}h)" - docker container prune -f --filter until="${CONTAINER_AGE_H}h" 2>&1 | tail -n1 - echo "== image prune (unused, created > ${IMAGE_AGE_H}h)" - docker image prune -af --filter until="${IMAGE_AGE_H}h" 2>&1 | tail -n1 - - echo "== builder prune (cap ${CAP_BYTES}B by age window)" - for w in "${CACHE_AGE_H}h" 48h 24h 12h 6h 3h 1h 0s; do - cur=$(cache_bytes) - echo "[builder] cache=${cur}B cap=${CAP_BYTES}B (next window until=$w)" - if [ "$cur" -le "$CAP_BYTES" ]; then - echo "[builder] within cap — warm cache kept" - break - fi - echo "[builder] over cap -> docker builder prune -af --filter until=$w" - docker builder prune -af --filter until="$w" 2>&1 | tail -n1 - done - echo "[builder] final cache=$(cache_bytes)B" - - echo "== after" - docker system df - echo "== df -h / (after)"; df -h / | tail -n1 - echo "daemon pi-host: OK" - dind-daemons.sh: | - #!/bin/sh - # Prune every in-cluster dind daemon, discovered by label. - # Selector: pods with app=forgejo-runner in namespace forgejo that have a - # container named `dind`. Nothing here is keyed to a pod name, so a new - # dind runner (e.g. the arm64 migration) is pruned the night it appears. - set -u - - NS=${NAMESPACE:-forgejo} - CAP_BYTES=${CACHE_CAP_BYTES:-4000000000} - CACHE_AGE_H=${CACHE_AGE_H:-72} - CONTAINER_AGE_H=${CONTAINER_AGE_H:-48} - - to_bytes() { - awk -v v="$1" 'BEGIN{ - n = v + 0; u = "B"; - if (match(v, /[A-Za-z]+$/)) u = substr(v, RSTART); - m = 1; - if (u == "kB") m = 1e3; else if (u == "MB") m = 1e6; - else if (u == "GB") m = 1e9; else if (u == "TB") m = 1e12; - printf "%.0f\n", n * m }' - } - - dk() { kubectl -n "$NS" exec -c dind "$pod" -- docker "$@"; } - - dk_cache_bytes() { - dk buildx du 2>/dev/null | awk '/^Total:/{print $2}' | tail -n1 \ - | { read -r v; to_bytes "${v:-0B}"; } - } - - found=0 - failed=0 - skipped=0 - for pod in $(kubectl -n "$NS" get pods -l app=forgejo-runner \ - -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}'); do - phase=$(kubectl -n "$NS" get pod "$pod" -o jsonpath='{.status.phase}' 2>/dev/null || echo Unknown) - if [ "$phase" != "Running" ]; then - echo "skip pod/$pod: phase $phase" - continue - fi - ctrs=$(kubectl -n "$NS" get pod "$pod" -o jsonpath='{.spec.containers[*].name}' 2>/dev/null || echo "") - case " $ctrs " in - *" dind "*) ;; - *) echo "skip pod/$pod: no dind container (containers: ${ctrs:-none})"; continue ;; - esac - found=$((found + 1)) - echo "==============================================================" - echo "== daemon: dind in pod/$pod" - if ! dk system df; then - echo "FAILED: docker not answering in pod/$pod" - failed=$((failed + 1)) - continue - fi - echo "== named volumes in pod/$pod (never pruned, listed for growth tracking)" - dk system df -v | sed -n '/Local Volumes/,$p' - - running=$(dk ps -q | wc -l) - if [ "$running" -gt 0 ]; then - echo "BUSY: pod/$pod has $running running container(s) — a job is in flight" - echo "SKIP: not pruning dind in pod/$pod (job exits 0 by design)" - skipped=$((skipped + 1)) - continue - fi - - before=$(dk_cache_bytes) - echo "== container prune in pod/$pod (exited > ${CONTAINER_AGE_H}h)" - dk container prune -f --filter until="${CONTAINER_AGE_H}h" 2>&1 | tail -n1 - # Dangling images only. An `until` filter on pulled images compares the - # image's *creation* date (the upstream build date), so it would delete - # node:20-bullseye / rust:*-bookworm every night and make every job cold. - echo "== dangling image prune in pod/$pod" - dk image prune -f 2>&1 | tail -n1 - - echo "== builder prune in pod/$pod (cap ${CAP_BYTES}B by age window)" - for w in "${CACHE_AGE_H}h" 48h 24h 12h 6h 3h 1h 0s; do - cur=$(dk_cache_bytes) - echo "[builder $pod] cache=${cur}B cap=${CAP_BYTES}B (next window until=$w)" - if [ "$cur" -le "$CAP_BYTES" ]; then - echo "[builder $pod] within cap — warm cache kept" - break - fi - echo "[builder $pod] over cap -> docker builder prune -af --filter until=$w" - dk builder prune -af --filter until="$w" 2>&1 | tail -n1 - done - after=$(dk_cache_bytes) - echo "== after pod/$pod (build cache ${before}B -> ${after}B)" - dk system df - done - - echo "==============================================================" - echo "summary: dind daemons found=$found pruned=$((found - failed - skipped)) skipped=$skipped failed=$failed" - if [ "$found" -eq 0 ]; then - echo "WARNING: no dind pod matched label app=forgejo-runner in ns $NS" - fi - [ "$failed" -eq 0 ] ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: forgejo-runner-prune - namespace: forgejo - labels: - app: forgejo-runner - role: prune -spec: - schedule: "17 4 * * *" - # One timezone convention for every CronJob in this repo: UTC. - timeZone: "Etc/UTC" - concurrencyPolicy: Forbid - # Missed by more than 30 min (Pi down, cluster flapping): skip the night - # rather than start a prune at an unpredictable time. - startingDeadlineSeconds: 1800 - successfulJobsHistoryLimit: 3 - failedJobsHistoryLimit: 3 - jobTemplate: - spec: - # Container/image removal on the Pi runs at minutes-per-dozen under load - # (measured: 48 containers in ~10 min). One hour keeps a slow night from - # being killed half-way through a prune. - activeDeadlineSeconds: 3600 - # A failed prune is worth one retry (transient API/exec hiccup), not a - # loop: a broken prune must show up as a failed Job (and alert) instead - # of retrying all night. - backoffLimit: 1 - template: - metadata: - # Deliberately NOT app=forgejo-runner: dind discovery selects that - # label, and this pod must never be considered a daemon (it only has - # a host-daemon and a dind-daemons container). - labels: - app: forgejo-prune - role: prune - spec: - restartPolicy: Never - serviceAccountName: forgejo-prune - # The Pi socket only exists on rpi; the dind daemons are reached over - # the API, so both containers ride along here. - nodeSelector: - kubernetes.io/hostname: rpi - tolerations: - - key: dedicated - operator: Equal - value: network - effect: PreferNoSchedule - containers: - - name: host-daemon - image: docker:27-cli - imagePullPolicy: IfNotPresent - command: ["/bin/sh", "/scripts/host-daemon.sh"] - env: - - name: CACHE_CAP_BYTES - value: "20000000000" - - name: CACHE_AGE_H - value: "72" - - name: IMAGE_AGE_H - value: "168" - - name: CONTAINER_AGE_H - value: "48" - - name: BUSY_MINUTES - value: "180" - volumeMounts: - - name: docker-sock - mountPath: /var/run/docker.sock - - name: scripts - mountPath: /scripts - readOnly: true - resources: - requests: - cpu: 10m - memory: 32Mi - limits: - memory: 256Mi - - name: dind-daemons - # kubectl 1.36.4 == the cluster version; alpine/k8s ships kubectl, - # bash and awk on arm64, so it can exec into the dind pods. - image: alpine/k8s:1.36.4 - imagePullPolicy: IfNotPresent - command: ["/bin/sh", "/scripts/dind-daemons.sh"] - env: - - name: NAMESPACE - value: forgejo - - name: CACHE_CAP_BYTES - value: "4000000000" - - name: CACHE_AGE_H - value: "72" - - name: CONTAINER_AGE_H - value: "48" - volumeMounts: - - name: scripts - mountPath: /scripts - readOnly: true - resources: - requests: - cpu: 10m - memory: 32Mi - limits: - memory: 256Mi - volumes: - - name: docker-sock - hostPath: - path: /var/run/docker.sock - type: Socket - - name: scripts - configMap: - name: forgejo-prune-scripts - defaultMode: 0755 diff --git a/apps/base/forgejo/runner-amd64.yaml b/apps/base/forgejo/runner-amd64.yaml index 459971e..fbc6b01 100644 --- a/apps/base/forgejo/runner-amd64.yaml +++ b/apps/base/forgejo/runner-amd64.yaml @@ -76,23 +76,7 @@ spec: - sh - -c - | - # A reboot restarts this container inside the same pod, so the - # dind-run emptyDir keeps the previous daemon's pid file. dockerd - # then refuses to start ("process with PID N is still running") - # and the runner crashloops until the pod is deleted by hand. - # Clear the stale runtime state first so a restart is - # self-healing. - rm -f /var/run/docker.pid /var/run/docker.sock - # Forgejo's container registry is reached in-cluster as a plain - # HTTP ClusterIP (forgejo.forgejo.svc.cluster.local:3000). - # Docker only treats 127.0.0.0/8 as insecure by default, so - # without this a workflow that logs in to or pushes to that host - # dies with "server gave HTTP response to HTTPS client". - # The public hostname stays HTTPS via Cloudflare, which 413s - # layer uploads >~100MB, so in-cluster pushes are the reliable - # path for large images. - dockerd --host=unix:///var/run/docker.sock --tls=false --mtu=1420 \ - --insecure-registry=forgejo.forgejo.svc.cluster.local:3000 & + dockerd --host=unix:///var/run/docker.sock --tls=false --mtu=1420 & pid=$! i=0 while [ "$i" -lt 30 ]; do @@ -117,23 +101,10 @@ spec: cpu: 200m memory: 512Mi limits: - # Hard ceiling on CI burst draw: siriussec is a laptop on a 15 W - # USB-C supply, and dind previously had no CPU limit, so one - # Android/x86_64 build could pin all 8 threads (~25 W package) - # and drain the battery faster than the adapter refills it. - cpu: 3 memory: 4Gi - name: runner image: code.forgejo.org/forgejo/runner:5.0.1 imagePullPolicy: IfNotPresent - # The image runs as uid 1000. The dind socket is created 660 - # root:docker and the one-shot chmod 666 in the dind container can - # race a dockerd restart, after which the runner crashloops on - # "permission denied ... /var/run/docker.sock" (its wait loop only - # checks that the socket exists). Running the runner as root removes - # the dependency on that race; it is the uid the dind setup assumes. - securityContext: - runAsUser: 0 command: - sh - -c diff --git a/apps/base/forgejo/runner-arm64.yaml b/apps/base/forgejo/runner-arm64.yaml index bb66a61..0f8b1bd 100644 --- a/apps/base/forgejo/runner-arm64.yaml +++ b/apps/base/forgejo/runner-arm64.yaml @@ -12,7 +12,6 @@ spec: matchLabels: app: forgejo-runner arch: arm64 - # RWO PVC: never two pods on one data-root. strategy: type: Recreate template: @@ -28,112 +27,49 @@ spec: operator: Equal value: network effect: PreferNoSchedule - # No supplementalGroups: there is no host docker socket and no host - # docker gid to match any more. The only daemon this runner talks to is - # the privileged `dind` sidecar below. + securityContext: + supplementalGroups: [984] containers: - # In-pod Docker daemon. Same shape as forgejo-runner-amd64: privileged, - # socket on an emptyDir shared with the runner, data-root on the PVC. - # The container MUST be named `dind`, not `docker`/`dockerd`: the - # nightly prune (prune-cronjob.yaml) discovers daemons by - # `app=forgejo-runner` plus a container literally named `dind`, and - # silently prunes nothing for any other name while still reporting - # success. - - name: dind - image: docker:27-dind - imagePullPolicy: IfNotPresent - command: - - sh - - -c - - | - # A reboot restarts this container inside the same pod, so the - # dind-run emptyDir keeps the previous daemon's pid file. dockerd - # then refuses to start ("process with PID N is still running") - # and the runner crashloops until the pod is deleted by hand. - # Clear the stale runtime state first so a restart is - # self-healing. - rm -f /var/run/docker.pid /var/run/docker.sock - # --insecure-registry: the Pi registry is plain HTTP on the WG - # hub IP. Docker only treats 127.0.0.0/8 as insecure by default, - # so without this `docker push 10.10.0.1:5000/...` from a job - # fails with "server gave HTTP response to HTTPS client". - dockerd --host=unix:///var/run/docker.sock --tls=false --mtu=1420 \ - --insecure-registry=10.10.0.1:5000 & - pid=$! - i=0 - while [ "$i" -lt 30 ]; do - if [ -S /var/run/docker.sock ]; then - chmod 666 /var/run/docker.sock - break - fi - i=$((i+1)) - sleep 1 - done - wait "$pid" - securityContext: - privileged: true - volumeMounts: - - name: dind-run - mountPath: /var/run - - name: data - mountPath: /var/lib/docker - subPath: docker - resources: - # Measured peak RSS of a real ci.yml-shaped Rust job inside dind on - # this Pi: 3.10 GiB (docs/arm64-runner-dind.md §2.6). The previous - # 512Mi limit OOM-killed the daemon on the first build; 4Gi copies - # the amd64 runner, which runs the same load shape. - requests: - cpu: 200m - memory: 512Mi - limits: - memory: 4Gi - name: runner # code.forgejo.org/forgejo/runner is genuinely multi-arch and works on # both the amd64 (siriussec) and arm64 (rpi) runners. Do NOT swap this # for alex3305/forgejo-runner-dind:* on the arm64 runner: that image's # arm64 manifest ships an x86-64 forgejo-runner binary, so the Pi dies - # with "exec format error" and the pi runner (the only runner declaring + # with "exec format error" and the pi-runner (the only runner declaring # the bare `docker` label) goes offline, stalling every `runs-on: docker` # job in onionwire/siriusdevops-contact. image: code.forgejo.org/forgejo/runner:5.0.1 imagePullPolicy: IfNotPresent - # uid 1000 in this image vs a `660 root:docker` dind socket: the dind - # container's one-shot chmod 666 can race a dockerd restart and the - # runner's wait loop only checks that the socket exists, so it would - # crashloop on "permission denied". Running as root is what the amd64 - # runner proved deterministic (2eff85b). - securityContext: - runAsUser: 0 command: - - sh - - -c - - | - set -e - i=0 - while [ "$i" -lt 60 ]; do - if [ -S /var/run/docker.sock ]; then - break - fi - i=$((i+1)) - sleep 2 - done - exec forgejo-runner --config /config/config.toml daemon + - forgejo-runner + - --config + - /config/config.toml + - daemon env: - name: DOCKER_HOST value: unix:///var/run/docker.sock + securityContext: + privileged: true + runAsUser: 0 + runAsGroup: 0 volumeMounts: + - name: docker-sock + mountPath: /var/run/docker.sock + - name: docker-static + mountPath: /usr/bin/docker + readOnly: true + - name: cli-plugins + mountPath: /usr/local/lib/docker/cli-plugins + readOnly: true - name: config-toml mountPath: /config/config.toml subPath: arm64.toml - # runner.ini + actions cache live on the same PVC as the dind - # data-root (subPath docker), so one Retain PV holds the whole - # runner identity. Copied from the Pi host before first start — - # never registered here, the uuid must survive. - - name: data - mountPath: /data - - name: dind-run - mountPath: /var/run + - name: runner-ini + mountPath: /config/runner.ini + - name: cache + mountPath: /opt/siriusdevops/runner/cache + - name: siriusdevops + mountPath: /opt/siriusdevops resources: requests: cpu: 50m @@ -141,11 +77,30 @@ spec: limits: memory: 512Mi volumes: + - name: docker-sock + hostPath: + path: /var/run/docker.sock + type: Socket + - name: docker-static + hostPath: + path: /usr/local/bin/docker-static + type: File + - name: cli-plugins + hostPath: + path: /opt/siriusdevops/runner/cli-plugins + type: DirectoryOrCreate - name: config-toml configMap: name: forgejo-runner-config - - name: data - persistentVolumeClaim: - claimName: forgejo-runner-arm64-dind - - name: dind-run - emptyDir: {} + - name: runner-ini + hostPath: + path: /opt/siriusdevops/runner/config/runner.ini + type: File + - name: cache + hostPath: + path: /opt/siriusdevops/runner/cache + type: DirectoryOrCreate + - name: siriusdevops + hostPath: + path: /opt/siriusdevops + type: Directory diff --git a/apps/base/forgejo/runner-configmap.yaml b/apps/base/forgejo/runner-configmap.yaml index fd489fb..b883a4e 100644 --- a/apps/base/forgejo/runner-configmap.yaml +++ b/apps/base/forgejo/runner-configmap.yaml @@ -8,10 +8,7 @@ data: log: level: info runner: - # runner.ini lives on the runner's data PVC now (was a hostPath file), so - # the registration survives the move to in-cluster dind with the same - # uuid. Nothing in the Deployment registers a runner. - file: /data/runner.ini + file: /config/runner.ini # capacity 1: ci.yml builds every job's Rust target into ONE shared named # volume (onionwire-target-ci, mounted at /target). Two jobs writing that # volume concurrently clobber each other's freshly-linked test binaries, @@ -21,67 +18,18 @@ data: # runs of the same group on this runner (446 + 447 overlapped). capacity: 1 timeout: 1h - cache: /data/cache + cache: /opt/siriusdevops/runner/cache cache: enabled: true - dir: /data/cache + dir: /opt/siriusdevops/runner/cache container: privileged: true - # No docker_host here: setting it makes the runner inject the socket bind - # into the job container itself, which collides with the explicit - # -v /var/run/docker.sock in options ("Duplicate mount point"). The - # options bind is the deliberate choice — nested `docker create/start` in - # ci.yml, fuzz.yml and release.yml depends on it. - # - # The docker CLI/plugins come out of the `dind` sidecar's own filesystem - # (docker:27-dind ships /usr/local/bin/docker, docker-buildx, - # docker-compose), not the Pi host's docker-static. Paths resolve inside - # the dind container, which is what the daemon bind-mounts from. This - # keeps `docker buildx` working without installing a CLI in five - # workflows. - options: -v /usr/local/bin/docker:/usr/bin/docker:ro -v /usr/local/libexec/docker/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock --memory 3g --memory-swap 3g + # No docker_host here: setting it makes the runner inject the host socket + # bind into the job container itself, which collides with the explicit + # -v /var/run/docker.sock in options ("Duplicate mount point"). + options: -v /usr/local/bin/docker-static:/usr/bin/docker:ro -v /opt/siriusdevops/runner/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock valid_volumes: - "**" - # Dedicated runner for site deploys. It declares ONLY the `deploy-arm64` - # label, so `runs-on: docker` CI jobs (onionwire ci, minutes to hours of Rust) - # can never occupy it and starve a deploy. The converse also holds: a deploy - # can never occupy the Pi's `docker` runner, whose capacity 1 exists to - # serialize onionwire jobs sharing the onionwire-target-ci volume. - # - # It runs on the Pi because deploy-site.yml needs Pi-local resources: the Pi - # registry and Garage are now addressed over the WireGuard hub IP - # (10.10.0.1:5000, 10.10.0.1:3900) instead of loopback, because 127.0.0.1 - # inside a pod is the pod. Its own `dind` sidecar builds the arm64 site image; - # no host Docker is involved. - deploy-arm64.toml: | - log: - level: info - runner: - # Copied onto the data PVC from /opt/siriusdevops/runner-deploy/data on - # the Pi host before first start. The require-registration init container - # refuses to start without it (registering would burn the single-use - # token and create a second action_runner row). - file: /data/runner.ini - capacity: 1 - timeout: 30m - cache: /data/cache - cache: - enabled: true - dir: /data/cache - container: - privileged: true - # Same injection as arm64.toml: the job container is node:20-bullseye, - # which has no docker CLI and no buildx, and deploy-site.yml needs both. - # Both come from the dind sidecar's own filesystem. binfmt/QEMU is - # registered kernel-globally on the Pi (the POC pod's - # /proc/sys/fs/binfmt_misc was empty yet an amd64 build ran as x86_64), - # so the `--platform linux/amd64` cross build works inside the pod. - # --memory caps the job container only (sibling `docker run` containers a - # workflow spawns are outside the runner's control). - options: -v /usr/local/bin/docker:/usr/bin/docker:ro -v /usr/local/libexec/docker/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock --memory 3g --memory-swap 3g - valid_volumes: - - "**" - amd64.toml: | log: level: info @@ -99,18 +47,7 @@ data: dir: /data/cache container: privileged: true - # No docker_host: it injects the socket bind into the job container, - # which collides with the explicit -v /var/run/docker.sock in options - # ("Duplicate mount point"). The options bind is the deliberate choice. - # - # The job image is node:20-bullseye, which ships no docker CLI, so the - # socket alone is not enough — `docker login`/`build`/`push` die with - # "docker: command not found". The CLI and cli-plugins come from the - # dind sidecar's own filesystem (docker:27-dind ships /usr/local/bin/ - # docker, docker-buildx, docker-compose), same as arm64.toml. - # No --memory cap: this runner also carries the existing amd64 release - # builds, which were already uncapped. - options: -v /usr/local/bin/docker:/usr/bin/docker:ro -v /usr/local/libexec/docker/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock + docker_host: "unix:///var/run/docker.sock" force_pull: true valid_volumes: - "**" diff --git a/apps/base/forgejo/runner-deploy-arm64.yaml b/apps/base/forgejo/runner-deploy-arm64.yaml deleted file mode 100644 index 3d4bc4f..0000000 --- a/apps/base/forgejo/runner-deploy-arm64.yaml +++ /dev/null @@ -1,168 +0,0 @@ ---- -# Second Forgejo Actions runner instance on the Pi, declaring ONLY the -# `deploy-arm64` label. -# -# Why: the Pi's original runner (forgejo-runner-arm64) serves every -# `runs-on: docker` job in the instance, so a long onionwire `ci` build (Rust, -# 20-40 min) holds the only `docker` slot and any site deploy queued behind it -# waits indefinitely - that is exactly how siriusgrowthsolutions.com sat on a -# stale page while deploy-site runs stayed in `waiting` (runs 1163/1164). -# -# Deploys are not CPU-bound the way CI is, so a separate runner instance is -# cheap; the labels are disjoint in both directions, so neither class can -# starve the other. Keep capacity 1: a deploy must not overlap itself (the Pi -# registry tag :latest and the k8s restartedAt patch are last-writer-wins). -# -# Since the arm64 dind cutover this runner has its own in-pod daemon too, so a -# deploy no longer shares the Pi's host Docker with anything. -apiVersion: apps/v1 -kind: Deployment -metadata: - name: forgejo-runner-deploy-arm64 - namespace: forgejo - labels: - app: forgejo-runner - arch: arm64 - role: deploy -spec: - replicas: 1 - selector: - matchLabels: - app: forgejo-runner - role: deploy - strategy: - type: Recreate - template: - metadata: - labels: - app: forgejo-runner - arch: arm64 - role: deploy - spec: - nodeSelector: - kubernetes.io/hostname: rpi - tolerations: - - key: dedicated - operator: Equal - value: network - effect: PreferNoSchedule - initContainers: - # Registration guard, NOT a registration step. The runner's identity - # (`runner.ini`, action_runner id 14 / uuid a41aad73-…) is copied onto - # the PVC from the Pi host before the first start. The previous version - # of this init container registered a *new* runner whenever the file was - # missing, which burns a single-use token and leaves a second - # action_runner row polling under a new uuid. Refuse instead: a missing - # file is an operator error, not something to paper over. - - name: require-registration - image: code.forgejo.org/forgejo/runner:5.0.1 - imagePullPolicy: IfNotPresent - securityContext: - runAsUser: 0 - command: - - sh - - -c - - | - set -e - if [ ! -s /data/runner.ini ]; then - echo "runner.ini missing on the data PVC — refusing to register a second uuid" >&2 - echo "restore it: ssh rpi sudo install -m600 -o root -g root /opt/siriusdevops/runner-deploy/data/runner.ini /opt/local-path-provisioner/forgejo-runner-deploy-arm64-dind/runner.ini" >&2 - exit 1 - fi - echo "registration present: $(grep -o '\"uuid\": \"[^\"]*\"' /data/runner.ini)" - volumeMounts: - - name: data - mountPath: /data - containers: - - name: dind - image: docker:27-dind - imagePullPolicy: IfNotPresent - command: - - sh - - -c - - | - # --insecure-registry: the Pi registry is plain HTTP on the WG - # hub IP. Docker only treats 127.0.0.0/8 as insecure by default, - # so without this `docker push 10.10.0.1:5000/...` from a job - # fails with "server gave HTTP response to HTTPS client". - dockerd --host=unix:///var/run/docker.sock --tls=false --mtu=1420 \ - --insecure-registry=10.10.0.1:5000 & - pid=$! - i=0 - while [ "$i" -lt 30 ]; do - if [ -S /var/run/docker.sock ]; then - chmod 666 /var/run/docker.sock - break - fi - i=$((i+1)) - sleep 1 - done - wait "$pid" - securityContext: - privileged: true - volumeMounts: - - name: dind-run - mountPath: /var/run - - name: data - mountPath: /var/lib/docker - subPath: docker - resources: - # Deliberately smaller than the shared runner's 4Gi. A deploy is two - # nginx-based site images (112-143 MB each) plus buildx's - # docker-container driver and one `--platform linux/amd64` cross - # build under qemu; nothing like the Rust ci.yml job that peaked at - # 3.10 GiB. The Pi has 7.0 GiB available and capacity 1 per runner - # bounds each runner but nothing bounds both: 4Gi + 2Gi limits leave - # ~1 GiB for kubelet/Cilium/cloudflared/host Docker even if a CI run - # and a deploy overlap, and an OOM here fails one deploy visibly. - # (A 4Gi deploy limit would let two runners claim every byte.) - requests: - cpu: 100m - memory: 256Mi - limits: - memory: 2Gi - - name: runner - image: code.forgejo.org/forgejo/runner:5.0.1 - imagePullPolicy: IfNotPresent - securityContext: - runAsUser: 0 - command: - - sh - - -c - - | - set -e - i=0 - while [ "$i" -lt 60 ]; do - if [ -S /var/run/docker.sock ]; then - break - fi - i=$((i+1)) - sleep 2 - done - exec forgejo-runner --config /config/config.toml daemon - env: - - name: DOCKER_HOST - value: unix:///var/run/docker.sock - volumeMounts: - - name: config-toml - mountPath: /config/config.toml - subPath: deploy-arm64.toml - - name: data - mountPath: /data - - name: dind-run - mountPath: /var/run - resources: - requests: - cpu: 50m - memory: 128Mi - limits: - memory: 512Mi - volumes: - - name: config-toml - configMap: - name: forgejo-runner-config - - name: data - persistentVolumeClaim: - claimName: forgejo-runner-deploy-arm64-dind - - name: dind-run - emptyDir: {} diff --git a/apps/base/forgejo/runner-dind-storage.yaml b/apps/base/forgejo/runner-dind-storage.yaml deleted file mode 100644 index 2d366d5..0000000 --- a/apps/base/forgejo/runner-dind-storage.yaml +++ /dev/null @@ -1,122 +0,0 @@ ---- -# Static storage for the arm64 runners' in-cluster dind daemons. -# -# Why static PVs and not the default `local-path` StorageClass: the -# provisioner's helper pod is hardcoded to siriussec -# (infrastructure/storage/local-path-storage.yaml, helper-pod nodeSelector) and -# for a local filesystem it never sets spec.nodeName, so a `local-path` PVC -# consumed by a pod on rpi stays Pending forever ("NodeAffinity failed"). -# Measured 2026-10-27 in a throwaway namespace; see -# docs/arm64-runner-dind.md §6.1. -# -# `persistentVolumeReclaimPolicy: Retain` is deliberate: the runner's -# registration (`runner.ini`, uuid of the Forgejo action_runner row) lives in -# this directory. Deleting the PVC must never delete the identity — a re- -# registered runner burns a single-use token and leaves an orphaned -# action_runner row behind. -# -# Sizes come from measured steady state (docs/arm64-runner-dind.md §4): -# shared runner 146.5 GiB steady -> 200Gi request (named CI volumes) -# deploy runner ~0.3 GiB steady -> 40Gi request (image + buildx generations) -# 240 GiB of the Pi's 390 GiB free. A static PV does not enforce the request — -# the 70 % node-filesystem alert in monitoring/controllers/home/prune-alerts.yaml -# is the real cap. -apiVersion: storage.k8s.io/v1 -kind: StorageClass -metadata: - name: local-static -# No provisioner: every PV with this class is hand-made, so a typo'd claim -# hangs in Pending instead of silently landing somewhere unexpected. -provisioner: kubernetes.io/no-provisioner -volumeBindingMode: WaitForFirstConsumer -reclaimPolicy: Retain ---- -apiVersion: v1 -kind: PersistentVolume -metadata: - name: forgejo-runner-arm64-dind - labels: - app: forgejo-runner - arch: arm64 -spec: - capacity: - storage: 200Gi - accessModes: - - ReadWriteOnce - persistentVolumeReclaimPolicy: Retain - storageClassName: local-static - volumeMode: Filesystem - hostPath: - # Same filesystem/tree the local-path provisioner uses, so df and the - # existing node-exporter alerting see it as ordinary node disk. - path: /opt/local-path-provisioner/forgejo-runner-arm64-dind - type: DirectoryOrCreate - nodeAffinity: - required: - nodeSelectorTerms: - - matchExpressions: - - key: kubernetes.io/hostname - operator: In - values: - - rpi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: forgejo-runner-arm64-dind - namespace: forgejo - labels: - app: forgejo-runner - arch: arm64 -spec: - accessModes: - - ReadWriteOnce - storageClassName: local-static - volumeName: forgejo-runner-arm64-dind - resources: - requests: - storage: 200Gi ---- -apiVersion: v1 -kind: PersistentVolume -metadata: - name: forgejo-runner-deploy-arm64-dind - labels: - app: forgejo-runner - role: deploy -spec: - capacity: - storage: 40Gi - accessModes: - - ReadWriteOnce - persistentVolumeReclaimPolicy: Retain - storageClassName: local-static - volumeMode: Filesystem - hostPath: - path: /opt/local-path-provisioner/forgejo-runner-deploy-arm64-dind - type: DirectoryOrCreate - nodeAffinity: - required: - nodeSelectorTerms: - - matchExpressions: - - key: kubernetes.io/hostname - operator: In - values: - - rpi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: forgejo-runner-deploy-arm64-dind - namespace: forgejo - labels: - app: forgejo-runner - role: deploy -spec: - accessModes: - - ReadWriteOnce - storageClassName: local-static - volumeName: forgejo-runner-deploy-arm64-dind - resources: - requests: - storage: 40Gi diff --git a/apps/base/metabase/cluster.yaml b/apps/base/metabase/cluster.yaml deleted file mode 100644 index 18d404d..0000000 --- a/apps/base/metabase/cluster.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# Metabase's application database (its own metadata only: users, dashboards, -# questions, saved queries — never the data it queries). -# -# Same shape as every other CNPG cluster in this repo: one instance, local-path -# on siriussec, no superuser access. `bootstrap.initdb.secret` names the -# out-of-band Secret `metabase/pg-app` (kubernetes.io/basic-auth, username -# `metabase` — CNPG requires the secret's username to equal `owner`). The -# operator materialises `pg-app` with the same credentials for the Deployment. -# -# No barman ObjectStore yet: the other clusters get WAL archiving to Garage via -# the CNPG-I Barman Cloud plugin; this evaluation instance is deliberately left -# with no archive until Lance keeps it (follow-up card, not a silent gap). -apiVersion: postgresql.cnpg.io/v1 -kind: Cluster -metadata: - name: pg - namespace: metabase -spec: - instances: 1 - imageName: ghcr.io/cloudnative-pg/postgresql:16 - storage: - size: 5Gi - storageClass: local-path - affinity: - nodeSelector: - kubernetes.io/hostname: siriussec - bootstrap: - initdb: - database: metabase - owner: metabase - secret: - name: pg-app - resources: - requests: - cpu: 100m - memory: 256Mi - limits: - memory: 1Gi diff --git a/apps/base/metabase/deployment.yaml b/apps/base/metabase/deployment.yaml deleted file mode 100644 index 2536dc6..0000000 --- a/apps/base/metabase/deployment.yaml +++ /dev/null @@ -1,87 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: metabase - namespace: metabase -spec: - replicas: 1 - selector: - matchLabels: - app: metabase - template: - metadata: - labels: - app: metabase - spec: - # Siriussec is the only gateway node (upstream Envoy has to reach the - # backend pod on the same node), and the CNPG primary is pinned here too. - nodeSelector: - kubernetes.io/hostname: siriussec - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - containers: - - name: metabase - # Pinned release tag (2026-11-20, multi-arch). Never latest/nightly: - # Metabase auto-migrates its app DB on start, so an unpinned tag turns - # a pod restart into a schema upgrade. - image: metabase/metabase:v0.65.6.3 - imagePullPolicy: IfNotPresent - ports: - - name: http - containerPort: 3000 - env: - # One JVM, 1.5 GiB heap, container limit 2 GiB. The laptop is on a - # marginal USB-C supply; a 2 GiB heap here is what starved it in the - # past (see references/laptop-node-power.md). - - name: JAVA_OPTS - value: "-Xmx1536m" - # All state lives in Postgres (no H2 file, no PVC), so the pod is - # disposable and `strategy: Recreate` is unnecessary. - - name: MB_DB_TYPE - value: postgres - - name: MB_DB_HOST - value: pg-rw.metabase.svc.cluster.local - - name: MB_DB_PORT - value: "5432" - - name: MB_DB_DBNAME - value: metabase - - name: MB_DB_USER - valueFrom: - secretKeyRef: - name: pg-app - key: username - - name: MB_DB_PASS - valueFrom: - secretKeyRef: - name: pg-app - key: password - readinessProbe: - httpGet: - path: /api/health - port: 3000 - # The JVM takes ~30-60 s to migrate/bootstrap its app DB. - initialDelaySeconds: 20 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 6 - livenessProbe: - httpGet: - path: /api/health - port: 3000 - initialDelaySeconds: 120 - periodSeconds: 30 - timeoutSeconds: 10 - failureThreshold: 3 - resources: - requests: - cpu: 250m - memory: 1Gi - limits: - # 2 → 1: two Metabase JVMs on the gateway node could together - # burst to 4 threads on a 15 W adapter. 1 core each keeps the - # node inside its power budget; UI latency is unaffected at this - # query volume. - cpu: "1" - memory: 2Gi diff --git a/apps/base/metabase/httproute.yaml b/apps/base/metabase/httproute.yaml deleted file mode 100644 index 1ad119e..0000000 --- a/apps/base/metabase/httproute.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# Internal only, and deliberately HOSTNAME-LESS: it answers on the bare WireGuard -# address http://10.10.0.2:8085/ for every Host header. Phones cannot edit -# /etc/hosts, so a hostname would make the evaluation unusable on mobile. -# -# parentRefs is the dedicated `metabase` Gateway (infrastructure/networking/ -# internal/gateway-metabase.yaml), NOT the shared `internal` one: Cilium merges -# every hostname-less route of a Gateway into one weighted route, so sharing a -# Gateway with Grafana would serve both services on both ports at random. -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: metabase - namespace: metabase -spec: - parentRefs: - - name: metabase - namespace: internal - rules: - - matches: - - path: - type: PathPrefix - value: / - backendRefs: - - name: metabase - port: 3000 diff --git a/apps/base/metabase/kustomization.yaml b/apps/base/metabase/kustomization.yaml deleted file mode 100644 index aaf2916..0000000 --- a/apps/base/metabase/kustomization.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - namespace.yaml - # Secret metabase/pg-app (kubernetes.io/basic-auth) is created out of band - # before this Cluster applies — CNPG's initdb reads it. - - cluster.yaml - - deployment.yaml - - service.yaml - - httproute.yaml diff --git a/apps/base/metabase/namespace.yaml b/apps/base/metabase/namespace.yaml deleted file mode 100644 index 763c274..0000000 --- a/apps/base/metabase/namespace.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: metabase - labels: - app.kubernetes.io/part-of: metabase diff --git a/apps/base/metabase/service.yaml b/apps/base/metabase/service.yaml deleted file mode 100644 index 89f8d74..0000000 --- a/apps/base/metabase/service.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: metabase - namespace: metabase -spec: - type: ClusterIP - selector: - app: metabase - ports: - - name: http - port: 3000 - targetPort: 3000 - protocol: TCP diff --git a/apps/base/osint/README.md b/apps/base/osint/README.md deleted file mode 100644 index a3f838d..0000000 --- a/apps/base/osint/README.md +++ /dev/null @@ -1,179 +0,0 @@ -# OSINT Dashboard stack (namespace `osint`) - -Ported from the Pi docker-compose stack in `sirius/osint-dashboard` so the -dashboard is served from the cluster at **https://osint.siriusdevops.com** -instead of a host Docker container on the Pi. - -## Workloads - -| Deployment | Image | Purpose | -|---|---|---| -| `osint-db` | `forgejo…/sirius/osint-dashboard-pg:amd64-c48788d4b614-r3` | TimescaleDB 2.32.1 + PostGIS 3 on Postgres 16.16, `local-path-linode` PVC `osint-pgdata-linode` 15 Gi | -| `osint-nats` | `forgejo…/sirius/nats:2.10` | JetStream event bus (`-js -m 8222`) | -| `osint-app` | `forgejo…/sirius/osint-dashboard:amd64-915f6cbe25be` | FastAPI + static HUD; runs `alembic upgrade heads` on start; single-admin auth (`app/auth.py`) — public read-only site, admin-only keys/settings/mutations | -| `osint-ingester` | same app image | RSS/GDELT/USGS/FIRMS/vessel ingest → NATS → Postgres | -| `osint-camera-service` | same app image | public-camera discovery + snapshots (PVC `osint-camera-snapshots` 3 Gi, shared with the app) | -| `osint-titiler` | `forgejo…/sirius/titiler:0.26.0` | SAR COG tile proxy, exposed same-origin at `/titiler` | -| `osint-news-scraper` | `forgejo…/sirius/osint-news-scraper:amd64-58f71f5b4520` | Scrapy news scraper loop | -| `osint-news-summarizer` | `forgejo…/sirius/osint-news-summarizer:amd64-fe2b5df369d0` | "analyst" — Nous Portal briefs every 15 min + 23:00 recap | - -Every workload is pinned to `kubernetes.io/hostname: siriussec` (Gateway/Envoy -co-location + local-path PVs). - -## Images - -**CI builds the cluster images.** Since PR #63 in `sirius/osint-dashboard`, -`.forgejo/workflows/build.yml` runs on the `amd64` runner (`runs-on: amd64`), -tags `amd64-`, and pushes straight into the in-cluster registry -(`forgejo.forgejo.svc.cluster.local:3000`, plain HTTP, whitelisted by -`--insecure-registry` on the runner's dind). Deploying is then just a pin -change here in `apps/base/osint/` — check the run's `## Pin in homek8s` summary -for the exact tags. Builds are **path-filtered**, so one image can be several -commits older than another: the app tag is normally master tip, the summarizer -tag is whichever commit last touched `news/summerizer/`. - -Do not build these by hand and push over a `:amd64-` tag: that replaces -CI's manifest, and Forgejo's registry garbage-collects the displaced digest, so -the CI artifact cannot be pulled back. If you need a tag rebuilt, dispatch CI -instead: `POST /api/v1/repos/sirius/osint-dashboard/actions/workflows/build.yml/dispatches` -with `{"ref":"master","inputs":{"rebuild_all":"true"}}`. - -Manual builds exist only as a historical fallback (pre-#63 images, or a CI -outage) — and then **build from a detached worktree at the merge sha, never -from the main checkout**: Legion's `~/osint-dashboard` sits on a feature -branch, and a `docker build` there once produced a `:amd64-` image that -carried the right tag and none of the commit's code. - -```bash -# fallback only — the normal path is: let CI build, then pin the tag here -git -C ~/osint-dashboard fetch origin -git -C ~/osint-dashboard worktree add --detach /tmp/osint-build origin/master -cd /tmp/osint-build && SHA=$(git rev-parse --short=12 HEAD) && TAG="amd64-$SHA" -docker build -f Dockerfile -t 127.0.0.1:3000/sirius/osint-dashboard:$TAG . -docker build -f news/scraper/Dockerfile -t 127.0.0.1:3000/sirius/osint-news-scraper:$TAG news/scraper -docker build -f news/summerizer/Dockerfile -t 127.0.0.1:3000/sirius/osint-news-summarizer:$TAG news/summerizer -docker build -f pg-image/Dockerfile -t 127.0.0.1:3000/sirius/osint-dashboard-pg:$TAG-r2 . -``` - -`pg-image/Dockerfile` is the cluster copy of `Dockerfile.pg`. **It pins -`postgres:16.16-bookworm`**: the upstream file's bare `postgres:16` now resolves -to Debian trixie, whose `postgresql-16-postgis-3` (3.7.0+pgdg13) fails to load -against PG 16.15 with `undefined symbol: heap_datum_check` — `CREATE EXTENSION -postgis` crashes the server. On bookworm (`+pgdg12`) PostGIS 3.7 loads and -`create_hypertable()` works. Port the one-line base-image pin upstream when the -Pi stack is next rebuilt. - -It also pins the TimescaleDB packages to `2.32.1~debian12-1616` (the `-1616` -suffix = built against PG 16.16) and the base image to the 16.16 minor. PG -16.16 added the `PortalDrop()` "cannot drop portal while it is being set up" -check that TimescaleDB <=2.32.0 trips in its background-worker path, so every -policy job failed with SQLSTATE 24000 while `CALL run_job()` worked -(timescale/timescaledb#11038, fixed in 2.31.2/2.32.1). Never unpin either half: -a pg minor bump without a matching TimescaleDB build reintroduces the failure. -`-r3` is that build. After a pod recreate the extension itself still has to be -moved: `ALTER EXTENSION timescaledb UPDATE TO '2.32.1'`. - -## Secrets (never in git) - -```bash -kubectl -n osint create secret generic osint-db --from-literal=password='' -``` -`osint-db/password` is used for `POSTGRES_PASSWORD` and every workload's -`DB_PASSWORD`. Regenerating it requires the Postgres role password to be changed -too (`ALTER ROLE osint PASSWORD …`), not just the Secret. - -API keys (Nous Portal `NOUS_API_KEY`, FIRMS, AISStream, VesselAPI) are **not** -Kubernetes Secrets: they live in the dashboard's `api_keys` table and are set -from the Keys page in the UI (`GET/PUT /api/keys`). The summarizer reads -`NOUS_API_KEY` from the env first, then from that table. Since the auth change -the Keys page is **admin-only**, so set them while signed in (`/login`). - -### Admin login (`osint-admin`) - -```bash -# password -> pbkdf2 hash (from a checkout of sirius/osint-dashboard) -python app/auth.py hash '' -python -c 'import secrets; print(secrets.token_urlsafe(48))' # session secret - -kubectl -n osint create secret generic osint-admin \ - --from-literal=ADMIN_USER=lance \ - --from-literal=ADMIN_PASSWORD_HASH='pbkdf2_sha256$…' \ - --from-literal=ADMIN_SESSION_SECRET='…' -kubectl -n osint rollout restart deploy/osint-app # env is fixed at container start -``` - -`ADMIN_USER=lance`; the current password lives in -`~/.hermes/secrets/osint_admin_password` (0600, Legion) — never in git. The -three refs in `app-deployment.yaml` are `optional: true` on purpose: a missing -Secret must not block startup, and the app then **fails closed** (admin routes -`403 {"detail":"admin auth not configured"}`) while the public HUD keeps -serving. - -The session cookie is `HttpOnly` + `SameSite=Lax` + `Secure`. `Secure` comes from -`ADMIN_COOKIE_SECURE=1` (ConfigMap), **not** from header inference: the tunnel -origins at plain HTTP and Cilium Envoy rewrites `X-Forwarded-Proto` to `http`, so -`app/auth.py::_is_https()` never sees https (an explicit request header is -discarded too — verified). Leave the flag unset only if you ever serve this over -plain http locally; browsers will not send a `Secure` cookie there. - -## News list hygiene - -`/api/news` orders by `articles.timestamp DESC`, so anything dated in the future -pins the top of the feed indefinitely. Two guards (PR #52): - -- the Scrapy pipeline drops items dated more than **2 h** ahead - (`FUTURE_TOLERANCE` in `newsScraper/pipelines.py`), counting them under the - `future_dated_dropped` stat and logging one INFO line per crawl; -- `GET /api/news` additionally excludes `timestamp > now()` (keeping - `timestamp IS NULL` rows), so rows already in the table can never resurface - early. - -Items with an unparseable date are still kept — the guard only fires on a date -it can actually parse. - -## Analyst model - -`SUMMARY_MODEL=meituan/longcat-2.5:free` (free tier on the Nous Portal, -1M context, verified to honour `response_format: json_object`). It is set in -`configmap.yaml`; changing it in the UI (`PUT /api/settings`) only takes effect -when the env var is empty, because `resolve_model()` prefers the env. - -## Analyst grading (PR #53 + #54) - -The map call scores every article **0-100** against a rubric in the same request -(no extra round-trip): 90+ breaking geopolitical/military/disaster, 70-89 -significant national/international, 40-69 notable regional, 10-39 routine/crime, -0-9 noise (sport, celebrity, market tape, **event-calendar listings**). Only -blocks scoring `>= SUMMARY_MIN_SCORE` (60) reach the reduce prompt, capped at -`SUMMARY_TOP_N` (12). If nothing clears the bar the fallback may only pick blocks -`>= SUMMARY_FALLBACK_MIN_SCORE` (40), and if none clear that the brief is the -honest `No significant developments in this window.` — `SUMMARY_FALLBACK_TOP=0` -disables the fallback entirely. - -`get_recent_news()` uses a closed window `(now - window, now]`: future-dated rows -must never be re-graded every 15 minutes (they are dropped at ingest and hidden -in `/api/news` — see above). - -Every graded article is persisted to `article_scores` (`score`, `category`, -`selected`, `model`, `summary_id`) for threshold tuning, e.g. - -```sql -select width_bucket(score, 0, 100, 10) * 10 as bucket, count(*), avg(selected::int) -from article_scores group by 1 order by 1; -``` - -Before the threshold/cap, `dedupe_blocks()` collapses **syndicated wire copies** -(six Hearst stations carrying one AP story) onto the best-scoring representative, -comparing normalised titles — lowercase, source suffix (` - KCCI`, ` | CNN`) -stripped when the tail is short and digit-free — with word-set Jaccard / -sequence similarity `>= SUMMARY_DEDUPE_SIMILARITY` (0.85). Duplicates are still -graded and persisted, with `selected=false` and `duplicate_of` pointing at the -survivor. `SUMMARY_DEDUPE=0` disables the collapse. - -## Ingress - -Cloudflare tunnel `sirius home` already carries `osint.siriusdevops.com` → -`http://10.10.0.2:8080`. DNS is a proxied CNAME to -`6d0702eb-99cc-4062-b57d-e70e2f1a7895.cfargotunnel.com`. HTTPRoute rule order: -`/titiler` (prefix stripped) → `osint-titiler:8000`, then `/` → `osint-app:8000` -(WebSocket `/ws/live` included). diff --git a/apps/base/osint/app-deployment.yaml b/apps/base/osint/app-deployment.yaml deleted file mode 100644 index 99acbc1..0000000 --- a/apps/base/osint/app-deployment.yaml +++ /dev/null @@ -1,107 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: osint-app - namespace: osint - labels: - app: osint-app -spec: - replicas: 1 - selector: - matchLabels: - app: osint-app - template: - metadata: - labels: - app: osint-app - spec: - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - nodeSelector: - kubernetes.io/hostname: siriussec - initContainers: - # Wait for Postgres before alembic runs (the entrypoint migrates). - - name: wait-for-db - image: forgejo.siriusdevops.com/sirius/osint-dashboard:amd64-54897b49bc57 - imagePullPolicy: IfNotPresent - command: - - python - - -c - - | - import os, socket, sys, time - host, port = os.environ.get("DB_HOST", "osint-db"), int(os.environ.get("DB_PORT", "5432")) - deadline = time.time() + 300 - while time.time() < deadline: - try: - with socket.create_connection((host, port), timeout=3): - print("postgres is reachable"); sys.exit(0) - except OSError: - time.sleep(3) - sys.exit("postgres did not become reachable in 300s") - containers: - - name: app - image: forgejo.siriusdevops.com/sirius/osint-dashboard:amd64-54897b49bc57 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 8000 - name: http - envFrom: - - configMapRef: - name: osint-env - env: - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: osint-db - key: password - # Single-admin auth (app/auth.py). optional: true on purpose — a - # missing Secret must not block startup; the app then fails closed - # (admin routes 403 "admin auth not configured") while the public - # read-only HUD still serves. - - name: ADMIN_USER - valueFrom: - secretKeyRef: - name: osint-admin - key: ADMIN_USER - optional: true - - name: ADMIN_PASSWORD_HASH - valueFrom: - secretKeyRef: - name: osint-admin - key: ADMIN_PASSWORD_HASH - optional: true - - name: ADMIN_SESSION_SECRET - valueFrom: - secretKeyRef: - name: osint-admin - key: ADMIN_SESSION_SECRET - optional: true - readinessProbe: - httpGet: - path: /api/health - port: 8000 - initialDelaySeconds: 10 - periodSeconds: 15 - failureThreshold: 6 - livenessProbe: - httpGet: - path: /api/health - port: 8000 - initialDelaySeconds: 90 - periodSeconds: 30 - failureThreshold: 5 - volumeMounts: - - name: snapshots - mountPath: /data/snapshots - resources: - requests: - cpu: 100m - memory: 256Mi - limits: - memory: 1Gi - volumes: - - name: snapshots - persistentVolumeClaim: - claimName: osint-camera-snapshots diff --git a/apps/base/osint/app-service.yaml b/apps/base/osint/app-service.yaml deleted file mode 100644 index a0f9f4d..0000000 --- a/apps/base/osint/app-service.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: osint-app - namespace: osint -spec: - selector: - app: osint-app - ports: - - name: http - port: 8000 - targetPort: 8000 diff --git a/apps/base/osint/backup-exec-rbac.yaml b/apps/base/osint/backup-exec-rbac.yaml deleted file mode 100644 index e2a691d..0000000 --- a/apps/base/osint/backup-exec-rbac.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -# Lets the nightly `forgejo/cluster-backup` CronJob take a `pg_dump` of the -# plain (non-CNPG) Postgres Deployment `osint/osint-db` through the exec API. -# -# `osint-db` is a stock `postgres` Deployment, so there is no Cluster object and -# no `status.currentPrimary` to look up; the dump is taken inside the pod over -# the local socket and uses the pod's own `POSTGRES_USER`/`POSTGRES_DB`, so no -# password is copied into `forgejo`, git or the Job. -# -# Least privilege: the ServiceAccount may run one command inside this -# namespace's pods — nothing else. -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: cluster-backup - namespace: osint - labels: - app: cluster-backup -rules: - - apiGroups: [""] - resources: ["pods"] - verbs: ["get", "list"] - - apiGroups: [""] - resources: ["pods/exec"] - verbs: ["create"] - # `kubectl exec deploy/osint-db` resolves the Deployment's ReplicaSet/pod, so - # it needs read access to the deployment itself. - - apiGroups: ["apps"] - resources: ["deployments"] - verbs: ["get"] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: cluster-backup - namespace: osint - labels: - app: cluster-backup -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: cluster-backup -subjects: - - kind: ServiceAccount - name: cluster-backup - namespace: forgejo diff --git a/apps/base/osint/camera-deployment.yaml b/apps/base/osint/camera-deployment.yaml deleted file mode 100644 index 4b3d0f8..0000000 --- a/apps/base/osint/camera-deployment.yaml +++ /dev/null @@ -1,51 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: osint-camera-service - namespace: osint - labels: - app: osint-camera-service -spec: - replicas: 1 - selector: - matchLabels: - app: osint-camera-service - template: - metadata: - labels: - app: osint-camera-service - spec: - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - nodeSelector: - kubernetes.io/hostname: siriussec - containers: - - name: camera-service - image: forgejo.siriusdevops.com/sirius/osint-dashboard:amd64-915f6cbe25be - imagePullPolicy: IfNotPresent - command: ["python", "app/run_camera_service.py"] - envFrom: - - configMapRef: - name: osint-env - env: - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: osint-db - key: password - volumeMounts: - - name: snapshots - mountPath: /data/snapshots - resources: - requests: - cpu: 50m - memory: 128Mi - limits: - memory: 512Mi - volumes: - # Shared with osint-app (same node, RWO): the app serves cached snapshots. - - name: snapshots - persistentVolumeClaim: - claimName: osint-camera-snapshots diff --git a/apps/base/osint/camera-pvc.yaml b/apps/base/osint/camera-pvc.yaml deleted file mode 100644 index 55c2e14..0000000 --- a/apps/base/osint/camera-pvc.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: osint-camera-snapshots - namespace: osint -spec: - accessModes: - - ReadWriteOnce - storageClassName: local-path - resources: - requests: - storage: 3Gi diff --git a/apps/base/osint/configmap.yaml b/apps/base/osint/configmap.yaml deleted file mode 100644 index fa58991..0000000 --- a/apps/base/osint/configmap.yaml +++ /dev/null @@ -1,96 +0,0 @@ -# Shared, non-secret runtime configuration for every OSINT workload. -# Secrets (Postgres password, Nous API key, FIRMS/AIS keys) are NOT here: -# * Postgres password -> Secret `osint-db` (created out of band, never in git) -# * API keys -> dashboard Keys page, stored in the `api_keys` table -apiVersion: v1 -kind: ConfigMap -metadata: - name: osint-env - namespace: osint -data: - DB_HOST: osint-db - DB_PORT: "5432" - DB_NAME: osint_data - DB_USER: osint - NATS_URL: nats://osint-nats:4222 - - # SAR tile proxy, exposed same-origin under /titiler by the HTTPRoute. - TITILER_INTERNAL_URL: http://osint-titiler:8000 - TITILER_PUBLIC_BASE: /titiler - - TZ: America/New_York - OSINT_USER_AGENT: "osint-dashboard/1.0 (self-hosted; lancewalters94@gmail.com)" - - # ── ingester ──────────────────────────────────────────────────────────── - INGEST_INTERVAL: "300" - INGEST_EARTHQUAKES: "1" - INGEST_FIRES: "1" - FIRMS_DATASETS: "VIIRS_NOAA20_NRT,VIIRS_NOAA21_NRT" - FIRMS_BBOX: "-180,-60,180,75" - FIRMS_INTERVAL: "900" - VESSELAPI_BBOX: "25.5,55.4,27.3,57.2" - VESSELAPI_INTERVAL: "17280" - VESSELAPI_MAX_CALLS_PER_DAY: "5" - AISSTREAM_IN_APP: "1" - AISSTREAM_IN_INGEST: "0" - VESSELAPI_IN_APP: "0" - VESSELAPI_IN_INGEST: "1" - - # ── ADS-B refresh (osint-app `_adsb_refresh_loop`) ────────────────────── - # The loop polls ADSB.lol for each connected browser viewport. With no tab - # open it used to persist nothing, and aircraft_positions stalled for a day - # (max(ts) frozen 2026-11-20 04:58 -> 2026-11-21) while USGS/news kept - # ingesting. While idle it now sweeps the chokepoint presets instead. - ADSB_REFRESH_INTERVAL: "8" - ADSB_WATCH_ENABLED: "1" - ADSB_WATCH_INTERVAL: "30" - - # ── camera discovery service ──────────────────────────────────────────── - CAMERA_SOURCE_URLS: "" - CAMERA_SCRAPE_INTERVAL: "3600" - CAMERA_REQUEST_DELAY: "2.0" - CAMERA_MAX_PER_SOURCE: "20000" - NOMINATIM_URL: https://nominatim.openstreetmap.org - NOMINATIM_MIN_INTERVAL: "1.1" - SNAPSHOT_CACHE_DIR: /data/snapshots - SNAPSHOT_TTL_SECONDS: "300" - - # ── news scraper ──────────────────────────────────────────────────────── - LOG_LEVEL: INFO - NEWS_SCRAPE_INTERVAL_S: "10" - NEWS_SCRAPE_RUN_ON_START: "1" - - # ── auth (see README, Secret `osint-admin`) ────────────────────────────── - # The Cloudflare tunnel origins at the Cilium Gateway on plain HTTP and Envoy - # normalizes X-Forwarded-Proto to http, so app/auth.py's header inference can - # never see https here: this flag is what puts `Secure` on the session cookie. - ADMIN_COOKIE_SECURE: "1" - - # ── news summarizer (analyst) — Nous Portal, free tier model ──────────── - NOUS_BASE_URL: https://inference-api.nousresearch.com/v1 - SUMMARY_MODEL: meituan/longcat-2.5:free - # 4, not the upstream default 50: the map phase runs with a hard 60 s httpx - # timeout (news/summerizer/nous_client.py, json_mode=False), and this free - # model needs ~30 s for 8 articles, so bigger batches time out and silently - # contribute nothing to the reduce phase. - BATCH_SIZE: "4" - # Map-phase grading (PR #53): the map call scores every article 0-100 against - # a rubric and only blocks >= SUMMARY_MIN_SCORE reach the brief. When nothing - # clears the bar the top SUMMARY_FALLBACK_TOP are used so the HUD is not blank - # (set 0 for a genuinely empty "no significant developments" brief). - SUMMARY_MIN_SCORE: "60" - SUMMARY_TOP_N: "12" - SUMMARY_FALLBACK_TOP: "3" - # Lowest score the fallback may pick when nothing clears SUMMARY_MIN_SCORE; - # below this the brief is the honest "no significant developments" one. - SUMMARY_FALLBACK_MIN_SCORE: "40" - # Syndication dedupe (PR #55): identical wire copy from sister stations is - # collapsed to one representative before the threshold/cap, so top_n buys - # distinct stories. SUMMARY_DEDUPE=0 disables it. - SUMMARY_DEDUPE: "1" - SUMMARY_DEDUPE_SIMILARITY: "0.85" - NEWS_SUMMARIZE_INTERVAL_S: "900" - NEWS_SUMMARIZE_RUN_ON_START: "1" - NEWS_RECAP_HOUR: "23" - NEWS_RECAP_MINUTE: "0" - INCLUDE_FUTURES: "0" diff --git a/apps/base/osint/httproute.yaml b/apps/base/osint/httproute.yaml deleted file mode 100644 index dc1534b..0000000 --- a/apps/base/osint/httproute.yaml +++ /dev/null @@ -1,34 +0,0 @@ -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: osint - namespace: osint -spec: - parentRefs: - - name: public - namespace: gateway-system - hostnames: - - osint.siriusdevops.com - rules: - # Same-origin SAR tile proxy: /titiler/... -> titiler /... (prefix stripped, - # matching the old nginx vhost's `proxy_pass ...:8001/`). - - matches: - - path: - type: PathPrefix - value: /titiler - filters: - - type: URLRewrite - urlRewrite: - path: - type: ReplacePrefixMatch - replacePrefixMatch: / - backendRefs: - - name: osint-titiler - port: 8000 - - matches: - - path: - type: PathPrefix - value: / - backendRefs: - - name: osint-app - port: 8000 diff --git a/apps/base/osint/ingester-deployment.yaml b/apps/base/osint/ingester-deployment.yaml deleted file mode 100644 index d0e8682..0000000 --- a/apps/base/osint/ingester-deployment.yaml +++ /dev/null @@ -1,57 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: osint-ingester - namespace: osint - labels: - app: osint-ingester -spec: - replicas: 1 - selector: - matchLabels: - app: osint-ingester - template: - metadata: - labels: - app: osint-ingester - spec: - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - affinity: - nodeAffinity: - # Prefer the amd64 worker (linode) for these stateless CPU loops so - # they stop drawing on the 15 W-powered ThinkPad. Preferred, not - # required: if linode is absent they still schedule on siriussec. - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - preference: - matchExpressions: - - key: kubernetes.io/hostname - operator: In - values: - - linode - # keeps these off the arm64 rpi (some of these images are amd64-only) - nodeSelector: - kubernetes.io/arch: amd64 - containers: - - name: ingester - image: forgejo.siriusdevops.com/sirius/osint-dashboard:amd64-76035535bcb2 - imagePullPolicy: IfNotPresent - command: ["python", "app/run_ingester.py"] - envFrom: - - configMapRef: - name: osint-env - env: - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: osint-db - key: password - resources: - requests: - cpu: 100m - memory: 256Mi - limits: - memory: 512Mi diff --git a/apps/base/osint/kustomization.yaml b/apps/base/osint/kustomization.yaml deleted file mode 100644 index 02eb79c..0000000 --- a/apps/base/osint/kustomization.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - namespace.yaml - - configmap.yaml - - postgres-pvc.yaml - - postgres-pvc-linode.yaml - - postgres-deployment.yaml - - postgres-service.yaml - - nats-deployment.yaml - - nats-service.yaml - - app-deployment.yaml - - app-service.yaml - - ingester-deployment.yaml - - camera-pvc.yaml - - camera-deployment.yaml - - titiler-deployment.yaml - - titiler-service.yaml - - news-scraper-deployment.yaml - - news-summarizer-deployment.yaml - - httproute.yaml - # exec-only RBAC so forgejo/cluster-backup can pg_dump this namespace's plain - # Postgres Deployment (osint-db) — not a CNPG cluster, so it needs its own path. - - backup-exec-rbac.yaml diff --git a/apps/base/osint/namespace.yaml b/apps/base/osint/namespace.yaml deleted file mode 100644 index 06e4f8f..0000000 --- a/apps/base/osint/namespace.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: osint diff --git a/apps/base/osint/nats-deployment.yaml b/apps/base/osint/nats-deployment.yaml deleted file mode 100644 index 52fe659..0000000 --- a/apps/base/osint/nats-deployment.yaml +++ /dev/null @@ -1,67 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: osint-nats - namespace: osint - labels: - app: osint-nats -spec: - replicas: 1 - selector: - matchLabels: - app: osint-nats - template: - metadata: - labels: - app: osint-nats - spec: - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - affinity: - nodeAffinity: - # Prefer the amd64 worker (linode) for these stateless CPU loops so - # they stop drawing on the 15 W-powered ThinkPad. Preferred, not - # required: if linode is absent they still schedule on siriussec. - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - preference: - matchExpressions: - - key: kubernetes.io/hostname - operator: In - values: - - linode - # keeps these off the arm64 rpi (some of these images are amd64-only) - nodeSelector: - kubernetes.io/arch: amd64 - containers: - - name: nats - image: forgejo.siriusdevops.com/sirius/nats:2.10 - imagePullPolicy: IfNotPresent - args: ["-js", "-m", "8222", "-sd", "/data"] - ports: - - containerPort: 4222 - name: client - - containerPort: 8222 - name: monitor - volumeMounts: - - name: data - mountPath: /data - readinessProbe: - httpGet: - path: /healthz - port: 8222 - initialDelaySeconds: 5 - periodSeconds: 10 - resources: - requests: - cpu: 50m - memory: 64Mi - limits: - memory: 256Mi - volumes: - # JetStream is a transient bus here (compose had no volume either): - # events are written to Postgres by the consumer loop. - - name: data - emptyDir: {} diff --git a/apps/base/osint/nats-service.yaml b/apps/base/osint/nats-service.yaml deleted file mode 100644 index 028f62a..0000000 --- a/apps/base/osint/nats-service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: osint-nats - namespace: osint -spec: - selector: - app: osint-nats - ports: - - name: client - port: 4222 - targetPort: 4222 - - name: monitor - port: 8222 - targetPort: 8222 diff --git a/apps/base/osint/news-scraper-deployment.yaml b/apps/base/osint/news-scraper-deployment.yaml deleted file mode 100644 index 22cfd07..0000000 --- a/apps/base/osint/news-scraper-deployment.yaml +++ /dev/null @@ -1,58 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: osint-news-scraper - namespace: osint - labels: - app: osint-news-scraper -spec: - replicas: 1 - selector: - matchLabels: - app: osint-news-scraper - template: - metadata: - labels: - app: osint-news-scraper - spec: - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - affinity: - nodeAffinity: - # Prefer the amd64 worker (linode) for these stateless CPU loops so - # they stop drawing on the 15 W-powered ThinkPad. Preferred, not - # required: if linode is absent they still schedule on siriussec. - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - preference: - matchExpressions: - - key: kubernetes.io/hostname - operator: In - values: - - linode - # keeps these off the arm64 rpi (some of these images are amd64-only) - nodeSelector: - kubernetes.io/arch: amd64 - containers: - - name: news-scraper - image: forgejo.siriusdevops.com/sirius/osint-news-scraper:amd64-58f71f5b4520 - imagePullPolicy: IfNotPresent - # Image ENTRYPOINT is `scrapy`; the loop crawls, sleeps, crawls again. - command: ["python", "run_news_scraper.py"] - envFrom: - - configMapRef: - name: osint-env - env: - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: osint-db - key: password - resources: - requests: - cpu: 100m - memory: 256Mi - limits: - memory: 768Mi diff --git a/apps/base/osint/news-summarizer-deployment.yaml b/apps/base/osint/news-summarizer-deployment.yaml deleted file mode 100644 index 647fdc8..0000000 --- a/apps/base/osint/news-summarizer-deployment.yaml +++ /dev/null @@ -1,58 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: osint-news-summarizer - namespace: osint - labels: - app: osint-news-summarizer -spec: - replicas: 1 - selector: - matchLabels: - app: osint-news-summarizer - template: - metadata: - labels: - app: osint-news-summarizer - spec: - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - affinity: - nodeAffinity: - # Prefer the amd64 worker (linode) for these stateless CPU loops so - # they stop drawing on the 15 W-powered ThinkPad. Preferred, not - # required: if linode is absent they still schedule on siriussec. - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - preference: - matchExpressions: - - key: kubernetes.io/hostname - operator: In - values: - - linode - # keeps these off the arm64 rpi (some of these images are amd64-only) - nodeSelector: - kubernetes.io/arch: amd64 - containers: - - name: news-summarizer - image: forgejo.siriusdevops.com/sirius/osint-news-summarizer:amd64-fe2b5df369d0 - imagePullPolicy: IfNotPresent - # Loop: batch the last window, call Nous Portal, write summaries. - command: ["python", "run_news_summarizer.py"] - envFrom: - - configMapRef: - name: osint-env - env: - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: osint-db - key: password - resources: - requests: - cpu: 50m - memory: 128Mi - limits: - memory: 512Mi diff --git a/apps/base/osint/pg-image/Dockerfile b/apps/base/osint/pg-image/Dockerfile deleted file mode 100644 index fa7acbc..0000000 --- a/apps/base/osint/pg-image/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -# Cluster build of the OSINT Postgres image (amd64). -# -# Identical to `Dockerfile.pg` in sirius/osint-dashboard EXCEPT the base image -# is pinned to Debian bookworm AND to the 16.16 minor. The upstream file's bare -# `FROM postgres:16` now resolves to Debian trixie, where -# postgresql-16-postgis-3 (3.7.0+pgdg13) fails to load against PostgreSQL 16.15: -# could not load library "/usr/lib/postgresql/16/lib/postgis-3.so": -# undefined symbol: heap_datum_check -# On bookworm (+pgdg12) both extensions load and create_hypertable() works. -# -# PostgreSQL minor and the TimescaleDB package build MUST match. TimescaleDB -# publishes one .so per PG minor (the packagecloud suffix `-1616` means built -# against 16.16). PostgreSQL 16.16/17.12/18.7 added the PortalDrop() "while it -# is being set up" check, which the <=2.32.0 background scheduler trips on, so -# every policy job fails with `cannot drop portal ""` (timescale#11038, fixed -# in 2.32.1). Both halves are pinned here so a rebuild cannot silently drift -# back onto a mismatched pair. -# -# Resulting versions: PostgreSQL 16.16, postgis 3.7.0, timescaledb 2.32.1. -# After a pod recreate run `ALTER EXTENSION timescaledb UPDATE TO '2.32.1'`. -FROM postgres:16.16-bookworm - -RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates curl gnupg lsb-release && \ - curl -fsSL https://packagecloud.io/install/repositories/timescale/timescaledb/script.deb.sh | bash && \ - apt-get update && apt-get install -y --no-install-recommends \ - postgresql-16-postgis-3 \ - timescaledb-2-postgresql-16=2.32.1~debian12-1616 \ - timescaledb-2-loader-postgresql-16=2.32.1~debian12-1616 && \ - mkdir -p /etc/postgresql/16/main/conf.d && \ - echo "shared_preload_libraries = 'timescaledb'" > /etc/postgresql/16/main/conf.d/timescaledb.conf && \ - rm -rf /var/lib/apt/lists/* - -# The official postgres entrypoint remains the CMD and handles -# POSTGRES_USER / POSTGRES_DB / POSTGRES_PASSWORD and pg_hba setup. diff --git a/apps/base/osint/postgres-deployment.yaml b/apps/base/osint/postgres-deployment.yaml deleted file mode 100644 index dd4a051..0000000 --- a/apps/base/osint/postgres-deployment.yaml +++ /dev/null @@ -1,100 +0,0 @@ -# TimescaleDB + PostGIS, single instance on local-path. -# NOT CloudNativePG: the app's alembic chain requires CREATE EXTENSION -# postgis AND timescaledb plus create_hypertable()/continuous aggregates, and -# this image (Dockerfile.pg, built amd64) is the exact Postgres the Pi stack -# ran. A CNPG cluster would need a custom CNPG-conformant Timescale image. -apiVersion: apps/v1 -kind: Deployment -metadata: - name: osint-db - namespace: osint - labels: - app: osint-db -spec: - replicas: 1 - # ReadWriteOnce PVC: old and new pod cannot both mount it. - strategy: - type: Recreate - selector: - matchLabels: - app: osint-db - template: - metadata: - labels: - app: osint-db - spec: - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - # Local-path volume: the claim (osint-pgdata-linode) is pinned to linode by - # its PV, so the pod must be too. arch selector documents why: the image is - # amd64-only, as on every other node this can land on. - nodeSelector: - kubernetes.io/arch: amd64 - affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: kubernetes.io/hostname - operator: In - values: - - linode - containers: - - name: postgres - image: forgejo.siriusdevops.com/sirius/osint-dashboard-pg:amd64-c48788d4b614-r3 - imagePullPolicy: IfNotPresent - args: - - -c - - shared_preload_libraries=timescaledb - - -c - - shared_buffers=1GB - - -c - - max_connections=100 - ports: - - containerPort: 5432 - name: postgres - env: - - name: POSTGRES_USER - value: osint - - name: POSTGRES_DB - value: osint_data - # Bare `psql`/`pg_dump -U osint` inside this pod would otherwise - # default the database to the USER name and log - # `FATAL: database "osint" does not exist` (seen 2026-11-21 22:15 - # on deploy/osint-db). PGDATABASE makes the correct db the default. - - name: PGDATABASE - value: osint_data - - name: PGDATA - value: /var/lib/postgresql/data/pgdata - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: osint-db - key: password - readinessProbe: - exec: - command: ["pg_isready", "-U", "osint", "-d", "osint_data", "-h", "127.0.0.1"] - initialDelaySeconds: 10 - periodSeconds: 10 - failureThreshold: 6 - livenessProbe: - exec: - command: ["pg_isready", "-U", "osint", "-d", "osint_data", "-h", "127.0.0.1"] - initialDelaySeconds: 60 - periodSeconds: 30 - failureThreshold: 6 - volumeMounts: - - name: pgdata - mountPath: /var/lib/postgresql/data - resources: - requests: - cpu: 200m - memory: 512Mi - limits: - memory: 2Gi - volumes: - - name: pgdata - persistentVolumeClaim: - claimName: osint-pgdata-linode diff --git a/apps/base/osint/postgres-pvc-linode.yaml b/apps/base/osint/postgres-pvc-linode.yaml deleted file mode 100644 index a7dc02b..0000000 --- a/apps/base/osint/postgres-pvc-linode.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# Post-migration home for osint-db: a linode-local volume. -# Kept separate from postgres-pvc.yaml (osint-pgdata, on siriussec) so a -# rollback is one revert of the Deployment's claimName; the old claim and its -# PV stay untouched and Bound. -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: osint-pgdata-linode - namespace: osint -spec: - accessModes: - - ReadWriteOnce - storageClassName: local-path-linode - resources: - requests: - storage: 15Gi diff --git a/apps/base/osint/postgres-pvc.yaml b/apps/base/osint/postgres-pvc.yaml deleted file mode 100644 index 5ebbd76..0000000 --- a/apps/base/osint/postgres-pvc.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: osint-pgdata - namespace: osint -spec: - accessModes: - - ReadWriteOnce - storageClassName: local-path - resources: - requests: - storage: 15Gi diff --git a/apps/base/osint/postgres-service.yaml b/apps/base/osint/postgres-service.yaml deleted file mode 100644 index d8bbff2..0000000 --- a/apps/base/osint/postgres-service.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: osint-db - namespace: osint -spec: - selector: - app: osint-db - ports: - - name: postgres - port: 5432 - targetPort: 5432 diff --git a/apps/base/osint/titiler-deployment.yaml b/apps/base/osint/titiler-deployment.yaml deleted file mode 100644 index a023e07..0000000 --- a/apps/base/osint/titiler-deployment.yaml +++ /dev/null @@ -1,51 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: osint-titiler - namespace: osint - labels: - app: osint-titiler -spec: - replicas: 1 - selector: - matchLabels: - app: osint-titiler - template: - metadata: - labels: - app: osint-titiler - spec: - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - nodeSelector: - kubernetes.io/hostname: siriussec - containers: - - name: titiler - image: forgejo.siriusdevops.com/sirius/titiler:0.26.0 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 8000 - name: http - env: - - name: PORT - value: "8000" - - name: WORKERS_PER_CORE - value: "1" - - name: WEB_CONCURRENCY - value: "1" - - name: GDAL_CACHEMAX - value: "128" - readinessProbe: - httpGet: - path: /healthz - port: 8000 - initialDelaySeconds: 5 - periodSeconds: 15 - resources: - requests: - cpu: 50m - memory: 128Mi - limits: - memory: 512Mi diff --git a/apps/base/osint/titiler-service.yaml b/apps/base/osint/titiler-service.yaml deleted file mode 100644 index f8818d0..0000000 --- a/apps/base/osint/titiler-service.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: osint-titiler - namespace: osint -spec: - selector: - app: osint-titiler - ports: - - name: http - port: 8000 - targetPort: 8000 diff --git a/apps/base/piedmont/deployment-api.yaml b/apps/base/piedmont/deployment-api.yaml index 32fc373..e031271 100644 --- a/apps/base/piedmont/deployment-api.yaml +++ b/apps/base/piedmont/deployment-api.yaml @@ -18,13 +18,11 @@ spec: operator: Exists effect: PreferNoSchedule nodeSelector: - kubernetes.io/hostname: siriussec + kubernetes.io/hostname: linode containers: - name: contact-api - # Built and pushed by sirius/websites/.forgejo/workflows/deploy-phs-contact.yml - # as :$sha (see docs/site-image-pinning.md). - image: forgejo.siriusdevops.com/sirius/phs-contact:5035443abb62913362e416ab7030a64726886886 - imagePullPolicy: IfNotPresent + image: forgejo.siriusdevops.com/sirius/phs-contact:latest + imagePullPolicy: Always command: ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8090"] ports: - containerPort: 8090 diff --git a/apps/base/piedmont/deployment.yaml b/apps/base/piedmont/deployment.yaml index 7d6c735..85c3108 100644 --- a/apps/base/piedmont/deployment.yaml +++ b/apps/base/piedmont/deployment.yaml @@ -18,11 +18,11 @@ spec: operator: Exists effect: PreferNoSchedule nodeSelector: - kubernetes.io/hostname: siriussec + kubernetes.io/hostname: linode containers: - name: nginx - image: forgejo.siriusdevops.com/sirius/phs-site:5b590cddab6d7889fdd3c272255f28c4560e752e - imagePullPolicy: IfNotPresent + image: forgejo.siriusdevops.com/sirius/phs-site:latest + imagePullPolicy: Always ports: - containerPort: 80 name: http diff --git a/apps/base/sirius-growth/backup-exec-rbac.yaml b/apps/base/sirius-growth/backup-exec-rbac.yaml deleted file mode 100644 index 8e55fc8..0000000 --- a/apps/base/sirius-growth/backup-exec-rbac.yaml +++ /dev/null @@ -1,41 +0,0 @@ ---- -# Lets the nightly `forgejo/cluster-backup` CronJob take a `pg_dump` of this -# namespace's CloudNativePG cluster through the exec API (namespace `forgejo` -# cannot mount a Secret from here, and the dump runs as the in-pod `postgres` -# superuser over the local socket, so no database password exists in git). -# -# Least privilege: that ServiceAccount may look up the Cluster object and run -# one command inside this namespace's pods — nothing else. -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: cluster-backup - namespace: sirius-growth - labels: - app: cluster-backup -rules: - - apiGroups: [""] - resources: ["pods"] - verbs: ["get", "list"] - - apiGroups: [""] - resources: ["pods/exec"] - verbs: ["create"] - - apiGroups: ["postgresql.cnpg.io"] - resources: ["clusters"] - verbs: ["get"] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: cluster-backup - namespace: sirius-growth - labels: - app: cluster-backup -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: cluster-backup -subjects: - - kind: ServiceAccount - name: cluster-backup - namespace: forgejo diff --git a/apps/base/sirius-growth/cluster.yaml b/apps/base/sirius-growth/cluster.yaml deleted file mode 100644 index 09e5d4a..0000000 --- a/apps/base/sirius-growth/cluster.yaml +++ /dev/null @@ -1,68 +0,0 @@ -apiVersion: postgresql.cnpg.io/v1 -kind: Cluster -metadata: - name: portal - namespace: sirius-growth -spec: - instances: 1 - imageName: ghcr.io/cloudnative-pg/postgresql:16 - storage: - size: 5Gi - storageClass: local-path - affinity: - nodeSelector: - kubernetes.io/hostname: siriussec - bootstrap: - initdb: - database: portal - owner: portal - secret: - name: sirius-growth-portal-db - resources: - requests: - cpu: 100m - memory: 256Mi - limits: - memory: 1Gi - # --------------------------------------------------------------------------- - # Point-in-time recovery: continuous WAL archiving + daily base backups into - # Garage on the Linode hub (10.10.0.5), i.e. a different power and internet - # domain from this primary. Companion objects: ObjectStore portal-wal (the - # store + 14d retention) and ScheduledBackup portal-daily. - # - # This is the CNPG-I Barman Cloud **plugin** (Deployment cnpg-system/barman-cloud, - # vendored in infrastructure/databases/base), not the operator's in-tree - # barman-cloud support: 1.30 deprecates the in-tree path and 1.31 removes it - # (`Warning: Native support for Barman Cloud backups and recovery is - # deprecated ...`). See objectstore-portal-wal.yaml for the store definition. - # - # `serverName: portal` is the barman prefix and must stay exactly the cluster - # name: the plugin writes to s3://pg-wal-archive/portal/{base,wals}/... — the - # same objects the in-tree archiver left behind, so the existing 14-day window - # stays restorable. Changing it starts a new prefix and abandons that window. - # - # Credentials live in Secret sirius-growth/portal-wal-s3 (created out of band - # from the Garage key `cnpg-portal-wal`, id GK7f2b4bb1fc9abaec50fde37b, scope - # read+write on bucket `pg-wal-archive` only). Never commit the key values. - # - # `pg_dump` in forgejo/cluster-backup still runs nightly for this database as - # a second, logical copy: a dump survives a barman-format regression or a - # store that has been emptied, and it is the only copy that is readable - # without barman. Belt and braces, not redundancy theatre — the RPO comes - # from the WAL archive, not from the dump. - plugins: - - name: barman-cloud.cloudnative-pg.io - isWALArchiver: true - parameters: - barmanObjectName: portal-wal - serverName: portal - # Scraped via podmonitor.yaml in this directory (hand-written; see the comment - # in apps/base/forgejo/podmonitor.yaml for why enablePodMonitor is false). - # Only the operator's default query set here — this database needs no custom - # application metrics. - monitoring: - enablePodMonitor: false - disableDefaultQueries: false - customQueriesConfigMap: - - name: cnpg-default-monitoring - key: queries diff --git a/apps/base/sirius-growth/configmap-portal-gate.yaml b/apps/base/sirius-growth/configmap-portal-gate.yaml deleted file mode 100644 index 5e6a0b0..0000000 --- a/apps/base/sirius-growth/configmap-portal-gate.yaml +++ /dev/null @@ -1,69 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: sirius-growth-portal-gate - namespace: sirius-growth -data: - default.conf: | - # Sirius Growth portal login gate. One job: cap credential attempts per client - # IP before they reach the API. The HTTPRoute sends only /api/portal/login* here - # (login, plus a trailing-slash variant); everything else goes straight to the - # portal service, so this pod can never break uploads, downloads or the admin API. - - # The TCP peer is always cluster ingress, so $remote_addr is meaningless until - # the forwarded chain is resolved: Envoy (hostNetwork, siriussec) appends the - # caller to X-Forwarded-For. Trusting the pod / service / node ranges makes - # $remote_addr the real client. A caller cannot spoof it by sending its own - # X-Forwarded-For, because Envoy appends the true address to the right of - # whatever the client supplied and nginx walks the chain from the right. - set_real_ip_from 10.244.0.0/16; - set_real_ip_from 10.96.0.0/12; - set_real_ip_from 10.10.0.0/24; - real_ip_header X-Forwarded-For; - real_ip_recursive on; - - # 12 attempts/min per IP with 6 in hand: a fat-fingered operator gets several - # tries, a password guesser gets nowhere. Tune the two numbers here only. - limit_req_zone $binary_remote_addr zone=portal_login:10m rate=12r/m; - limit_req_status 429; - limit_req_log_level warn; - - server { - listen 8080; - server_name _; - default_type application/json; - - client_max_body_size 8k; - client_body_timeout 10s; - - location ^~ /api/portal/login { - limit_req zone=portal_login burst=6 nodelay; - - # JSON, not nginx's HTML error page: portal.js shows the body's `error` - # string on the sign-in page instead of "Portal API is not reachable". - error_page 429 @login_limited; - - proxy_pass http://sirius-growth-portal:8091; - proxy_http_version 1.1; - proxy_set_header Host $host; - # Pass the chain through verbatim; uvicorn reads the leftmost entry. - proxy_set_header X-Forwarded-For $http_x_forwarded_for; - proxy_set_header X-Real-IP $remote_addr; - proxy_connect_timeout 5s; - proxy_read_timeout 15s; - proxy_send_timeout 15s; - proxy_buffering off; - } - - location @login_limited { - internal; - default_type application/json; - add_header Cache-Control "no-store" always; - return 429 '{"error":"too many sign-in attempts - wait a minute and try again"}'; - } - - # Nothing else is routed to this pod. An honest 404 beats a proxied surprise. - location / { - return 404; - } - } diff --git a/apps/base/sirius-growth/cronjob-leadgen-ncda.yaml b/apps/base/sirius-growth/cronjob-leadgen-ncda.yaml deleted file mode 100644 index 898e058..0000000 --- a/apps/base/sirius-growth/cronjob-leadgen-ncda.yaml +++ /dev/null @@ -1,85 +0,0 @@ -apiVersion: batch/v1 -kind: CronJob -metadata: - name: sgs-leadgen-ncda - namespace: sirius-growth -spec: - # 10:00, not 08:00: on a Monday-the-1st the weekly job owns the RWO volume at - # 08:00 and concurrencyPolicy is per-CronJob, so a 2h gap keeps them apart. - schedule: "0 10 1 * *" - timeZone: America/New_York - concurrencyPolicy: Forbid - startingDeadlineSeconds: 3600 - suspend: false - successfulJobsHistoryLimit: 3 - failedJobsHistoryLimit: 3 - jobTemplate: - spec: - backoffLimit: 1 - activeDeadlineSeconds: 1800 - ttlSecondsAfterFinished: 604800 - template: - metadata: - labels: - app: sgs-leadgen-ncda - spec: - restartPolicy: Never - nodeSelector: - kubernetes.io/hostname: siriussec - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - securityContext: - fsGroup: 10001 - containers: - - name: leadgen - image: forgejo.siriusdevops.com/sirius/sgs-leadgen:eef935874bb19b6cee73bd93d7fd9ab4001ec184 - imagePullPolicy: IfNotPresent - env: - - name: DATABASE_URL - valueFrom: - secretKeyRef: - name: sirius-growth-portal-app - key: database-url - - name: TELEGRAM_BOT_TOKEN - valueFrom: - secretKeyRef: - name: sirius-growth-contact - key: TG_TOKEN - - name: TELEGRAM_CHAT_ID - valueFrom: - secretKeyRef: - name: sirius-growth-contact - key: TG_CHAT - - name: SGS_DATA_DIR - value: /data - - name: SGS_STATE_PATH - value: /data/state.json - - name: SGS_CSV - value: /data/leads.csv - # Monthly-only source: the NCDA&CS licensed-nursery register. - - name: SGS_NCDA - value: "1" - volumeMounts: - - name: data - mountPath: /data - - name: tmp - mountPath: /tmp - securityContext: - runAsNonRoot: true - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - resources: - requests: - cpu: 100m - memory: 256Mi - limits: - memory: 1Gi - volumes: - - name: data - persistentVolumeClaim: - claimName: sgs-leadgen-data - - name: tmp - emptyDir: - sizeLimit: 256Mi diff --git a/apps/base/sirius-growth/cronjob-leadgen.yaml b/apps/base/sirius-growth/cronjob-leadgen.yaml deleted file mode 100644 index 051bfca..0000000 --- a/apps/base/sirius-growth/cronjob-leadgen.yaml +++ /dev/null @@ -1,85 +0,0 @@ -apiVersion: batch/v1 -kind: CronJob -metadata: - name: sgs-leadgen - namespace: sirius-growth -spec: - schedule: "0 8 * * 1" - timeZone: America/New_York - concurrencyPolicy: Forbid - startingDeadlineSeconds: 3600 - suspend: false - successfulJobsHistoryLimit: 3 - failedJobsHistoryLimit: 3 - jobTemplate: - spec: - backoffLimit: 1 - activeDeadlineSeconds: 1800 - ttlSecondsAfterFinished: 604800 - template: - metadata: - labels: - app: sgs-leadgen - spec: - restartPolicy: Never - # local-path is a node-local volume: the pod must run where the PV is. - nodeSelector: - kubernetes.io/hostname: siriussec - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - # local-path mounts root-owned; the image runs as uid 10001, so fsGroup - # makes /data group-writable for it. - securityContext: - fsGroup: 10001 - containers: - - name: leadgen - image: forgejo.siriusdevops.com/sirius/sgs-leadgen:eef935874bb19b6cee73bd93d7fd9ab4001ec184 - imagePullPolicy: IfNotPresent - env: - - name: DATABASE_URL - valueFrom: - secretKeyRef: - name: sirius-growth-portal-app - key: database-url - - name: TELEGRAM_BOT_TOKEN - valueFrom: - secretKeyRef: - name: sirius-growth-contact - key: TG_TOKEN - - name: TELEGRAM_CHAT_ID - valueFrom: - secretKeyRef: - name: sirius-growth-contact - key: TG_CHAT - - name: SGS_DATA_DIR - value: /data - - name: SGS_STATE_PATH - value: /data/state.json - - name: SGS_CSV - value: /data/leads.csv - volumeMounts: - - name: data - mountPath: /data - # tempfile.NamedTemporaryFile() needs a writable TMPDIR; the rest - # of the root filesystem stays read-only. - - name: tmp - mountPath: /tmp - securityContext: - runAsNonRoot: true - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - resources: - requests: - cpu: 100m - memory: 256Mi - limits: - memory: 1Gi - volumes: - - name: data - persistentVolumeClaim: - claimName: sgs-leadgen-data - - name: tmp - emptyDir: - sizeLimit: 256Mi diff --git a/apps/base/sirius-growth/deployment-api.yaml b/apps/base/sirius-growth/deployment-api.yaml deleted file mode 100644 index 7797954..0000000 --- a/apps/base/sirius-growth/deployment-api.yaml +++ /dev/null @@ -1,54 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: sirius-growth-contact - namespace: sirius-growth -spec: - replicas: 1 - selector: - matchLabels: - app: sirius-growth-contact - template: - metadata: - labels: - app: sirius-growth-contact - spec: - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - nodeSelector: - kubernetes.io/hostname: siriussec - containers: - - name: contact-api - # Built and pushed by sirius-growth/.forgejo/workflows/deploy-contact.yml - # as :$sha (see docs/site-image-pinning.md). - image: forgejo.siriusdevops.com/sirius/sirius-growth-contact:c9c9379ebceca6879d3bbeff1c2601b6484e87b0 - imagePullPolicy: IfNotPresent - command: ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8090"] - ports: - - containerPort: 8090 - name: http - env: - - name: TG_TOKEN - valueFrom: - secretKeyRef: - name: sirius-growth-contact - key: TG_TOKEN - - name: TG_CHAT - valueFrom: - secretKeyRef: - name: sirius-growth-contact - key: TG_CHAT - readinessProbe: - httpGet: - path: /health - port: 8090 - initialDelaySeconds: 5 - periodSeconds: 10 - resources: - requests: - cpu: 50m - memory: 128Mi - limits: - memory: 256Mi diff --git a/apps/base/sirius-growth/deployment-blog.yaml b/apps/base/sirius-growth/deployment-blog.yaml deleted file mode 100644 index bc72f8e..0000000 --- a/apps/base/sirius-growth/deployment-blog.yaml +++ /dev/null @@ -1,91 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: sirius-growth-blog - namespace: sirius-growth -spec: - replicas: 1 - selector: - matchLabels: - app: sirius-growth-blog - template: - metadata: - labels: - app: sirius-growth-blog - spec: - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - nodeSelector: - kubernetes.io/hostname: siriussec - containers: - - name: blog - # Pinned by immutable tag. The blog is mounted at /journal by the - # site nginx, so it has no Service hostname of its own and no - # HTTPRoute - the marketing site proxies to this ClusterIP service. - image: forgejo.siriusdevops.com/sirius/sirius-growth-blog:4378680888a7d3976106533111003e2cb257a362 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 8092 - name: http - env: - - name: DATABASE_URL - valueFrom: - secretKeyRef: - name: sirius-growth-blog-app - key: database-url - - name: SESSION_SECRET - valueFrom: - secretKeyRef: - name: sirius-growth-blog-app - key: session-secret - - name: S3_ENDPOINT - valueFrom: - secretKeyRef: - name: sirius-growth-blog-s3 - key: endpoint - - name: S3_BUCKET - valueFrom: - secretKeyRef: - name: sirius-growth-blog-s3 - key: bucket - - name: S3_ACCESS_KEY - valueFrom: - secretKeyRef: - name: sirius-growth-blog-s3 - key: access-key - - name: S3_SECRET_KEY - valueFrom: - secretKeyRef: - name: sirius-growth-blog-s3 - key: secret-key - - name: S3_REGION - valueFrom: - secretKeyRef: - name: sirius-growth-blog-s3 - key: region - # Every URL the service emits (canonical, RSS, sitemap, media, - # admin form actions) hangs off this; the mount is /journal. - - name: PUBLIC_BASE_URL - value: https://siriusgrowthsolutions.com/journal - - name: PORTAL_BASE_URL - value: https://siriusgrowthsolutions.com - readinessProbe: - httpGet: - path: /health - port: 8092 - initialDelaySeconds: 5 - periodSeconds: 10 - livenessProbe: - httpGet: - path: /health - port: 8092 - initialDelaySeconds: 20 - periodSeconds: 20 - resources: - requests: - cpu: 50m - memory: 128Mi - limits: - memory: 384Mi diff --git a/apps/base/sirius-growth/deployment-portal-gate.yaml b/apps/base/sirius-growth/deployment-portal-gate.yaml deleted file mode 100644 index 32714f6..0000000 --- a/apps/base/sirius-growth/deployment-portal-gate.yaml +++ /dev/null @@ -1,53 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: sirius-growth-portal-gate - namespace: sirius-growth -spec: - replicas: 1 - selector: - matchLabels: - app: sirius-growth-portal-gate - template: - metadata: - labels: - app: sirius-growth-portal-gate - spec: - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - nodeSelector: - kubernetes.io/hostname: siriussec - containers: - - name: nginx - image: nginx:1.27-alpine - imagePullPolicy: IfNotPresent - ports: - - containerPort: 8080 - name: http - volumeMounts: - - name: conf - mountPath: /etc/nginx/conf.d/default.conf - subPath: default.conf - readOnly: true - readinessProbe: - tcpSocket: - port: 8080 - initialDelaySeconds: 2 - periodSeconds: 10 - livenessProbe: - tcpSocket: - port: 8080 - initialDelaySeconds: 10 - periodSeconds: 20 - resources: - requests: - cpu: 10m - memory: 16Mi - limits: - memory: 64Mi - volumes: - - name: conf - configMap: - name: sirius-growth-portal-gate diff --git a/apps/base/sirius-growth/deployment-portal.yaml b/apps/base/sirius-growth/deployment-portal.yaml deleted file mode 100644 index fc7120a..0000000 --- a/apps/base/sirius-growth/deployment-portal.yaml +++ /dev/null @@ -1,102 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: sirius-growth-portal - namespace: sirius-growth -spec: - replicas: 1 - selector: - matchLabels: - app: sirius-growth-portal - template: - metadata: - labels: - app: sirius-growth-portal - spec: - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - nodeSelector: - kubernetes.io/hostname: siriussec - containers: - - name: portal-api - image: forgejo.siriusdevops.com/sirius/sirius-growth-portal:ce350ed04749d57833020bda8604b1d16896d25c - imagePullPolicy: IfNotPresent - ports: - - containerPort: 8091 - name: http - env: - - name: DATABASE_URL - valueFrom: - secretKeyRef: - name: sirius-growth-portal-app - key: database-url - - name: SESSION_SECRET - valueFrom: - secretKeyRef: - name: sirius-growth-portal-app - key: session-secret - - name: ADMIN_USERNAME - valueFrom: - secretKeyRef: - name: sirius-growth-portal-app - key: admin-username - - name: ADMIN_PASSWORD - valueFrom: - secretKeyRef: - name: sirius-growth-portal-app - key: admin-password - - name: S3_ENDPOINT - valueFrom: - secretKeyRef: - name: sirius-growth-portal-app - key: s3-endpoint - - name: S3_BUCKET - valueFrom: - secretKeyRef: - name: sirius-growth-portal-app - key: s3-bucket - - name: S3_ACCESS_KEY - valueFrom: - secretKeyRef: - name: sirius-growth-portal-app - key: s3-access-key - - name: S3_SECRET_KEY - valueFrom: - secretKeyRef: - name: sirius-growth-portal-app - key: s3-secret-key - - name: S3_REGION - valueFrom: - secretKeyRef: - name: sirius-growth-portal-app - key: s3-region - - name: TG_TOKEN - valueFrom: - secretKeyRef: - name: sirius-growth-contact - key: TG_TOKEN - - name: TG_CHAT - valueFrom: - secretKeyRef: - name: sirius-growth-contact - key: TG_CHAT - readinessProbe: - httpGet: - path: /api/portal/health - port: 8091 - initialDelaySeconds: 5 - periodSeconds: 10 - livenessProbe: - httpGet: - path: /api/portal/health - port: 8091 - initialDelaySeconds: 20 - periodSeconds: 20 - resources: - requests: - cpu: 50m - memory: 128Mi - limits: - memory: 384Mi diff --git a/apps/base/sirius-growth/deployment.yaml b/apps/base/sirius-growth/deployment.yaml deleted file mode 100644 index 663cc95..0000000 --- a/apps/base/sirius-growth/deployment.yaml +++ /dev/null @@ -1,46 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: sirius-growth-site - namespace: sirius-growth -spec: - replicas: 1 - selector: - matchLabels: - app: sirius-growth-site - template: - metadata: - labels: - app: sirius-growth-site - spec: - tolerations: - - key: dedicated - operator: Exists - effect: PreferNoSchedule - nodeSelector: - kubernetes.io/hostname: siriussec - containers: - - name: nginx - image: forgejo.siriusdevops.com/sirius/sirius-growth-site:413d98f6e079fd236c8f17b522be5294bced7875 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 80 - name: http - readinessProbe: - httpGet: - path: / - port: 80 - initialDelaySeconds: 5 - periodSeconds: 10 - livenessProbe: - httpGet: - path: / - port: 80 - initialDelaySeconds: 15 - periodSeconds: 20 - resources: - requests: - cpu: 25m - memory: 48Mi - limits: - memory: 192Mi diff --git a/apps/base/sirius-growth/httproute.yaml b/apps/base/sirius-growth/httproute.yaml deleted file mode 100644 index 4651c53..0000000 --- a/apps/base/sirius-growth/httproute.yaml +++ /dev/null @@ -1,41 +0,0 @@ -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: sirius-growth - namespace: sirius-growth -spec: - parentRefs: - - name: public - namespace: gateway-system - hostnames: - - siriusgrowthsolutions.com - - www.siriusgrowthsolutions.com - rules: - - matches: - - path: - type: PathPrefix - value: /api/contact - backendRefs: - - name: sirius-growth-contact - port: 8090 - - matches: - - path: - type: PathPrefix - value: /api/portal/login - backendRefs: - - name: sirius-growth-portal-gate - port: 8080 - - matches: - - path: - type: PathPrefix - value: /api/portal - backendRefs: - - name: sirius-growth-portal - port: 8091 - - matches: - - path: - type: PathPrefix - value: / - backendRefs: - - name: sirius-growth-site - port: 80 diff --git a/apps/base/sirius-growth/kustomization.yaml b/apps/base/sirius-growth/kustomization.yaml deleted file mode 100644 index 17365df..0000000 --- a/apps/base/sirius-growth/kustomization.yaml +++ /dev/null @@ -1,29 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - namespace.yaml - - deployment.yaml - - deployment-api.yaml - - deployment-portal.yaml - - deployment-blog.yaml - - deployment-portal-gate.yaml - - configmap-portal-gate.yaml - - service.yaml - - service-api.yaml - - service-portal.yaml - - service-blog.yaml - - service-portal-gate.yaml - - httproute.yaml - # The WAL archive store must exist before the Cluster references it. - - objectstore-portal-wal.yaml - - cluster.yaml - - scheduled-backup.yaml - - podmonitor.yaml - - pvc-leadgen.yaml - - cronjob-leadgen.yaml - - cronjob-leadgen-ncda.yaml - # exec-only RBAC so forgejo/cluster-backup can pg_dump this namespace's CNPG - # cluster (portal) without copying a database password across namespaces. - - backup-exec-rbac.yaml - # Snapshot mirror of the lead-gen capture PVC to the Linode. - - leadgen-backup.yaml diff --git a/apps/base/sirius-growth/leadgen-backup.yaml b/apps/base/sirius-growth/leadgen-backup.yaml deleted file mode 100644 index 70aa0cf..0000000 --- a/apps/base/sirius-growth/leadgen-backup.yaml +++ /dev/null @@ -1,150 +0,0 @@ ---- -# backup: `sgs-leadgen-data` PVC (4.9 MiB) -> Linode VPS over the WireGuard mesh. -# -# The lead-gen CronJobs (`cronjob-leadgen.yaml`, `cronjob-leadgen-ncda.yaml`) -# read and write this claim, so a pod of this namespace must mount it — a PVC -# cannot be mounted from `forgejo` where the main cluster-backup job lives. -# The mirror is a hardlink `--link-dest` snapshot chain (same shape as the -# forgejo-data mirror) so each night is a full restorable directory and only -# changed blocks cross the tunnel. -apiVersion: v1 -kind: ConfigMap -metadata: - name: leadgen-backup-scripts - namespace: sirius-growth - labels: - app: leadgen-backup -data: - backup.sh: | - #!/bin/bash - # Snapshot mirror of /src -> $BACKUP_DIR/leadgen-data// + `latest`. - set -euo pipefail - - if ! command -v rsync >/dev/null || ! command -v ssh >/dev/null; then - echo "== installing rsync + openssh-client" - apk add --no-cache rsync openssh-client >/dev/null - fi - - BACKUP_HOST=${BACKUP_HOST:-root@10.10.0.5} - BACKUP_DIR=${BACKUP_DIR:-/root/cluster-backup} - DATA_SRC=${DATA_SRC:-/src} - DATA_KEEP=${DATA_KEEP:-7} - MIN_FREE_GB=${MIN_FREE_GB:-8} - STAMP=${STAMP:-$(date -u +%Y%m%dT%H%M%SZ)} - - SSH_OPTS=(-i /keys/id_ed25519 - -o UserKnownHostsFile=/keys/known_hosts - -o StrictHostKeyChecking=yes - -o BatchMode=yes - -o ConnectTimeout=20 - -o ServerAliveInterval=30) - ssh_r() { ssh "${SSH_OPTS[@]}" "$BACKUP_HOST" "$@"; } - - echo "== target: $BACKUP_HOST:$BACKUP_DIR stamp=$STAMP" - ssh_r "mkdir -p '$BACKUP_DIR/leadgen-data' '$BACKUP_DIR/manifests'" - avail_gb=$(ssh_r "df -Pk '$BACKUP_DIR' | awk 'NR==2{printf \"%d\", \$4/1048576}'") - avail_gb=${avail_gb:-0} - echo "== remote free space: ${avail_gb} GiB (minimum ${MIN_FREE_GB} GiB)" - if [ "$avail_gb" -lt "$MIN_FREE_GB" ]; then - echo "FAIL: not enough free space on $BACKUP_HOST" - exit 1 - fi - - ssh_r "cd '$BACKUP_DIR/leadgen-data' && [ -e latest ] || { mkdir -p .empty && ln -sfn .empty latest; }" - - echo "== leadgen-data: $DATA_SRC -> leadgen-data/$STAMP (link-dest)" - rc=0 - rsync -a --numeric-ids --delete --stats --link-dest=../latest \ - -e "ssh ${SSH_OPTS[*]}" \ - "$DATA_SRC/" "$BACKUP_HOST:$BACKUP_DIR/leadgen-data/$STAMP/" || rc=$? - case "$rc" in - 0) ;; - 24) echo "== rsync exit 24: files changed during the copy (expected)" ;; - *) echo "FAIL: rsync exit $rc"; exit "$rc" ;; - esac - ssh_r "cd '$BACKUP_DIR/leadgen-data' && ln -sfn '$STAMP' latest && du -sh '$STAMP'" - - echo "== manifest" - ssh_r "cd '$BACKUP_DIR' && { echo 'stamp $STAMP'; echo \"host \$(hostname -s)\"; \ - echo '--- leadgen-data/latest'; du -shL leadgen-data/latest; \ - find leadgen-data/latest -type f -exec sha256sum {} + | sed 's| leadgen-data/latest/| |'; } \ - >> manifests/$STAMP.txt && tail -8 manifests/$STAMP.txt" - - echo "== retention: last $DATA_KEEP leadgen snapshots" - ssh_r "cd '$BACKUP_DIR/leadgen-data' && ls -1dt 20* 2>/dev/null | tail -n +$((DATA_KEEP + 1)) | xargs -r rm -rf" - ssh_r "df -h '$BACKUP_DIR' | tail -1" - - echo "RESULT=success stamp=$STAMP" ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: leadgen-backup - namespace: sirius-growth - labels: - app: leadgen-backup -spec: - # 07 minutes after the grafana job; the dataset is tiny, this is only so the - # three nightly jobs never overlap on the mesh. - schedule: "7 3 * * *" - timeZone: "Etc/UTC" - concurrencyPolicy: Forbid - startingDeadlineSeconds: 1800 - successfulJobsHistoryLimit: 3 - failedJobsHistoryLimit: 3 - jobTemplate: - spec: - activeDeadlineSeconds: 900 - backoffLimit: 1 - template: - metadata: - labels: - app: leadgen-backup - spec: - restartPolicy: Never - # The PVC is local-path on siriussec. - nodeSelector: - kubernetes.io/hostname: siriussec - containers: - - name: backup - image: alpine/k8s:1.36.4 - imagePullPolicy: IfNotPresent - command: ["/bin/bash", "/scripts/backup.sh"] - env: - - name: BACKUP_HOST - value: root@10.10.0.5 - - name: BACKUP_DIR - value: /root/cluster-backup - - name: DATA_KEEP - value: "7" - volumeMounts: - - name: leadgen-data - mountPath: /src - readOnly: true - - name: keys - mountPath: /keys - readOnly: true - - name: scripts - mountPath: /scripts - readOnly: true - resources: - requests: - cpu: 50m - memory: 64Mi - limits: - ephemeral-storage: 512Mi - memory: 256Mi - volumes: - - name: leadgen-data - persistentVolumeClaim: - claimName: sgs-leadgen-data - readOnly: true - - name: keys - secret: - # Copy of forgejo/cluster-backup-ssh, created out of band. - secretName: cluster-backup-ssh - defaultMode: 0400 - - name: scripts - configMap: - name: leadgen-backup-scripts - defaultMode: 0755 diff --git a/apps/base/sirius-growth/namespace.yaml b/apps/base/sirius-growth/namespace.yaml deleted file mode 100644 index 3b3689e..0000000 --- a/apps/base/sirius-growth/namespace.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: sirius-growth - labels: - app.kubernetes.io/part-of: sirius-growth diff --git a/apps/base/sirius-growth/objectstore-portal-wal.yaml b/apps/base/sirius-growth/objectstore-portal-wal.yaml deleted file mode 100644 index 90a82d3..0000000 --- a/apps/base/sirius-growth/objectstore-portal-wal.yaml +++ /dev/null @@ -1,51 +0,0 @@ -# The WAL archive for Cluster sirius-growth/portal, in the CNPG-I Barman Cloud -# plugin's own CR instead of Cluster.spec.backup.barmanObjectStore. -# -# Same store, same layout: destinationPath is the *bucket root* and the plugin -# appends the server name (Cluster.spec.plugins[].parameters.serverName, set to -# `portal`), so the existing objects stay exactly where the in-tree archiver put -# them — s3://pg-wal-archive/portal/{base,wals}/... . Anything that changes the -# prefix silently abandons the 14-day window that is already in the bucket. -# -# `spec.configuration` is the literal translation of the retired -# `spec.backup.barmanObjectStore` block (same schema, same Secret), and -# `retentionPolicy` moved here from Cluster.spec.backup.retentionPolicy — in the -# plugin architecture retention is a property of the store, not the cluster. -# -# Credentials: Secret sirius-growth/portal-wal-s3 (Garage key `cnpg-portal-wal`, -# id GK7f2b4bb1fc9abaec50fde37b, RW on bucket `pg-wal-archive` only), created -# out of band. The key values are deliberately not in git. -apiVersion: barmancloud.cnpg.io/v1 -kind: ObjectStore -metadata: - name: portal-wal - namespace: sirius-growth -spec: - configuration: - destinationPath: s3://pg-wal-archive - endpointURL: http://10.10.0.5:3900 - s3Credentials: - accessKeyId: - name: portal-wal-s3 - key: ACCESS_KEY_ID - secretAccessKey: - name: portal-wal-s3 - key: ACCESS_SECRET_KEY - region: - name: portal-wal-s3 - key: REGION - # gzip on both directions: this is a WAL stream over the WireGuard mesh into - # a 20 GB store on the Linode, so bytes on the wire and in the bucket are - # the cost. Must match what the in-tree archiver wrote (gzip) — the - # archive is read by segment, but a mismatch in base-backup compression - # would make the existing base backups unrestorable. - wal: - compression: gzip - maxParallel: 2 - data: - compression: gzip - jobs: 2 - # Enforced by the plugin instance sidecar every 30 min (default - # retentionPolicyIntervalSeconds) with barman-cloud's retention logic, i.e. - # the same 14-day window the in-tree archiver maintained. - retentionPolicy: "14d" diff --git a/apps/base/sirius-growth/podmonitor.yaml b/apps/base/sirius-growth/podmonitor.yaml deleted file mode 100644 index 4b1e9cd..0000000 --- a/apps/base/sirius-growth/podmonitor.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Prometheus scrape config for the Sirius Growth Postgres cluster (CNPG). -# See apps/base/forgejo/podmonitor.yaml for why this is hand-written rather than -# produced by `spec.monitoring.enablePodMonitor` (deprecated as of CNPG 1.27). -apiVersion: monitoring.coreos.com/v1 -kind: PodMonitor -metadata: - name: cnpg-portal - namespace: sirius-growth - labels: - release: kube-prometheus-stack -spec: - selector: - matchLabels: - cnpg.io/cluster: portal - podMetricsEndpoints: - - port: metrics - interval: 30s diff --git a/apps/base/sirius-growth/pvc-leadgen.yaml b/apps/base/sirius-growth/pvc-leadgen.yaml deleted file mode 100644 index a0fc253..0000000 --- a/apps/base/sirius-growth/pvc-leadgen.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: sgs-leadgen-data - namespace: sirius-growth -spec: - accessModes: - - ReadWriteOnce - storageClassName: local-path - resources: - requests: - storage: 1Gi diff --git a/apps/base/sirius-growth/scheduled-backup.yaml b/apps/base/sirius-growth/scheduled-backup.yaml deleted file mode 100644 index 3aa68d1..0000000 --- a/apps/base/sirius-growth/scheduled-backup.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: postgresql.cnpg.io/v1 -kind: ScheduledBackup -metadata: - name: portal-daily - namespace: sirius-growth -spec: - # Six-field cron (seconds first — CNPG, not standard cron). 03:20 UTC, clear - # of the 02:37 forgejo/cluster-backup CronJob so the two do not fight for the - # primary's I/O on a laptop disk. - schedule: "0 20 3 * * *" - cluster: - name: portal - # `self`: the Backup objects are owned by this ScheduledBackup, so deleting the - # schedule (or the namespace) does not leave orphaned Backups pointing at the - # cluster. Retention/cleanup of the archive itself is the ObjectStore's - # spec.retentionPolicy (14d), enforced by the plugin's sidecar. - backupOwnerReference: self - # Plugin method, not `barmanObjectStore`: the in-tree method is removed in - # CNPG 1.31. `pluginConfiguration` names the CNPG-I plugin, whose - # ObjectStore is referenced by the Cluster's spec.plugins. - method: plugin - pluginConfiguration: - name: barman-cloud.cloudnative-pg.io - immediate: false diff --git a/apps/base/sirius-growth/service-api.yaml b/apps/base/sirius-growth/service-api.yaml deleted file mode 100644 index 028a421..0000000 --- a/apps/base/sirius-growth/service-api.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: sirius-growth-contact - namespace: sirius-growth -spec: - type: ClusterIP - selector: - app: sirius-growth-contact - ports: - - name: http - port: 8090 - targetPort: 8090 - protocol: TCP diff --git a/apps/base/sirius-growth/service-blog.yaml b/apps/base/sirius-growth/service-blog.yaml deleted file mode 100644 index 9508ad7..0000000 --- a/apps/base/sirius-growth/service-blog.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: sirius-growth-blog - namespace: sirius-growth -spec: - type: ClusterIP - selector: - app: sirius-growth-blog - ports: - - name: http - port: 8092 - targetPort: 8092 - protocol: TCP diff --git a/apps/base/sirius-growth/service-portal-gate.yaml b/apps/base/sirius-growth/service-portal-gate.yaml deleted file mode 100644 index 4ceadee..0000000 --- a/apps/base/sirius-growth/service-portal-gate.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: sirius-growth-portal-gate - namespace: sirius-growth -spec: - type: ClusterIP - selector: - app: sirius-growth-portal-gate - ports: - - name: http - port: 8080 - targetPort: 8080 - protocol: TCP diff --git a/apps/base/sirius-growth/service-portal.yaml b/apps/base/sirius-growth/service-portal.yaml deleted file mode 100644 index 559537c..0000000 --- a/apps/base/sirius-growth/service-portal.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: sirius-growth-portal - namespace: sirius-growth -spec: - type: ClusterIP - selector: - app: sirius-growth-portal - ports: - - name: http - port: 8091 - targetPort: 8091 - protocol: TCP diff --git a/apps/base/sirius-growth/service.yaml b/apps/base/sirius-growth/service.yaml deleted file mode 100644 index 69ac783..0000000 --- a/apps/base/sirius-growth/service.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: sirius-growth-site - namespace: sirius-growth -spec: - type: ClusterIP - selector: - app: sirius-growth-site - ports: - - name: http - port: 80 - targetPort: 80 - protocol: TCP diff --git a/apps/base/siriusdevops/deployment-api.yaml b/apps/base/siriusdevops/deployment-api.yaml index 79b475e..1bcae7f 100644 --- a/apps/base/siriusdevops/deployment-api.yaml +++ b/apps/base/siriusdevops/deployment-api.yaml @@ -18,11 +18,11 @@ spec: operator: Exists effect: PreferNoSchedule nodeSelector: - kubernetes.io/hostname: siriussec + kubernetes.io/hostname: linode containers: - name: contact-api - image: forgejo.siriusdevops.com/sirius/siriusdevops-contact:8642f1a14b1dd9f217e32856b7a9ea0a0c37e3aa - imagePullPolicy: IfNotPresent + image: siriusdevops-contact:dev + imagePullPolicy: Never command: ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8090"] ports: - containerPort: 8090 diff --git a/apps/base/siriusdevops/deployment-site.yaml b/apps/base/siriusdevops/deployment-site.yaml index 67f1fe5..d789e01 100644 --- a/apps/base/siriusdevops/deployment-site.yaml +++ b/apps/base/siriusdevops/deployment-site.yaml @@ -18,71 +18,14 @@ spec: operator: Exists effect: PreferNoSchedule nodeSelector: - kubernetes.io/hostname: siriussec - # Owner media is NOT in the image, and the Garage bucket stays private - # (WireGuard-only: no website access, no public hostname). This - # initContainer pulls s3://siriusdevops-media over the mesh into an - # emptyDir that nginx serves at /media/. Baked assets (site.css, og.png, - # favicon, screenshots) stay baked - scope is owner media only. - # - # It must never take the site down: if Garage is unreachable at boot it - # retries a few times, then exits 0 with a warning and the page serves - # with the monogram fallback instead of the headshot. - initContainers: - - name: media-sync - image: amazon/aws-cli@sha256:7a77ccb39e3272191adbf905c50db8c127db88fd79454911a41a6b1c0e419e9b - imagePullPolicy: IfNotPresent - command: - - /bin/sh - - -c - - | - set -u - for attempt in 1 2 3 4 5; do - if aws s3 sync "s3://siriusdevops-media/" /media/ \ - --endpoint-url http://10.10.0.1:3900 \ - --only-show-errors; then - echo "media sync ok (attempt $attempt): $(ls -R /media | head -20)" - exit 0 - fi - echo "media sync attempt $attempt failed; retrying in 10s" - sleep 10 - done - echo "WARNING: media sync failed after 5 attempts - serving without /media (headshot falls back to monogram)" - exit 0 - env: - # aws-cli v2 sends a CRC32 checksum header on PutObject/HeadObject - # by default and Garage v1.1.0 rejects it as "invalid checksum - # algorithm" - only send checksums when an operation requires one. - - name: AWS_DEFAULT_REGION - value: garage - - name: AWS_EC2_METADATA_DISABLED - value: "true" - - name: AWS_REQUEST_CHECKSUM_CALCULATION - value: when_required - - name: AWS_RESPONSE_CHECKSUM_VALIDATION - value: when_required - envFrom: - - secretRef: - name: garage-media-s3 - volumeMounts: - - name: media - mountPath: /media - resources: - requests: - cpu: 10m - memory: 32Mi - limits: - memory: 128Mi + kubernetes.io/hostname: linode containers: - name: nginx - image: forgejo.siriusdevops.com/sirius/siriusdevops-site:399c421f51a2fd74a87e810641226d58e4e22690 - imagePullPolicy: IfNotPresent + image: siriusdevops-site:dev + imagePullPolicy: Never ports: - containerPort: 80 name: http - volumeMounts: - - name: media - mountPath: /usr/share/nginx/html/media readinessProbe: httpGet: path: / @@ -95,6 +38,3 @@ spec: memory: 64Mi limits: memory: 256Mi - volumes: - - name: media - emptyDir: {} diff --git a/apps/base/siriusdevops/kustomization.yaml b/apps/base/siriusdevops/kustomization.yaml index aa601cb..742b5df 100644 --- a/apps/base/siriusdevops/kustomization.yaml +++ b/apps/base/siriusdevops/kustomization.yaml @@ -7,4 +7,3 @@ resources: - service-site.yaml - service-api.yaml - httproute.yaml - - networkpolicy-site-egress.yaml diff --git a/apps/base/siriusdevops/networkpolicy-site-egress.yaml b/apps/base/siriusdevops/networkpolicy-site-egress.yaml deleted file mode 100644 index 389e5c8..0000000 --- a/apps/base/siriusdevops/networkpolicy-site-egress.yaml +++ /dev/null @@ -1,70 +0,0 @@ -# Egress policy for the public site pod — the first policy in this namespace -# (there were zero before 2026-11-19, so every pod could reach every WireGuard -# address). -# -# What it is for: `siriusdevops-site` runs an initContainer that pulls owner -# media out of the private Garage bucket over the mesh -# (http://10.10.0.1:3900). Nothing else about that pod needs to talk to the -# WireGuard network, and the pod is internet-facing, so it is the right first -# pod to fence off. -# -# WHY A CiliumNetworkPolicy AND NOT A networking.k8s.io NetworkPolicy: -# 10.10.0.1 is a CLUSTER NODE (rpi, the WireGuard hub), not a bare address. -# Cilium resolves it to `reserved:remote-node` (identity 6) in its ipcache -# (`cilium-dbg bpf ipcache list | grep 10.10.0.1` -> identity=6), and `ipBlock` -# / toCIDR rules are only evaluated for `reserved:world`. A standard -# NetworkPolicy with `ipBlock: 10.10.0.1/32` is silently inert here — measured: -# the pod's request to 10.10.0.1:3900 timed out exactly like the denied ports, -# while Prometheus (unrestricted namespace) scraped the same host fine. -# -# The narrower `toNodes: [{matchLabels: {kubernetes.io/hostname: rpi}}]` form -# would name the node exactly, but the agent rejects it unless Cilium runs with -# `enable-node-selector-labels: true` — status: "FromNodes/ToNodes rules can -# only be applied when the \"enable-node-selector-labels\" flag is set". Rather -# than change a cluster-wide Cilium flag for one policy, this uses the -# `remote-node` entity: any cluster node, TCP 3900 only. Every cluster node is -# on the WireGuard overlay, so this still cannot reach the LAN or the public -# internet, and the port scope is what makes the denial test meaningful. -# -# Scope: Egress only, one pod selector. Other pods in siriusdevops (and every -# other namespace) remain unrestricted — this proves the pattern, it is not -# namespace segregation. Ingress is untouched: the Cilium Gateway must still be -# able to reach nginx on :80. -# -# The policy is a whitelist: once it selects a pod, ALL egress from that pod is -# denied except what is listed. Two allowances: -# 1. TCP 3900 to a cluster node — Garage's S3 API on 10.10.0.1. Deliberately -# port-scoped: 10.10.0.1 also serves the container registry on 5000, and -# that stays unreachable from this pod. -# 2. Cluster DNS. Nothing in this pod resolves names today (the S3 endpoint -# is a literal IP); the rule costs one line and removes the trap of -# breaking name resolution in a pod that later grows a container. -apiVersion: cilium.io/v2 -kind: CiliumNetworkPolicy -metadata: - name: siriusdevops-site-egress - namespace: siriusdevops -spec: - endpointSelector: - matchLabels: - app: siriusdevops-site - egress: - # Garage S3 API, on a WireGuard-overlay node, port 3900 only. - - toEntities: - - remote-node - toPorts: - - ports: - - port: "3900" - protocol: TCP - - # Cluster DNS (CoreDNS) only. - - toEndpoints: - - matchLabels: - io.kubernetes.pod.namespace: kube-system - k8s-app: kube-dns - toPorts: - - ports: - - port: "53" - protocol: UDP - - port: "53" - protocol: TCP diff --git a/apps/home/kustomization.yaml b/apps/home/kustomization.yaml index de35548..2d11d4a 100644 --- a/apps/home/kustomization.yaml +++ b/apps/home/kustomization.yaml @@ -4,7 +4,3 @@ resources: - ../base/forgejo - ../base/siriusdevops - ../base/piedmont - - ../base/sirius-growth - - ../base/osint - - ../base/metabase - - ../base/customer1 diff --git a/clusters/home/kustomization.yaml b/clusters/home/kustomization.yaml index e9eeb42..8a56d26 100644 --- a/clusters/home/kustomization.yaml +++ b/clusters/home/kustomization.yaml @@ -1,9 +1,3 @@ -# NOT RECONCILED. The bootstrapped `flux-system` Kustomization reads -# ./clusters/homek8s (see clusters/homek8s/flux-system/gotk-sync.yaml), so -# nothing in this directory is ever applied. It is kept only as a placeholder; -# add Flux Kustomizations under clusters/homek8s/ instead. (Until 2026-10-27 -# the `monitoring` Kustomization lived only here, which is why it never -# existed on the cluster.) apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: diff --git a/clusters/homek8s/apps.yaml b/clusters/homek8s/apps.yaml index a060326..eee63cd 100644 --- a/clusters/homek8s/apps.yaml +++ b/clusters/homek8s/apps.yaml @@ -15,7 +15,3 @@ spec: prune: true dependsOn: - name: infrastructure - # `sirius-growth` now carries an `ObjectStore` (barmancloud.cnpg.io) whose - # CRD ships with the plugin in the `databases` Kustomization, and the - # portal Cluster references it. Apply apps only after that CRD exists. - - name: databases diff --git a/clusters/homek8s/cert-manager.yaml b/clusters/homek8s/cert-manager.yaml deleted file mode 100644 index e32ba2a..0000000 --- a/clusters/homek8s/cert-manager.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: kustomize.toolkit.fluxcd.io/v1 -kind: Kustomization -metadata: - name: cert-manager - namespace: flux-system -spec: - interval: 10m0s - retryInterval: 1m - timeout: 5m - sourceRef: - kind: GitRepository - name: flux-system - path: ./infrastructure/controllers/cert-manager - # The HelmRelease owns the chart; pruning the Kustomization deletes the - # release object, and the chart's CRDs carry `helm.sh/resource-policy: keep` - # so they survive. Nothing here is a bare CRD in git, hence prune: true. - prune: true - wait: true diff --git a/clusters/homek8s/databases.yaml b/clusters/homek8s/databases.yaml deleted file mode 100644 index 108270d..0000000 --- a/clusters/homek8s/databases.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: kustomize.toolkit.fluxcd.io/v1 -kind: Kustomization -metadata: - name: databases - namespace: flux-system -spec: - interval: 10m0s - retryInterval: 1m - timeout: 5m - sourceRef: - kind: GitRepository - name: flux-system - path: ./infrastructure/databases/base - # The CloudNativePG operator bundle contains its 11 CRDs, and the vendored - # Barman Cloud plugin adds the `ObjectStore` CRD. Those must never be pruned - # automatically: dropping them would delete every Cluster/Database/Backup - # object (and the Forgejo and portal Postgres clusters with them). Same - # reasoning as gateway-api-crds. Reverting the operator Deployment args is a - # git change, not a prune. - prune: false - # The plugin's operator<->plugin mTLS pair is issued by cert-manager - # (Issuer/Certificate in the vendored plugin manifest). Applying those before - # the cert-manager CRDs and webhook exist just churns; wait for it. - dependsOn: - - name: cert-manager diff --git a/clusters/homek8s/monitoring.yaml b/clusters/homek8s/monitoring.yaml deleted file mode 100644 index a4b2e17..0000000 --- a/clusters/homek8s/monitoring.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: kustomize.toolkit.fluxcd.io/v1 -kind: Kustomization -metadata: - name: monitoring - namespace: flux-system -spec: - interval: 1m0s - retryInterval: 1m - timeout: 15m - sourceRef: - kind: GitRepository - name: flux-system - path: ./monitoring/controllers/home - prune: true - dependsOn: - - name: infrastructure diff --git a/docs/arm64-runner-dind.md b/docs/arm64-runner-dind.md deleted file mode 100644 index 32a8b3f..0000000 --- a/docs/arm64-runner-dind.md +++ /dev/null @@ -1,1101 +0,0 @@ -# arm64 Forgejo runners on in-cluster dind — design and measured proof - -Status: **cut over 2026-10-27 — read §16 ("As-built") first for what is live, -then §1–§15 for the design and the measurements it was based on.** The design -half was kanban `t_627c231c`: every number in it was measured on `rpi` on -2026-10-27 between 05:30 and 05:55 EDT in the temporary namespace `runner-poc`, -which was deleted afterwards (§2.7). The cutover is `t_0da0a1cc`; §16 records -the applied manifests, the three deviations the cutover forced, the acceptance -evidence, and the executed rollback drill. - -**Recommendation: proceed — with three mandatory changes to the manifest, not -just a socket swap.** The deciding number: a real `ci.yml`-shaped Rust job -finished in **27 s wall inside dind vs 28 s on the Pi's host daemon** -(cargo: 25.69 s vs 25.56 s), i.e. **+3.7 % wall-clock, inside the noise of a -4-core Pi** — so dind costs essentially nothing in throughput, and the pod's -**peak RSS was 3.10 GiB**, which is 6× the 512 Mi currently requested and the -first thing that must change. See §15. - ---- - -## 1. What the arm64 runners depend on today - -### 1.1 The shared runner (`forgejo/forgejo-runner-arm64`) - -`apps/base/forgejo/runner-arm64.yaml`, as deployed and re-verified: - -| Dependency | Where | Line | -|---|---|---| -| Host docker socket | `volumes[].hostPath.path: /var/run/docker.sock` | 80–83 | -| …mounted into the runner | `volumeMounts[docker-sock] → /var/run/docker.sock` | 56–57 | -| `DOCKER_HOST=unix:///var/run/docker.sock` | `env` | 49–50 | -| Host's static CLI, `/usr/local/bin/docker-static` | volume 84–87 + mount 58–60 | | -| Host's buildx/compose plugins, `/opt/siriusdevops/runner/cli-plugins` | volume 88–91 + mount 61–63 | | -| `runner.ini` on the Pi host | `/opt/siriusdevops/runner/config/runner.ini` | 95–98 | -| Actions cache on the Pi host | `/opt/siriusdevops/runner/cache` (49 M) | 99–102 | -| The whole `/opt/siriusdevops` hostPath | volume | 103–106 | -| `supplementalGroups: [984]` (host `docker` gid) | pod securityContext | 30–31 | -| Job-container mount of the same socket and CLI | `arm64.toml` `container.options` | configmap 30 | - -The identity that must survive: `runner.ini` → -`{"id":6,"uuid":"4e07c1e9-4781-4241-bd8f-d5c10747cbd7","name":"pi-arm64", -"labels":["docker-arm64:…","arm64:…","docker:…"]}` (read live from the Pi host). - -### 1.2 The deploy runner (`forgejo/forgejo-runner-deploy-arm64`) - -`apps/base/forgejo/runner-deploy-arm64.yaml` — same shape, plus: - -| Dependency | Where | Line | -|---|---|---| -| Host docker socket | hostPath | 127–130 | -| Host `docker-static` / `cli-plugins` | volumes 131–138 | | -| `DOCKER_HOST` | env | 100–101 | -| `runner.ini` on a **different** host dir | `/opt/siriusdevops/runner-deploy/data` | 142–145 | -| `deploy-arm64.toml` job options | configmap 55–63 | | -| One-shot self-registration init container (single-use token) | 48–89 | | - -Identity: `{"id":14,"uuid":"a41aad73-5b18-4b58-be50-fc8b20807fc9", -"name":"pi-deploy-arm64","labels":["deploy-arm64:docker://node:20-bullseye"]}`. - -### 1.3 Named volumes the arm64 CI actually uses - -`docker volume ls` on the Pi (33 volumes) and `docker system df -v`, filtered to -CI-owned ones (the rest are `osint-dashboard_*`, `solana-meme-bot-data`, -`websites_registry-data`, `book-data`, … which this migration must not touch): - -| Volume | Size | Created by | -|---|---|---| -| `onionwire-target-ci` | **95.82 GB** | `ci.yml:65` `CARGO_TARGET_VOLUME`, mounted at `/target` (`ci.yml:123`) | -| `onionwire-target-ci-fuzz` | 23.96 GB | `fuzz.yml:80` | -| `onionwire-target-ci-sdk` | 17.71 GB | `ci.yml:70` `SDK_CARGO_TARGET_VOLUME`, mounted `ci.yml:193` | -| `onionwire-target-aarch64` | 3.204 GB | `release.yml:246` (aarch64 release job, `runs-on: docker`, line 428) | -| `onionwire-cargo-registry` | 381.1 MB | `ci.yml:63`, `release.yml:64` | -| `onionwire-cargo-registry-fuzz` | 411 MB | `fuzz.yml:39` | -| `GITEA-ACTIONS-TASK-*` (12 ×) | ≤ 450 kB | the runner itself | -| **CI total** | **≈ 141.5 GB** | of the 169.7 GB reported by `docker system df` | - -`docker system df` on the Pi, verbatim: - -``` -TYPE TOTAL ACTIVE SIZE RECLAIMABLE -Images 9 5 4.594GB 2.296GB (49%) -Containers 7 4 1.554GB 1.553GB (99%) -Local Volumes 33 5 169.7GB 48.67GB (28%) -Build Cache 222 0 21.44GB 21.16GB -``` - -and the four running host containers (unchanged by this card): - -``` -sirius-growth-site|127.0.0.1:5000/sirius-growth-site:latest|(host net)|Up 4 days -handyman-site|127.0.0.1:5000/handyman-site:latest|127.0.0.1:8082->80/tcp|Up 4 days -garage|dxflrs/garage:v1.1.0|10.10.0.1:3900->3900/tcp, 127.0.0.1:3900-3902->3900-3902/tcp|Up 7 days -registry|registry:2|127.0.0.1:5000->5000/tcp|Up 3 weeks -``` - -### 1.4 The two couplings that are *not* just "a socket" - -Everything else above is mechanical (mount → emptyDir/PVC). These two break -semantics, and they are the real content of the design: - -**(a) The Pi registry is bound to loopback only.** -`registry` publishes `127.0.0.1:5000` (`HostIp: 127.0.0.1` in -`docker inspect registry`) and `deploy-site.yml:62-63` does - -``` -docker build -t 127.0.0.1:5000/sirius-growth-site:latest -f Dockerfile - -docker push 127.0.0.1:5000/sirius-growth-site:latest -``` - -Inside dind, `127.0.0.1` is the pod, not the Pi. Measured from the POC pod: - -``` -== A. 127.0.0.1:5000 from dind netns: wget: can't connect to remote host (127.0.0.1): Connection refused -== B. 10.10.0.1:5000 from dind netns: wget: can't connect to remote host (10.10.0.1): Connection refused -``` - -So `deploy-site.yml`'s Pi-image half **cannot** work from dind unchanged. -Fix (§8): publish the same registry process on `10.10.0.1:5000` as well and -point the workflow at it — the host container keeps pulling -`127.0.0.1:5000/…` from the same registry, so nothing else moves. - -**(b) Garage is fine, but only because it is also published on the mesh.** -`deploy-site.yml:117-118` runs `minio/mc` with `--network host` against -`http://127.0.0.1:3900`. Garage *is* published on `10.10.0.1:3900` -(`docker inspect garage`), and from dind with `--network host` (which inside a -dind pod means the pod netns) that address answers: - -``` -== C. 10.10.0.1:3900 from dind netns: wget: server returned error: HTTP/1.1 403 Forbidden # Garage S3, anonymous denied = alive -== E. sibling container --network host: wget: server returned error: HTTP/1.1 403 Forbidden -``` - -Only the URL changes: `127.0.0.1:3900` → `10.10.0.1:3900`. - -### 1.5 Jobs on the `docker` label — what they actually do - -Nothing in onionwire pushes to a registry from the `docker` label; they all use -the daemon directly with named volumes + `docker create/start` + `docker cp`: - -| Workflow | Job | `runs-on` | Docker usage | -|---|---|---|---| -| `ci.yml` | `test` | `docker` (74) | volume create, create/start/rm (114–134) | -| `ci.yml` | `sdk` | `docker` (154) | same (184–205) | -| `fuzz.yml` | `fuzz` | `docker` (52) | volume + create/start/rm (63–99) | -| `release.yml` | `aarch64` | `docker` (68) | volumes, `docker cp` out (242–271) | -| `release.yml` | `sign` | `docker` (428) | named volume + `docker cp` (494–523) | -| `arti-watch.yml` | `watch` | `docker` (43) | **no docker at all** — python + crates.io only | -| `android-release.yml` | publish | `docker` (409) | API upload only | -| `android-ci.yml` / `android-release.yml` build jobs | | **`docker-amd64`** (89 / 76) | not arm64 — unaffected | - -Correction to the card body: the Android *build* jobs are on `docker-amd64`, -not on `docker`. Only `android-release.yml`'s final publish job is on the arm64 -label, and it does not touch the daemon. - -`deploy-site.yml` (`sirius-growth`, `runs-on: deploy-arm64`, line 33) is the only -`deploy-arm64` consumer: `docker login`, `docker buildx build --push` -(amd64 cross-build), `docker build` + `push` to `127.0.0.1:5000`, and the -Garage `mc` container. - -### 1.6 Disk hygiene is already dind-aware — check the contract, not the file - -`apps/base/forgejo/prune-cronjob.yaml` on `master` (since `f1fcf21` / -`58b7ed4`, live as `cronjob/forgejo-runner-prune` with containers -`host-daemon dind-daemons`) already prunes **every** daemon: the Pi host socket -*and* every in-cluster dind, discovered by label — `pods -l app=forgejo-runner` -whose pod has a container named `dind`, pruned over `pods/exec` with the -namespace-scoped `forgejo-prune` ServiceAccount. So the cutover needs **no -prune change at all**, only two naming contracts: - -- the new pod keeps label `app: forgejo-runner` (**it already does** — - `runner-arm64.yaml:7-8`), and -- its dind container is named **`dind`** (matching `runner-amd64.yaml:72`). - -The old `host-daemon` half becomes a harmless no-op once the arm64 runners stop -using the socket (it prunes nothing and reports `OK`). What *would* silently -break the design is naming the new container anything else — then the prune -discovers nothing and reports success, which is exactly the failure the -`ForgejoPruneCronJobStale` alert was added for. - ---- - -## 2. Measured proof that dind works on this Pi - -### 2.1 Pod - -Namespace `runner-poc` (labelled `purpose: temporary-arm64-dind-poc`), -`docker:27-dind`, `privileged: true`, `nodeSelector kubernetes.io/hostname: rpi`, -toleration `dedicated=network:PreferNoSchedule`, `dockerd ---host=unix:///var/run/docker.sock --tls=false --mtu=1420`, `/var/run` on an -emptyDir (socket shared with a runner container in the real thing), data-root on -a PVC **pinned to rpi**. Full manifest: comment on `t_627c231c`. - -### 2.2 Daemon start - -``` -$ kubectl -n runner-poc logs dind-poc | grep -E "Docker daemon|API listen" -... msg="Docker daemon" commit=4c9b3b0 containerd-snapshotter=false storage-driver=overlay2 version=27.5.1 -... msg="API listen on /var/run/docker.sock" - -$ docker network inspect bridge -f '{{json .Options}}' -{"com.docker.network.bridge.name":"docker0","com.docker.network.driver.mtu":"1420", …} - -$ docker info | head -20 - Server Version: 27.5.1 - Storage Driver: overlay2 - Backing Filesystem: extfs - Supports d_type: true - Native Overlay Diff: true - Cgroup Version: 2 - -$ df -hT /var/lib/docker -Filesystem Type Size Used Avail Use% Mounted on -/dev/sda2 ext4 916.5G 486.8G 392.4G 55% /run -``` - -overlay2 on ext4 (the Pi's only filesystem), MTU 1420 on the bridge — the two -settings the amd64 runner needed for the same reasons. - -### 2.3 Pulls - -``` -pull node:20-bullseye: 15s (952 MB) -pull rust:1.98-bookworm: 30s (1.46 GB) -``` - -### 2.4 A real build inside dind - -`docker buildx build` of the **actual** `sirius-growth` `Dockerfile.cluster` -with the real `site/` + `nginx.cluster.conf`: - -``` -arm64 build rc=0 wall=12s -#8 [4/4] RUN chmod -R a+rX /usr/share/nginx/html DONE 0.9s -#9 exporting to client directory DONE 2.1s -``` - -and the deploy runner's cross-build path — `--platform linux/amd64` on an arm64 -Pi (QEMU), which is what `deploy-site.yml:55-58` does: - -``` -amd64 build rc=0 wall=13s -#8 [4/4] RUN chmod -R a+rX /usr/share/nginx/html DONE 1.9s -``` - -`RUN` under emulation was verified to *really* be x86_64, not a silent -platform substitution, by baking a probe image: - -``` -$ docker run --rm --platform linux/amd64 poc/archcheck:amd64 cat /arch.txt -x86_64 -Linux buildkitsandbox 6.18.39+rpt-rpi-2712 #1 SMP PREEMPT Debian … x86_64 Linux -``` - -(the Pi's kernel, reported as x86_64 — qemu-user is emulating). Note the POC pod -needed **no** binfmt registration of its own: `/proc/sys/fs/binfmt_misc` inside -the pod is an empty directory, yet emulation works because the registration is -kernel-global on the Pi. That is convenient but it is a *host* dependency the -running runner did not have before — see risk R4. - -### 2.5 A representative `ci.yml`-shaped job, inside dind - -Same shape as `ci.yml:114-134`: named volumes for the cargo registry and the -target dir, `docker create -i` with `CARGO_TARGET_DIR=/target`, -`TMPDIR=/target/tmp`, source streamed in on stdin, `docker start -a -i`: - -``` -ci-shaped job wall: 27s rc=0 - Compiling regex v1.13.1 - Compiling poc-ci v0.1.0 (/src) - Finished `release` profile [optimized] target(s) in 25.69s -``` - -### 2.6 Peak memory - -From the pod cgroup on the node (`memory.peak`, cgroup v2): - -``` -/sys/fs/cgroup/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod.slice/memory.peak -3329310720 # 3.10 GiB — dockerd + containerd + buildkitd + every nested container -memory.current 1373077504 # 1.28 GiB at idle-ish -``` - -**3.10 GiB peak vs the 512 Mi the runner Deployment requests today.** A -`limits.memory: 512Mi` on the dind container would OOM-kill it on the first -`docker build`. The amd64 runner already runs `limits.memory: 4Gi` for exactly -this reason (`runner-amd64.yaml:99-104`). - -### 2.7 Everything cleaned up - -``` -$ kubectl -n runner-poc get all,pvc -pod/dind-poc 1/1 Running … pvc/dind-data Bound runner-poc-dind-data 60Gi RWO -$ kubectl delete ns runner-poc --timeout=120s -namespace "runner-poc" deleted -$ kubectl delete pv runner-poc-dind-data --timeout=60s -persistentvolume "runner-poc-dind-data" deleted -$ kubectl get ns | grep -c runner-poc → 0 (namespace gone) -$ kubectl get pv | grep -c runner-poc → 0 (pv gone) -$ ssh rpi sudo rm -rf /opt/local-path-provisioner/runner-poc-dind → removed -$ ssh rpi docker volume ls -q | wc -l → 33 (same as before the POC) -$ ssh rpi docker ps --format '{{.Names}}' → garage handyman-site registry sirius-growth-site -``` - -The host-daemon comparison (§3) created `poc-ci-host`, `poc-registry-host`, -`poc-target-host` and removed all three; the Pi's volume set is back to 33. - ---- - -## 3. Comparison numbers: dind vs the Pi's host daemon - -Both rows are the *same* image, the *same* command string, the *same* 4 cores and -the same cold (freshly created) cargo registry volume. I ran the host row -directly against the host daemon (`docker create/start` over SSH) rather than by -firing a CI job, because that is literally what `forgejo-runner-arm64` does -today — the runner is a thin client for that daemon — and it keeps the CI queue -out of it. - -| Load | dind (POC pod on rpi) | host daemon (rpi) | delta | -|---|---|---|---| -| `ci.yml`-shaped Rust job (cold registry, `cargo build --release`) | **27 s** wall / 25.69 s cargo | **28 s** wall / 25.56 s cargo | +3.7 % wall / +0.5 % cargo | -| `Dockerfile.cluster` arm64 buildx build | 12 s | not re-run (host has the same 222-entry build cache; not comparable) | — | -| `Dockerfile.cluster` **amd64 cross** buildx build | 13 s | not measurable on the host without a build-cache write to the shared daemon | — | -| `docker pull node:20-bullseye` | 15 s | n/a (already in the host cache) | — | -| Peak RSS, whole daemon | 3.10 GiB | host daemon is shared, so its RSS is not attributable | — | - -The job-shape comparison is the honest one: **dind adds no measurable build -throughput cost.** The env difference that matters is memory (3.10 GiB) and disk -(separate data-root), not CPU. - -I did **not** run a full onionwire `ci` (20–40 min) twice; the 25 s cargo leg is -the same code path and the ratio is what the cutover decision needs. - ---- - -## 4. Sizing, with arithmetic - -Everything the Pi reports, 2026-10-27 05:50 EDT: - -``` -/dev/sda2 917G 493G used 387G avail 57% (ext4, the only fs) -Mem: 8062 MB total, 6.7 GB available CPU: 4 cores -rpi allocatable: ephemeral-storage 885686112838 (825 GiB), memory 8153 Mi -dd write (oflag=direct, /opt): 65.2 MB/s -dd read (iflag=direct): 300 MB/s -``` - -### 4.1 Per-runner data-root - -**Shared runner** (`docker-arm64`, `arm64`, `docker`) — must hold, at steady -state: - -| Item | Size | -|---|---| -| `onionwire-target-ci` | 95.8 GB | -| `onionwire-target-ci-fuzz` | 24.0 GB | -| `onionwire-target-ci-sdk` | 17.7 GB | -| `onionwire-target-aarch64` | 3.2 GB | -| both cargo registries | 0.8 GB | -| images (rust:1.98-bookworm 1.46 GB + node:20-bullseye 0.95 GB, plus a rollback generation) | ≈ 3.0 GB | -| build cache (this runner does no `docker build`, only `create/start`) | ≈ 2 GB | -| **steady state** | **≈ 146.5 GB** | - -**PVC request: 200 GiB** → 27 % headroom (53.5 GiB) over the measured steady -state. The headroom is deliberate: `onionwire-target-ci` reached 95.8 GB by -itself and the amd64 dind taught us a nominally-20Gi data-root grows to ~50 GB -and evicts the node (see §4.4). - -**Deploy runner** (`deploy-arm64`) — holds two ~112–143 MB site images, the -buildx `docker-container` driver's own cache (measured 205 MB across the two POC -builds) and a generation of image history: - -**PVC request: 40 GiB** — ~10× the measured footprint, sized so a photo-heavy -site rebuild plus a rollback generation never needs a manual prune. - -**Total provisioned: 240 GiB against 387 GiB free.** After both runners are warm -(≈ 150 GiB) plus the 26.2 GiB of *non-CI* host volumes nobody is asked to move: -**≈ 211 GiB free (55 %)**. Comfortable. - -### 4.2 Migrate or rebuild cold? - -| Volume | Size | Verdict | -|---|---|---| -| `onionwire-cargo-registry` (+ `-fuzz`) | 0.79 GB | **copy** — it is pure downloaded crates, ~12 s at 65 MB/s, and saves a crates.io re-download on every cold build | -| `onionwire-target-ci` | 95.8 GB | **rebuild cold** — see below | -| `onionwire-target-ci-sdk` | 17.7 GB | rebuild cold | -| `onionwire-target-ci-fuzz` | 24.0 GB | rebuild cold | -| `onionwire-target-aarch64` | 3.2 GB | rebuild cold | - -Copying `onionwire-target-ci` costs **95 820 MB / 65.2 MB/s ≈ 1 470 s ≈ 24.5 -minutes** of write-bound Pi I/O, requires both daemons quiesced, and buys back -*one* warm `cargo test` (the 20–40 min job) — while copying a target dir that has -already produced `never executed / os error 13` corruption once. Rebuilding cold -is one unattended CI run per workspace volume and produces a directory that is -guaranteed consistent. Net: **do not migrate the 141 GB of target volumes; migrate -only the 0.8 GB of crate registries.** - -### 4.3 Where the PVCs land - -Not on the default `local-path` StorageClass — see §6.1. They land on **static -`hostPath` PVs pinned to `rpi`** at -`/opt/local-path-provisioner/forgejo-runner-{arm64,deploy-arm64}`, which is the -same filesystem and the same directory tree the provisioner uses, so `df` and -the existing monitoring see them as ordinary node disk. - -### 4.4 The `DiskPressure` lesson, and what stops a repeat here - -On rpi, kubelet eviction uses the defaults: `nodefs.available<10 %` → -**DiskPressure at ~825 G used (92 G free)** on a 917 G root; `imagefs` GC starts -at 85 %. Those thresholds are percentages of a huge disk, so they are a -last-resort guard, not a cap — a dind that fills 150 GB is invisible until it is -too late. On siriussec the equivalent threshold was crossed and Forgejo + `pg-1` -went `Pending` for days. What exists today (all live, all GitOps): - -1. **The nightly prune already reaches every dind** (`prune-cronjob.yaml`, - `dind-daemons.sh`), with a proven policy: `container prune --filter until=48h`, - `image prune -af --filter until=168h`, a builder-cache cap enforced by - walking the age window down from `--filter until=72h` to `0s` and stopping as - soon as the cache is under the cap (the `--max-used-space` / - `--keep-storage` flags are accepted by buildx 0.20.1 but reclaim **nothing** - here — measured), a `busy()` check that skips a daemon with a live build, and - **`docker volume prune` is forbidden** so `onionwire-target-ci` survives. - Requirement for the cutover: name the container `dind` and keep - `app: forgejo-runner` (§1.6). -2. **The alerts are node-scoped, because per-PVC bytes do not exist.** The old - `RunnerDindPvcHighWatermark` / `RunnerDindPvcCritical` pair was **deleted** — - it selected `kubelet_volume_stats_*`, which kubelet 1.34+ no longer exports at - all (`/metrics/volumes` 404s on every node here; upstream - kubernetes/kubernetes#133847), so it could never fire for *any* volume type, - hostPath or not. `monitoring/controllers/home/prune-alerts.yaml` instead ships - two complementary node-filesystem guards, both on the disk that holds the - dind data-root: - - `dind-disk-cap` → `RpiDindDataRootFillingUp` (**> 70 %** on rpi), which landed - with the arm64 cutover: 70 % of 917 G still leaves the room to run the prune - job, and a static PV does not enforce its claim; - - `forgejo-prune` → `RunnerDindDiskHighWatermark` (**> 80 %**) and - `RunnerDindDiskCritical` (**> 90 %**) on every *other* node that runs a - `forgejo-runner` pod (i.e. siriussec; `nodename!="rpi"` keeps the Pi from - being paged twice) with the runner-specific runbook. - Both sit inside `NodeFilesystemFillingUp` (**> 85 %**) / `NodeFilesystemCritical` - (**> 92 %**), which still cover every node as the backstop. -3. **A dedicated data-root per runner** (200 GiB + 40 GiB PVCs) so a runaway - cache cannot touch the 26 GB of unrelated host volumes on the same disk, and - so `docker system df -v` inside each pod attributes growth to one runner. - ---- - -## 5. Target architecture - -Two arm64 runners, mirrors of each other, each a **two-container pod** — exactly -the shape `forgejo-runner-amd64` already runs: - -``` -Deployment forgejo-runner-arm64 node rpi, PVC forgejo-runner-arm64-dind (200Gi) -├── container dind docker:27-dind, privileged -│ dockerd --host=unix:///var/run/docker.sock --tls=false --mtu=1420 -│ /var/lib/docker ← PVC -│ /var/run ← emptyDir (socket) -└── container runner code.forgejo.org/forgejo/runner:5.0.1, runAsUser 0 - DOCKER_HOST=unix:///var/run/docker.sock - /var/run ← emptyDir (same socket) - /data ← PVC (runner.ini + actions cache + everything else) - /config/config.toml ← ConfigMap arm64.toml - -Deployment forgejo-runner-deploy-arm64 node rpi, PVC forgejo-runner-deploy-arm64-dind (40Gi) -└── same two containers, deploy-arm64.toml, label `deploy-arm64` ONLY -``` - -Labels, verbatim, unchanged: - -| Runner | Labels | `capacity` | -|---|---|---| -| `forgejo-runner-arm64` | `docker-arm64:docker://node:20-bullseye`, `arm64:docker://node:20-bullseye`, `docker:docker://node:20-bullseye` | 1 | -| `forgejo-runner-deploy-arm64` | `deploy-arm64:docker://node:20-bullseye` | 1 | - -Not merged, not shared, and `docker` still never reaches the amd64 runner. - ---- - -## 6. Manifest / config changes - -### 6.1 Storage: static PVs, not dynamic `local-path` - -**A dynamic `local-path` PVC whose consumer is on rpi hangs forever in this -cluster.** Measured, in the POC: - -``` -$ kubectl -n runner-poc describe pvc dind-data | tail -3 - Normal Provisioning External provisioner is provisioning volume for claim "runner-poc/dind-data" -$ kubectl -n local-path-storage describe pod helper-pod-create-pvc-… | grep -A2 Events - Warning NodeAffinity kubelet Predicate NodeAffinity failed: node(s) didn't match Pod's node affinity/selector -$ kubectl -n local-path-storage get pod helper-pod-create-pvc-… -o yaml | grep -A1 nodeSelector - nodeSelector: - kubernetes.io/hostname: siriussec -``` - -Cause: `infrastructure/storage/local-path-storage.yaml:158-159` hardcodes the -helper-pod nodeSelector to `siriussec`, and for a local (non-shared) filesystem -the provisioner never sets `spec.nodeName` on the helper pod — so the helper can -only ever run on siriussec and the PV is never created. Every one of the 6 -existing `local-path` PVCs happens to live on siriussec, which is why nobody hit -this before. - -**Therefore: two static PVs pinned to rpi.** Proven working in the POC -(`pvc/dind-data Bound runner-poc-dind-data 60Gi RWO`) with: - -```yaml -kind: PersistentVolume -metadata: {name: forgejo-runner-arm64-dind} -spec: - capacity: {storage: 200Gi} - accessModes: [ReadWriteOnce] - persistentVolumeReclaimPolicy: Retain # never Delete: losing runner.ini loses the uuid - storageClassName: local-static - hostPath: {path: /opt/local-path-provisioner/forgejo-runner-arm64-dind, type: DirectoryOrCreate} - nodeAffinity: - required: - nodeSelectorTerms: - - matchExpressions: - - {key: kubernetes.io/hostname, operator: In, values: [rpi]} -``` - -plus a small `StorageClass local-static` with **no provisioner** -(`provisioner: kubernetes.io/no-provisioner`, `volumeBindingMode: WaitForFirstConsumer`) -and PVCs with `storageClassName: local-static`, `volumeName:` pinned. -`Retain` matters: a re-provisioned PV would silently produce a runner with a new -uuid. - -*Alternative considered and rejected for now*: drop the nodeSelector at -`local-path-storage.yaml:158` and add `rpi` to `nodePathMap`. It is GitOps-able, -but the helper pod would then be schedulable anywhere while the PV is pinned to -rpi — the `mkdir` and the ownership land on whichever node wins the race. Fixing -shared storage infrastructure to unblock two pods is the wrong blast radius. - -### 6.2 `arm64.toml` - -```diff - runner: - file: /config/runner.ini - capacity: 1 -@@ -- cache: /opt/siriusdevops/runner/cache -+ cache: /data/cache - cache: - enabled: true -- dir: /opt/siriusdevops/runner/cache -+ dir: /data/cache - container: - privileged: true -- # No docker_host: … -- options: -v /usr/local/bin/docker-static:/usr/bin/docker:ro -v /opt/siriusdevops/runner/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock --memory 3g --memory-swap 3g -+ # No docker_host: the socket bind below is the only one (see §7.2). -+ # The CLI comes from the dind container's own filesystem (see §7.1). -+ options: -v /usr/local/bin/docker:/usr/bin/docker:ro -v /usr/local/libexec/docker/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock --memory 3g --memory-swap 3g - valid_volumes: - - "**" -``` - -`deploy-arm64.toml` gets the identical change to `options`, and -`file:`/`cache:`/`dir:` move from `/data/...` (hostPath) to the same `/data/...` -(PVC) — the paths do not change, only the volume behind them. - -### 6.3 Deployment diff (both runners) - -Removed: `volume docker-sock (hostPath /var/run/docker.sock)`, -`volume docker-static (hostPath /usr/local/bin/docker-static)`, -`volume cli-plugins (hostPath …/cli-plugins)`, `volume siriusdevops -(hostPath /opt/siriusdevops)`, `volume runner-ini (hostPath …)`, -`volume cache (hostPath …)`, `volume data (hostPath …)`, -`securityContext.supplementalGroups: [984]`, and the runner container's -`privileged: true` + `runAsGroup: 0` (keep `runAsUser: 0` — the amd64 runner -proved the uid-1000/dind-socket race). - -Added: container `dind` (privileged, `--mtu=1420`, `/var/lib/docker` on the PVC, -`/var/run` on the emptyDir, `limits.memory: 4Gi`), `volume dind-run (emptyDir)`, -`volume data (PVC)`, and a `wait for the socket` shim on the runner so it does not -`BackOff` on a cold start (copy `runner-amd64.yaml:116-129`). - -Kept: `strategy: Recreate` (RWO PVC), `nodeSelector rpi`, the -`dedicated=network:PreferNoSchedule` toleration, `capacity: 1`, the label sets. - -### 6.4 `runner.ini`: hostPath → PVC, identity preserved - -Both runners already have a registration; neither may re-register: - -| Runner | id | uuid | name | -|---|---|---|---| -| shared | 6 | `4e07c1e9-4781-4241-bd8f-d5c10747cbd7` | `pi-arm64` | -| deploy | 14 | `a41aad73-5b18-4b58-be50-fc8b20807fc9` | `pi-deploy-arm64` | - -Cutover must **copy** the file, never let a register step run: - -``` -# shared: /opt/siriusdevops/runner/config/runner.ini → PV dir on rpi -ssh rpi 'sudo install -m 600 -o root -g root \ - /opt/siriusdevops/runner/config/runner.ini \ - /opt/local-path-provisioner/forgejo-runner-arm64-dind/runner.ini' -# deploy: /opt/siriusdevops/runner-deploy/data/runner.ini → its PV dir -ssh rpi 'sudo install -m 600 -o root -g root \ - /opt/siriusdevops/runner-deploy/data/runner.ini \ - /opt/local-path-provisioner/forgejo-runner-deploy-arm64-dind/runner.ini' -``` - -The deploy runner's init container must be **inverted** into a guard, or it will -burn the single-use token and create `id: 15` alongside `id: 14`: - -``` -- name: require-registration - command: [sh, -c, 'test -s /data/runner.ini || { echo "runner.ini missing — refusing to register a second uuid"; exit 1; }'] -``` - -…and `/data/runner.ini` must be the *runner* container's path (`/data` on the -PVC), so `arm64.toml`'s `runner.file: /config/runner.ini` becomes -`/data/runner.ini` for the shared runner as well (one less bind, one less -difference between the two runners). - ---- - -## 7. How the docker CLI reaches the jobs - -### 7.1 Bind it out of the dind image (chosen) - -`docker:27-dind` already contains the client and the plugins: - -``` -$ kubectl -n forgejo exec deploy/forgejo-runner-amd64 -c dind -- sh -c 'command -v docker; ls /usr/local/libexec/docker/cli-plugins/' -/usr/local/bin/docker -docker-buildx -docker-compose -``` - -So `container.options` binds `-v /usr/local/bin/docker:/usr/bin/docker:ro` and -`-v /usr/local/libexec/docker/cli-plugins:/usr/local/lib/docker/cli-plugins:ro` -(the daemon resolves both paths in the dind container, where they exist). The -second bind is what keeps `docker buildx` working for `deploy-site.yml:55`. - -Why not the amd64 runner's "install a static CLI in the job" approach: five -onionwire workflows plus `deploy-site.yml` call `docker` on their first line and -rely on the CLI being there today. Making them each fetch a 40 MB tarball adds a -network round-trip to every job (and one that has been seen to stall for 300 s -through Cloudflare), for no benefit — the dind image *is* the matching client for -the daemon it talks to. Jobs that want their own client still can. - -### 7.2 Socket injection: the `options` bind, never `docker_host` - -`arm64.toml` keeps the explicit `-v /var/run/docker.sock:/var/run/docker.sock` -and **no `container.docker_host`**. Setting both produces -`Duplicate mount point: /var/run/docker.sock` on every job (proven before, and -still true). This is also the one the nested-`docker run` in `ci.yml`/`fuzz.yml` -depends on. The socket lives in a shared `emptyDir` at `/var/run`, `chmod 666` -by the dind container, exactly as on the amd64 runner. - -### 7.3 MTU, cgroup, storage driver - -| Setting | Value | Why | -|---|---|---| -| `--mtu=1420` | pod eth0 MTU | Cilium native routing over WireGuard leaves 1420; a 1500 docker bridge makes pulls and large fetches stall intermittently. Verified in the POC bridge options. | -| `--host=unix:///var/run/docker.sock --tls=false` | socket only | never `-H tcp://0.0.0.0:2375`: that publishes an unauthenticated API on the pod IP. | -| storage driver | overlay2 (auto) | `Backing Filesystem: extfs` on `/dev/sda2`; verified in the POC. No `--storage-opt`, no zfs/btrfs. | -| cgroup driver | cgroupfs (in-pod default) | same as the amd64 runner; the pod's own limits are the only accounting boundary — nested containers are not visible to the kubelet, hence §4.4's file-system alert rather than a pod-level cap. | -| `--iptables` | default (true) | port publishing inside the dind daemon is used by nothing today; leave it. | - ---- - -## 8. Registry access from inside dind - -| Path | Today | From dind | Verdict | -|---|---|---|---| -| `forgejo.siriusdevops.com` (public registry, `deploy-site.yml:54-58`, `siriusdevops-contact`) | works | **works** — `wget https://forgejo.siriusdevops.com/v2/` → `HTTP/1.1 401` (auth challenge), and `docker pull forgejo.siriusdevops.com/sirius/sirius-growth-site:latest` reached manifest resolution (`no matching manifest for linux/arm64/v8`) | no change | -| Pi registry `127.0.0.1:5000` (`deploy-site.yml:62-63`) | works | **broken** — connection refused | publish the same registry on `10.10.0.1:5000` and change the workflow to `10.10.0.1:5000/sirius-growth-site:latest` | -| Garage `127.0.0.1:3900` (`deploy-site.yml:118`) | works | `10.10.0.1:3900` answers (403 anonymous) | change the URL only | - -The registry change is one line in the Pi's compose (`/home/sirius/websites/docker-compose.yml`, -project `websites`, container `registry`, currently -`ports: ["127.0.0.1:5000:5000"]` → add `"10.10.0.1:5000:5000"`). The host -container `sirius-growth-site` keeps pulling `127.0.0.1:5000/…` from the same -process, so nothing else moves. **This is card 2's change and must land before -the deploy runner is migrated**; without it the Pi-image half of `deploy-site` -fails and the host container silently stays on the old image. - ---- - -## 9. Cache strategy - -| Cache | Today | After | -|---|---|---| -| actions cache (`runner.cache`, 49 MB) | hostPath `/opt/siriusdevops/runner/cache` | `/data/cache` on the runner's PVC | -| cargo registry (0.79 GB) | host volumes | **copied** into dind (`docker run --rm -v …` + `tar` from a host-mounted read of the old volume — local copy, ~12 s) | -| cargo target dirs (141 GB) | host volumes | **cold**; regrow in place, one long CI run each | -| buildx `docker-container` builder cache (deploy runner) | host build cache (21.4 GB, shared) | inside the dind data-root; the nightly prune keeps 20 GB | - -Cold-rebuild cost per volume, stated honestly: `onionwire-target-ci` from empty -is a 20–40 min `ci` job on this Pi; the SDK and fuzz volumes are shorter. That -is a **one-off**, and it replaces a 24.5-minute blocking copy of 95.8 GB plus the -risk of migrating a target dir that has already caused `os error 13` corruption. - ---- - -## 10. Cutover steps (card 2 executes) - -Pre-flight — every one is read-only and proves the next step: - -1. `kubectl -n forgejo get deploy,pvc` and `ssh rpi docker ps` — record before. -2. Confirm `onionwire`'s in-flight work: no `running` run on the `docker` label - (`action_task`), or accept that the cutover kills it (see §14). -3. Publish the Pi registry on `10.10.0.1:5000` and prove - `curl -s http://10.10.0.1:5000/v2/` → `{}` from a pod. -4. Create the two static PVs + `local-static` StorageClass + PVCs; prove both - `Bound` before any pod references them. -5. `sudo mkdir -p` both PV dirs on rpi, copy the two `runner.ini` files (§6.4), - `chown root:root`, mode 600, and `ls -l` both. - -Cutover — shared runner first (it owns `docker`): - -6. `kubectl -n forgejo scale deploy/forgejo-runner-arm64 --replicas=0`, then - `ssh rpi docker ps --filter name=GITEA-ACTIONS` and `docker kill`/`rm` any - job containers **still running on the host daemon** (a Deployment restart does - not stop them; they keep writing to the volumes we are about to abandon). -7. Copy the two cargo registry volumes into the new dind, in the *same* pod that - will serve them, before the runner starts: - `kubectl cp` is not needed — mount the host's - `/var/lib/docker/volumes` read-only into a one-shot debug pod on rpi and - `docker cp`/`tar` it into the dind data-root (local I/O, ~12 s). -8. Apply the new `runner-arm64.yaml` (GitOps commit → Flux reconcile, or - `kubectl apply` first and commit in the same minute — pick one and say which). -9. Wait for `2/2 Running`, then in the dind container: - `docker version` (server = 27.5.1), `docker info | grep -i mtu`, - `docker volume ls` (registry present), and in the runner: - `tail /proc/1/…` — the log must show `declared successfully` + - `[poller N] launched`, and Forgejo's `action_runner.last_online` must move - for **id 6 / uuid 4e07c1e9…** (a new uuid = the registration was lost, stop). -10. Dispatch `onionwire` `ci.yml` on a branch (`workflow_dispatch`, - `POST /api/v1/repos/sirius/onionwire/actions/workflows/ci.yml/dispatches - {"ref": ""}`), and prove from the job log that both jobs ran against - the **dind** server (`docker version` inside the job), duration similar to - §3, and `action_task` row pointing at runner id 6. -11. Repeat 6–9 for `forgejo-runner-deploy-arm64` (id 14 / uuid `a41aad73…`), - then one `deploy-site` run on `runs-on: deploy-arm64` and prove the image - landed in the Pi registry (`curl -s http://10.10.0.1:5000/v2/_catalog`) and - the Garage sync succeeded. -12. Prove the existing prune discovers the new pod before trusting the night: - `kubectl -n forgejo create job --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s)` - and check its `dind-daemons` container log lists both new pods (label + - container-name contract, §1.6) and reports `docker system df` per daemon. -13. `df -h /` on rpi before/after, `kubectl -n forgejo get pvc` (both Bound), - `kubectl get deploy -n forgejo -o wide`. - -## 11. Rollback - -Kept in place for this purpose, and none of it is deleted by the cutover: - -- `runner.ini` stays at `/opt/siriusdevops/runner/config/runner.ini` and - `/opt/siriusdevops/runner-deploy/data/runner.ini` (we *copy*, never move). -- The old manifests are one `git revert` away; the PVCs and PVs are additive. -- The host-Docker volumes (`onionwire-target-ci` etc.) are **not** deleted — - only abandoned. If the cutover is reverted, the old runner finds its warm - caches again. -- The compose runner on the Pi is already stopped; it must stay stopped (two - daemons on one uuid double-poll). - -Rollback, ~5 minutes: - -``` -kubectl -n forgejo apply -f -kubectl -n forgejo apply -f -kubectl -n forgejo scale deploy/forgejo-runner-arm64 --replicas=1 -``` - -(down the dind deployment first, kill any job container inside dind, then apply.) -Verify: pod `1/1 Running` on rpi, `action_runner.last_online` current for ids 6 -and 14, and the host daemon shows `docker ps` job containers again during a job. -The new PVCs/PVs can stay (they cost nothing when unused) or be deleted with the -dind Deployments. - ---- - -## 12. Risk table - -| # | Risk | Severity | Mitigation | Residual | -|---|---|---|---|---| -| R1 | Registration lost → new uuid, two runners polling | high | copy `runner.ini` before start, `Retain` reclaim policy, verify uuid in logs *and* in `action_runner` | a `kubectl delete pv` still loses it; it lives in exactly one place, like today | -| R2 | dind data-root fills the Pi's only filesystem | high (it took Forgejo down once on siriussec) | 200 Gi/40 Gi PVCs, in-pod nightly prune, node-fs alert at 70 % | **not fully eliminated** — `local-path` does not enforce a request; the alert is the cap | -| R3 | Memory: 3.10 GiB peak vs today's 512 Mi | high | `limits.memory: 4Gi` on dind (amd64 precedent), requests 512Mi | on an 8 GB Pi two runners × 4 GiB limits can thrash if both build at once; `capacity: 1` each bounds it, but nothing bounds *both* runners together | -| R4 | amd64 cross-build currently works without an in-pod binfmt registration | medium | proven working twice (§2.4); re-verify after any kernel/dockerd/image bump | if the Pi's qemu binfmt registration is ever removed, `deploy-site`'s amd64 half breaks *silently differently* than today (today the host daemon would break too, but with a different message) | -| R5 | Pi registry reachable only on loopback | high for the deploy runner | publish on `10.10.0.1:5000` (§8) | depends on a Pi compose change that is outside this card | -| R6 | Job containers orphaned on the host daemon during cutover | medium | kill them explicitly before scaling down (§10.6); a restart does not stop them | a killed job leaves a partial artefact in the old volumes — abandoned anyway | -| R7 | `local-path` helper pod cannot provision on rpi | high (blocks the whole plan) | static PVs (§6.1), proven in the POC | two more hand-made PVs to keep in the repo; a future node change does not re-derive them | -| R8 | Cold `onionwire-target-ci` after cutover | low | accept; one long CI run | the first post-cutover `ci` is slow and may re-trigger the `os error 13` volume race if `capacity ≠ 1` — so keep 1 | -| R9 | Pull/latency regressions from MTU | low | `--mtu=1420` proven; pull 30 s for 1.46 GB | none observed | -| R10 | The prune silently skipping the new dind | medium, silent | it discovers `app=forgejo-runner` pods with a container named `dind` — naming contract in §1.6, proven with a manual Job in §10.12; `ForgejoPruneCronJobStale` fires on a stale last-success | a pod that renames the container looks pruned and is not | - ---- - -## 13. CI impact list (exact files) - -| Repo / file | Change | Why | -|---|---|---| -| `onionwire/.forgejo/workflows/ci.yml` | **none required** | CLI comes from the dind image; volume names/paths unchanged | -| `onionwire/.forgejo/workflows/fuzz.yml` | **none** | same | -| `onionwire/.forgejo/workflows/release.yml` | **none** | same (`docker cp`/volume pattern is daemon-agnostic) | -| `onionwire/.forgejo/workflows/arti-watch.yml` | **none** | no docker use at all | -| `onionwire/.forgejo/workflows/android-{ci,release}.yml` | **none** | they run on `docker-amd64`; `docker`-labelled publish job does no docker work | -| `sirius-growth/.forgejo/workflows/deploy-site.yml` | **2 lines**: `127.0.0.1:5000` → `10.10.0.1:5000` (62–63); `127.0.0.1:3900` → `10.10.0.1:3900` (118) | §1.4 | -| `siriusdevops-contact/.forgejo/workflows/deploy.yml` | **none** | already `docker-amd64` | -| `homek8s/apps/base/forgejo/runner-arm64.yaml` | dind rewrite (§6.3) | | -| `homek8s/apps/base/forgejo/runner-deploy-arm64.yaml` | dind rewrite + guarded init container | | -| `homek8s/apps/base/forgejo/runner-configmap.yaml` | `arm64.toml`/`deploy-arm64.toml` (§6.2) | | -| `homek8s/apps/base/forgejo/prune-cronjob.yaml` | **no change** — it already prunes every dind by label; only the naming contract matters (`app=forgejo-runner` + a container named `dind`) | §1.6 | -| `homek8s/monitoring/controllers/home/prune-alerts.yaml` | **already done**: `RpiDindDataRootFillingUp` (rpi, 70 %) plus `RunnerDindDisk*` (80 % / 90 %, other runner nodes) | §4.4 | -| `homek8s/apps/base/forgejo/{pv,pvc}.yaml` (new) | 2 PVs, 2 PVCs, `local-static` SC | §6.1 | -| Pi `/home/sirius/websites/docker-compose.yml` | add `10.10.0.1:5000:5000` to `registry` | §8 | - -**In-flight runs during cutover:** scaling the Deployment to 0 does **not** kill -the job containers already running on the host daemon, and Forgejo has no -cancel endpoint — the run stays `running` until its job container dies. So: -check `action_task` first, and if a run is live either wait (a `ci` run is 20–40 -min) or `docker kill` it and accept a `cancelled` run. Queued runs simply stay -`waiting` and are picked up by the new runner. Nothing is lost except the run -that was killed, and its work is being abandoned anyway (§11). - ---- - -## 14. What this design does **not** fix - -- Two arm64 runners still share one 8 GB / 4-core Pi; `capacity: 1` each means - two concurrent heavy jobs are still possible (one per runner). Unchanged. -- The `docker` label stays arm64-only, so all the Rust CI remains on the Pi. -- The Pi's root filesystem is still the only place CI data can live (no - second disk), so R2 is a monitoring problem, not a solved one. - ---- - -## 15. Recommendation - -**Proceed — with changes.** The socket swap itself is sound: a real -`ci.yml`-shaped Rust job ran in **27 s in dind vs 28 s on the host daemon** -(cargo 25.69 s vs 25.56 s), pulls are 15–30 s, and a real -`docker build` plus an amd64 cross-build both succeed inside the pod on this Pi, -so the migration costs no measurable throughput and finally gives each runner its -own data-root, its own accounting boundary in the cluster, and a rollback that is -a `git revert`. Three things must change with the socket, not after it: -**(1) `limits.memory: 4Gi` on the dind container** — measured peak RSS was -**3.10 GiB**, six times today's 512 Mi, and a 512 Mi limit OOM-kills the daemon -on the first build; **(2) static PVs pinned to rpi instead of dynamic -`local-path`**, because the provisioner's helper pod is hardcoded to siriussec -and a `local-path` PVC for an rpi pod never binds; and **(3) the Pi registry must -also publish on `10.10.0.1:5000`**, because `deploy-site.yml`'s Pi-image push -targets loopback and gets `Connection refused` from inside dind. Disk is not the -constraint (240 GiB of 387 GiB free, 146.5 GiB measured steady state); the -constraint is that a static PV does not enforce that 240 GiB either — the nightly -prune already reaches dind daemons by label (so it needs no change, only the -`dind` container name), and rpi's root filesystem is capped by -`RpiDindDataRootFillingUp` at 70 % (`dind-disk-cap` group) — per-PVC bytes are -simply not exported by kubelet 1.34+, so the filesystem is the only honest -measure. - ---- - -## 16. As-built (cutover executed 2026-10-27, kanban `t_0da0a1cc`) - -Status: **cut over and verified in production.** Both arm64 runners execute -their job containers against an in-pod `docker:27-dind`; the Pi's host Docker is -no longer a job-container daemon for either. This section records what landed, -every deviation from §6/§15 with the evidence that forced it, the acceptance -output, and the rollback that was executed. - -### 16.1 What changed, per file - -| File | Change | -|---|---| -| `apps/base/forgejo/runner-arm64.yaml` | two-container pod (`dind` + `runner`); **zero hostPath**; `/data` on PVC, `/var/run` on emptyDir; dind `--mtu=1420 --insecure-registry=10.10.0.1:5000`, `limits.memory: 4Gi`; runner `runAsUser: 0` + socket-wait shim; `supplementalGroups: [984]` and the runner's `privileged: true`/`runAsGroup: 0` removed | -| `apps/base/forgejo/runner-deploy-arm64.yaml` | same shape; dind `limits.memory: 2Gi`; the `register` init container is replaced by `require-registration`, which exits 1 when `/data/runner.ini` is missing instead of burning a single-use token and creating a second `action_runner` row | -| `apps/base/forgejo/runner-dind-storage.yaml` (new) | `StorageClass local-static` (`kubernetes.io/no-provisioner`, `WaitForFirstConsumer`, `Retain`), PV+PVC `forgejo-runner-arm64-dind` 200Gi and `forgejo-runner-deploy-arm64-dind` 40Gi, `hostPath` under `/opt/local-path-provisioner/`, `nodeAffinity` to `rpi` | -| `apps/base/forgejo/runner-configmap.yaml` | `arm64.toml`: `runner.file: /data/runner.ini`, `cache: /data/cache`, CLI/plugins bound out of the dind image; `deploy-arm64.toml`: same options, comments corrected (no host socket, no host CLI) | -| `apps/base/forgejo/kustomization.yaml` | lists the storage file before the Deployments | -| `monitoring/controllers/home/prune-alerts.yaml` | new group `dind-disk-cap`, alert `RpiDindDataRootFillingUp` at **70 %** of rpi's `/` | -| Pi `/home/sirius/websites/docker-compose.yml` | `registry` publishes `10.10.0.1:5000:5000` **in addition to** `127.0.0.1:5000:5000`; backup `docker-compose.yml.orig-20261027-registry-wg` | -| `sirius/sirius-growth` `.forgejo/workflows/deploy-site.yml` | Pi-image push `127.0.0.1:5000` → `10.10.0.1:5000`; Garage endpoint `127.0.0.1:3900` → `10.10.0.1:3900` | - -Labels, verbatim and unchanged: shared `docker-arm64`, `arm64`, `docker` (all -`docker://node:20-bullseye`); deploy `deploy-arm64` only. `capacity = 1` on both. -The `dind` container is named exactly `dind` (§1.6 naming contract). - -### 16.2 Deviations from the design, and why - -1. **`--insecure-registry=10.10.0.1:5000` on both runners' dockerd.** §8 assumed - publishing the registry on the WG address was enough. It is not: Docker only - treats `127.0.0.0/8` as insecure by default, so the first post-cutover - `deploy-site` run (task 1732) built the Pi image fine and then died pushing it: - - ``` - #8 naming to 10.10.0.1:5000/***-growth-site:latest 0.0s done - The push refers to repository [10.10.0.1:5000/***-growth-site] - Get "https://10.10.0.1:5000/v2/": http: server gave HTTP response to HTTPS client - 🏁 Job failed - ``` - - Fixed on the daemon, not in the job image, so no workflow needs to know. - Proof afterwards: `docker info` inside each dind reports - `{"10.10.0.1:5000":{"Name":"10.10.0.1:5000","Secure":false,…}}` and the - re-run pushed `latest: digest: sha256:a819dc91…`. - -2. **Deploy runner dind limit is `2Gi`, not a copy of the amd64 runner's 4Gi.** - §15 left the number open. The Pi has ~7.0 GiB available and `capacity = 1` - bounds each runner but nothing bounds *both*: two 4 GiB limits would let a - `ci` run and a deploy claim every byte of the box. A deploy is two nginx-based - site images (112–143 MB) plus buildx's container driver and one amd64 - cross-build — nothing like the Rust job that measured 3.10 GiB. 4 GiB + 2 GiB - leaves ~1 GiB for kubelet/Cilium/cloudflared/host Docker in the overlap case, - and an OOM here fails one deploy *visibly*. - -3. **Measured pod MTU is 1500, not 1420.** `ip link show eth0` in the new pod - reports `mtu 1500` on rpi (the pod's default route leaves over the LAN - interface, not `wg0`). `--mtu=1420` is kept: it is below every path MTU this - pod uses, matches the amd64 runner, and the bridge really is 1420 - (`docker network inspect bridge` → `"com.docker.network.driver.mtu":"1420"`). - -4. **`runner.ini` at `/data/runner.ini` for both runners** (§6.4), copied from the - Pi host with `install -m 600 -o root -g root` *before* the first pod start. - Identity survived: uuid `4e07c1e9-4781-4241-bd8f-d5c10747cbd7` (action_runner - id 6 — its **name in the Forgejo DB is `pi-runner`**, not the `pi-arm64` the - ini file carries; the row was renamed historically) and - `a41aad73-5b18-4b58-be50-fc8b20807fc9` (id 14). No row was created, none was - orphaned: `action_runner` still has exactly three rows after the cutover. - -5. **The card's `grep -c docker.sock` = 0 acceptance cannot literally hold.** With - an in-pod daemon the socket is still `unix:///var/run/docker.sock` (in - `DOCKER_HOST`, the shim, and `container.options`), so the string appears 5× - per Deployment. The meaningful test is **no hostPath at all**: - `kubectl -n forgejo get deploy -o yaml | grep -c hostPath` = 0 for both, - and every `docker.sock` reference resolves to the `emptyDir` shared by the - `dind` and `runner` containers. - -6. **One in-flight CI job was killed by the `--insecure-registry` reconcile.** - `ci.yml` run 1192's second job (`sdk`, task 1734) had started at 06:53 and the - pod restart at 06:56 killed its container, leaving the task `running` with no - container and the run holding the workflow's concurrency group. Cleared the - dead rows (`action_task` 1734 → status 3, `action_run` 1192 → status 3; the - same rows the Forgejo UI would mark cancelled, since Forgejo exposes no cancel - endpoint) and re-dispatched. Proof run: `ci.yml` run **1197** — `test` task - 1737 green in **1782 s** (29m42s, warm `onionwire-target-ci`; the cold first - run was 3017 s) and `sdk` task 1738 green in **791 s** (13m11s — that job has - its own `onionwire-target-ci-sdk` volume, which was cold). - - **Cancelling a *queued* run in the DB does not stick.** Two extra - `ci.yml` dispatches queued behind the workflow's concurrency group - (`action_run.status = 5`); setting `status = 3` on a waiting row is undone the - next time Forgejo's scheduler wakes the queue, and the run then starts for - real. Kill it only once it is `status = 6` (running) with a dead task — i.e. - cancel the *task* first (set `action_task.status = 3` and its - `action_task_step` rows to 3), then the run. Runs 1192/1197/1198 are all - resolved that way and `select count(*) from action_run where status in (5,6)` - is now **0**. - -### 16.3 Acceptance evidence (all pasted from the live cluster) - -PVCs bound on rpi, static, `Retain`: - -``` -$ kubectl -n forgejo get pvc -o wide | grep dind -forgejo-runner-arm64-dind Bound forgejo-runner-arm64-dind 200Gi RWO local-static -forgejo-runner-deploy-arm64-dind Bound forgejo-runner-deploy-arm64-dind 40Gi RWO local-static -$ kubectl get pv forgejo-runner-arm64-dind forgejo-runner-deploy-arm64-dind -NAME CAPACITY RECLAIM POLICY STATUS CLAIM -forgejo-runner-arm64-dind 200Gi Retain Bound forgejo/forgejo-runner-arm64-dind -forgejo-runner-deploy-arm64-dind 40Gi Retain Bound forgejo/forgejo-runner-deploy-arm64-dind -``` - -Pods on rpi, two containers each, daemon `27.5.1` (the dind image — the Pi host -daemon is `29.7.2`, so a job can never be talking to it): - -``` -$ kubectl -n forgejo get deploy -o wide -forgejo-runner-arm64 1/1 dind,runner docker:27-dind,code.forgejo.org/forgejo/runner:5.0.1 -forgejo-runner-deploy-arm64 1/1 dind,runner docker:27-dind,code.forgejo.org/forgejo/runner:5.0.1 -$ kubectl -n forgejo exec -c dind -- docker version --format 'server={{.Server.Version}}' -server=27.5.1 -``` - -Registration identity, preserved, `last_online` current, no duplicates: - -``` -$ psql -Atc "select id,uuid,name,last_online,agent_labels from action_runner order by id" -6 |4e07c1e9-4781-4241-bd8f-d5c10747cbd7|pi-runner |1793080953|["docker-arm64","arm64","docker"] -8 |91124ee3-f344-44cf-9a07-11d6379549e8|siriussec-amd64 |1793080953|["docker-amd64","amd64"] -14|a41aad73-5b18-4b58-be50-fc8b20807fc9|pi-deploy-arm64 |1793080953|["deploy-arm64"] -``` - -Real jobs on the new runner ids — shared runner (`ci.yml`, `runs-on: docker`, -arm64): task 1731 green in 3017 s (cold `onionwire-target-ci`), then the rerun -task 1737 in 1782 s (warm); deploy runner: task 1736 (`deploy-site.yml`) green in -**48 s**, every step success, including the Pi-registry push and the Garage sync: - -``` -115 … #8 naming to 10.10.0.1:5000/***-growth-site:latest 0.0s done -174 … The push refers to repository [10.10.0.1:5000/***-growth-site] -203 … latest: digest: sha256:a819dc91cc3a2630cc355a40e8b5e5850879d0e429dd4c497572ae22446951cb size: 2619 -257 … upload: ../photos/scope/scope-market-1200.webp to s3://***-growth-photos/scope/scope-market-1200.webp -299 … 🏁 Job succeeded -``` - -Nightly prune reaches both new daemons (R10 proof, forced Job): - -``` -$ kubectl -n forgejo create job --from=cronjob/forgejo-runner-prune prune-manual-1793084490 -$ kubectl -n forgejo logs job/prune-manual-1793084490 -c dind-daemons | grep -E "daemon: dind in pod/|summary:" -== daemon: dind in pod/forgejo-runner-amd64-f7bb99fb-mbv5f -== daemon: dind in pod/forgejo-runner-arm64-7c84998bb8-mmwqd -== daemon: dind in pod/forgejo-runner-deploy-arm64-5dcbd9f7fc-6nj2g -summary: dind daemons found=3 pruned=3 skipped=0 failed=0 -``` - -Pi registry scoped correctly (WG hub + loopback only; LAN and public closed): - -``` -$ ssh rpi 'ss -lntH "sport = :5000"' -LISTEN 0 4096 10.10.0.1:5000 0.0.0.0:* -LISTEN 0 4096 127.0.0.1:5000 0.0.0.0:* -$ ssh rpi 'curl -m5 -o /dev/null -w "%{http_code}" http://192.168.1.125:5000/v2/' → 000 (refused) -$ kubectl -n forgejo exec -c dind -- wget -qO- http://10.10.0.1:5000/v2/ -{} # from the job daemon itself -``` - -Disk guard live in Prometheus: - -``` -$ curl -s localhost:9090/api/v1/rules → dind-disk-cap / RpiDindDataRootFillingUp health=ok, state=inactive -$ → nodename=rpi value=0.5799 (57.99 % used, threshold 0.70) -``` - -Flux applied the change at `master@sha1:0a97d9305fd8adf07efa567b994c0754756142f3`; -`kubectl -n flux-system get kustomizations` → `apps`/`monitoring` `True` at that -revision. - -Disk, before → after: `/dev/sda2 917G, 490G used / 390G avail (56 %)` → -`496G used / 384G avail (57 %)`, with both dind data-roots now on the same -filesystem (`du -sh`: 5.2 G shared + 1.3 G deploy after the first jobs; steady -state is expected to reach ~146 G shared once the 141 GB of target volumes have -regrown inside dind — they rebuild cold by design, §4.2). - -### 16.4 What is still host-Docker dependent - -- **Nothing on the job path.** `onionwire` ci/fuzz/release and `sirius-growth` - `deploy-site` all execute against the in-pod daemon (a job's `docker version` - reports 27.5.1, the host's is 29.7.2). -- The **nightly prune** still mounts the Pi socket on purpose for its - `host-daemon` container: it is the cleanup path for the four host containers - that remain (`registry`, `garage`, `handyman-site`, `sirius-growth-site`). A - maintenance pod, not a job daemon. -- `/opt/siriusdevops` on the Pi is **kept, unused, as the rollback source** - (`runner/config/runner.ini`, `runner-deploy/data/runner.ini`, `docker-static`, - `cli-plugins`, the compose file). Nothing in the new Deployments reads it. -- The old host-daemon CI volumes (`onionwire-target-ci` 95.8 GB, `-sdk` 17.7 GB, - `-fuzz` 24.0 GB, `-aarch64` 3.2 GB) are **abandoned, not deleted** — that is the - rollback's warm cache, and it still occupies 141 GB on the Pi. -- Same host dependency as before, unchanged by design (§14): QEMU/binfmt is - kernel-global on the Pi, so the `--platform linux/amd64` cross build works - inside dind without an in-pod registration. - -### 16.5 Rollback (executed once, then re-applied) - -``` -# 1. stop the dind pods (a job container lives inside them, so it dies with them) -kubectl -n forgejo scale deploy/forgejo-runner-arm64 --replicas=0 -kubectl -n forgejo scale deploy/forgejo-runner-deploy-arm64 --replicas=0 -# 2. Flux owns these files: suspend the apps Kustomization, or the next -# reconcile puts the dind manifests straight back -flux -n flux-system suspend kustomization apps -# 3. restore the previous revision of the three files -git -C ~/Projects/homek8s show :apps/base/forgejo/runner-arm64.yaml | kubectl apply -f - -git -C ~/Projects/homek8s show :apps/base/forgejo/runner-deploy-arm64.yaml | kubectl apply -f - -git -C ~/Projects/homek8s show :apps/base/forgejo/runner-configmap.yaml | kubectl apply -f - -# 4. resume + reconcile to come back to the dind manifests -flux -n flux-system resume kustomization apps -``` - -**What the drill actually showed** (and what to do differently): - -- `kubectl apply -f ` does **not** remove the `dind` container — the - strategic merge keeps list items missing from the applied config. The rollback - came up with `containers: [dind, runner]` and the expected host socket - (`/var/run/docker.sock` as `srw-rw---- root 984`, `docker version` inside the - runner container reporting the **host** daemon 29.7.2, not 27.5.1), i.e. it - *worked* — but with a dead sidecar still in the pod. Use - `kubectl replace --force -f ` (or a real `git revert` + Flux - reconcile, which prunes correctly) if you want the pod spec literally back. -- Restoring the dind Deployments, the first pod start failed once with - `failed to start containerd: timeout waiting for containerd to start` (dockerd - exit 1) after the previous pod had been force-deleted, then succeeded on the - kubelet retry. If it ever loops, scale to 0 and clear - `/docker/containerd/daemon` while the pod is down — never while it runs - (the DiskPressure runbook rule). -- Identity survived the round trip unchanged: after restore the runner again - logs `runner: pi-runner, with labels: [docker-arm64 arm64 docker], declared - successfully` and `action_runner.last_online` is current for ids 6, 8 and 14. - -Verify after a rollback: pod `1/1 Running` on rpi, `action_runner.last_online` -moving for ids 6 and 14, and `ssh rpi docker ps` showing `GITEA-ACTIONS-*` -containers during the next job. The identity files exist in **two** places after -the cutover (Pi host + PV), which is exactly why the rollback needs no -re-registration in either direction. The PVs are `Retain`, so nothing is lost by -leaving them. diff --git a/docs/cluster-overview.md b/docs/cluster-overview.md deleted file mode 100644 index 7881d65..0000000 --- a/docs/cluster-overview.md +++ /dev/null @@ -1,978 +0,0 @@ ---- -title: Home Lab Kubernetes Cluster — Current State -created: 2026-10-26 -updated: 2026-10-26 -author: Lance Walters (written with Hermes devops agent) -tags: [homelab, kubernetes, kubeadm, wireguard, cilium, forgejo, garage] -status: current -verified: 2026-10-26T19:17Z ---- - -# Home Lab Kubernetes Cluster — Current State - -> **Provenance.** Everything marked *(live)* was read off the running cluster or hosts on **2026-10-26 between 19:00 and 19:17 UTC**. Anything not marked live comes from the GitOps repo `sirius/homek8s` at commit `bd5057c` or from the `home-k8s` Hermes skill, and is labelled as such. Section 10 is the command log. Where the skill and reality disagree, **reality is written here** and the disagreement is listed in §9.3. - -Related: [[WireGuard Mesh]], [[Home Lab Runbook]], [[Pi Reboot Recovery]] - ---- - -## 1. At a glance - -*(all live)* - -| Property | Value | -|---|---| -| Nodes | **3** — `siriussec` (control-plane + worker), `rpi` (worker / network edge), `linode` (worker, remote cloud) | -| Kubernetes | `v1.36.4` on all three, kubeadm-bootstrapped, single control plane | -| API endpoint | `https://10.10.0.2:6443` — WireGuard overlay address only | -| CNI | Cilium **v1.20.1** (Helm-managed by Flux), kube-proxy replacement, **native routing** (`ipv4NativeRoutingCIDR: 10.244.0.0/16`, `autoDirectNodeRoutes`), no VXLAN in the data path | -| Gateway API | Cilium Gateway, hostNetwork Envoy on nodes labelled `node-role.kubernetes.io/gateway=true` | -| Pod network | `10.244.0.0/16`, /24 per node: siriussec `10.244.0.0/24`, rpi `10.244.1.0/24`, linode `10.244.2.0/24` | -| Service network | `10.96.0.0/12` | -| Storage | `local-path` (rancher.io/local-path, default SC, provisioner pinned to siriussec), data under `/opt/local-path-provisioner` | -| GitOps | Flux v2 (`source`, `kustomize`, `helm`, `notification` controllers), watching `sirius/homek8s` `master`, applied revision `bd5057c` | -| Databases | CloudNativePG **1.30.0**, two clusters: `forgejo/pg` (10Gi) and `sirius-growth/portal` (5Gi) | -| Public ingress | Cloudflare tunnel **`sirius home`** → `cloudflared` (systemd on rpi) → `http://10.10.0.2:8080` | -| Workloads | **31 running pods** across 9 namespaces, plus 6 completed pods (CI prune jobs and leftovers) | -| Metrics | **none** — `metrics-server` is not installed, `kubectl top` fails *(live: `error: Metrics API not available`)* | - -**In one paragraph.** This is a three-node kubeadm cluster stitched together over WireGuard rather than a LAN. The T480 (`siriussec`) is the control plane and does the heavy lifting — app pods, databases, Forgejo, the AMD64 CI runner all live there because it is the only `amd64` box with real disk. The Raspberry Pi (`rpi`) is the network edge: it is the WireGuard hub, the Cloudflare tunnel host, and the ARM64 CI runner. The Linode VPS (`linode`) rejoined as a third worker on 2026-10-26 and carries pod CIDR `10.244.2.0/24` over the Pi's `wg-remote` tunnel. There is no VXLAN and no kube-proxy: Cilium routes pod traffic natively, so every node must be reachable at its pod CIDR over WireGuard, and the API server is firewalled to the overlay plus pod CIDR only. - ---- - -## 2. Topology - -*(live — `kubectl get nodes -o wide`, node JSON)* - -| Node | Hardware | OS / kernel | Arch | LAN | Overlay | Pod CIDR | Roles / labels | Taints | -|---|---|---|---|---|---|---|---|---| -| `siriussec` | ThinkPad T480 | Arch Linux, `6.18.50-2-lts` | amd64 | `192.168.1.179` (`enp0s31f6`) | `10.10.0.2` (`wg0`) | `10.244.0.0/24` | `control-plane`, `worker`, `gateway=true`, `node-role…/gateway=true`, `exclude-from-external-load-balancers` | **none** | -| `rpi` | Raspberry Pi (8 GiB) | Debian 13 trixie, `6.18.39+rpt-rpi-2712` | arm64 | `192.168.1.125` (`eth0`) | `10.10.0.1` (`wg0`), `10.20.0.2` (`wg-remote`) | `10.244.1.0/24` | `worker`, `node-role…/traffic`, `dedicated=network` (**no** `gateway=true` since 2026-10-27) | **none** | -| `linode` | Linode VPS, Atlanta | Debian 13 trixie, `6.12.113+deb13-amd64` | amd64 | public `50.116.38.217` | `10.10.0.5` (`dummy-k8s`), `10.20.0.1` (`wg0`, hub role) | `10.244.2.0/24` | `dedicated=network` | **none** | - -Node conditions are clean on all three: `Ready=True`, `MemoryPressure/DiskPressure/PIDPressure/NetworkUnavailable=False` *(live)*. - -### 2.1 What the roles actually mean - -**`siriussec` — control plane and the only real compute node.** Runs `kube-apiserver`, `etcd`, `kube-controller-manager`, `kube-scheduler` as static pods, plus every application pod, both CNPG database instances, Forgejo, and the AMD64 CI runner. There is deliberately **no** `NoSchedule` taint on the control plane so it can also be a worker. It sits on the API-over-WireGuard side: `:6443` is reachable only from `lo`, `wg0`, and the pod CIDR (§3.4). - -**`rpi` — network edge, not app compute.** WireGuard hub, `cloudflared` tunnel host, ARM64 CI runner (two runners, actually), and Gateway node. The skill says `rpi` carries `dedicated=network:PreferNoSchedule`; **live, it carries the label but no taint** *(drift, §9.3)*. Pods that must not land there still pin by `nodeSelector` rather than relying on the taint. - -**`linode` — a real kubeadm worker again.** It runs a full Cilium agent and has pod CIDR `10.244.2.0/24`. It is **not** a `wg0` peer of the Pi: it is reached over the Pi's `wg-remote` interface (`10.20.0.2` ↔ `10.20.0.1`) with a static route for its pod CIDR. See §3.2. - -### 2.2 Pinning rules (live, from Deployment specs) - -| Rule | Who uses it | Why | -|---|---|---| -| `nodeSelector: kubernetes.io/hostname: siriussec` | `forgejo`, `forgejo-runner-amd64`, `local-path-provisioner`, `piedmont-*`, `sirius-growth-*`, `siriusdevops-*`, `cilium-operator` | amd64 images; rpi is arm64, and the PVs live on siriussec's NVMe | -| `nodeSelector: kubernetes.io/hostname: rpi` | `forgejo-runner-arm64`, `forgejo-runner-deploy-arm64` | needs the Pi's Docker socket and arm64 host | -| label `dedicated=network` (on rpi and linode) | none currently — both are labellable targets for future network/light pods | intended for traffic/edge workloads | -| `node-role.kubernetes.io/gateway=true` (**siriussec only**; rpi lost it 2026-10-27, linode never had it) | `cilium-envoy` DaemonSet | Gateway listeners follow the label. Exactly one node must carry it: a gateway node that does not run the backend pods binds the ports and answers **503 after 5 s** for everything | - -Several app Deployments also carry a stray `tolerations: [{key: dedicated, effect: PreferNoSchedule}]` — harmless today because no node has that taint; it is residue from when rpi was tainted. - -**Why apps are pinned to `siriussec` and not spread:** the PVs are `local-path` on siriussec's `/opt/local-path-provisioner`, so a pod with a PVC cannot move. The public site images are `amd64` only, and rpi is arm64. All three production site namespaces and both databases therefore live on one machine — that is a deliberate, documented single point of failure, not an oversight. - ---- - -## 3. WireGuard - -### 3.1 Two hubs, three paths - -There are **two independent WireGuard topologies** in play, and conflating them is the classic mistake here. - -``` - ┌───────────────────────────────────────────┐ - │ rpi (LAN 192.168.1.125) │ - │ wg0 10.10.0.1/24 ← MESH HUB │ - │ wg-remote 10.20.0.2/24 ← spoke of the │ - │ Linode hub │ - └───────┬───────────────────────┬───────────┘ - wg0 (10.10.0.2/32) │ │ wg-remote (UDP 49194) - PSK, endpoint │ │ → 50.116.38.217:51820 - 192.168.1.179:50013 │ ▼ - ┌─────────────▼──────────┐ ┌──────────────────────────┐ - │ siriussec 10.10.0.2 │ │ linode 10.20.0.1/24 │ - │ (cluster API :6443) │ │ REMOTE HUB (wg0 :51820) │ - └────────────────────────┘ │ dummy-k8s 10.10.0.5/32 │ - │ node, pod 10.244.2.0/24 │ - ┌────────────────────────┐ └───────┬───────────┬──────┘ - │ Legion (laptop) │ │ │ - │ k8snet 10.10.0.3/32 │ 10.20.0.3 10.20.0.5 + 10.10.0.3 - │ admin kubectl only │ (phone) (Legion's hub-side leg) - │ NOT a node │ │ - └────────────────────────┘ 10.20.0.4 + 10.10.0.6 (SG VPS + its pod CIDR 10.244.3.0/24) -``` - -*(live — `wg show` on rpi, `wg show wg0` on siriussec, `wg show wg0` on linode)* - -**Mesh hub — `wg0` on rpi, `10.10.0.1/24`, UDP 51820.** Public key `tvPloMcBwTDciWi5WbFDpQQ2xcgidcKzRI/G3IqeuCQ=`. Peers: - -| Mesh addr | Peer | Endpoint seen | Handshake (live) | AllowedIPs on hub | Notes | -|---|---|---|---|---|---| -| `10.10.0.2/32` | **siriussec** | `192.168.1.179:50013` | 1 min ago | `10.10.0.2/32, 10.244.0.0/24` | PSK enabled; 301 GiB in / 12.7 GiB out | -| `10.10.0.3/32` | **Legion** (`k8snet`) | `192.168.1.126:52000` | 48 min ago | `10.10.0.3/32` | admin/kubectl spoke, on the LAN; PSK enabled | -| `10.10.0.4/32` | unnamed spoke | `100.91.7.84:44094` (Tailscale) | **6 days 5 h ago** | `10.10.0.4/32` | **stale** — peer defined but effectively dead | - -`wg show wg0 dump | wc -l` = **4** (header + 3 peers) *(live)*. - -**Remote hub — `wg0` on the Linode, `10.20.0.1/24`, UDP 51820.** Public key `/2Y0XpJYd9Vl9Al6zNAlQimEYA+xY9Y5PO6nUDkfKEA=`. Peers *(live)*: - -| Hub addr | Peer | AllowedIPs | Handshake | -|---|---|---|---| -| `10.20.0.2/32` | **rpi** (`wg-remote`, pubkey `h1v1Rhrnq2N2kt454xQamL1Y1x0TaICa1zoKgyZHpkM=`) | `10.20.0.2/32, 10.10.0.0/24, 10.96.0.0/12, 10.244.0.0/16` | ~1 min | -| `10.20.0.3/32` | phone | `10.20.0.3/32` | ~43 s | -| `10.20.0.5/32` + `10.10.0.3/32` | Legion (hub-side leg) | `10.20.0.5/32, 10.10.0.3/32` | ~1 min | -| `10.20.0.4/32` + `10.10.0.6/32` | SG VPS | `10.20.0.4/32, 10.10.0.6/32, 10.244.3.0/24` | *(no handshake shown — idle)* | - -**Pi's `wg-remote` side** (`10.20.0.2/24`, local UDP 49194) has exactly one peer, the Linode hub, with `AllowedIPs = 10.20.0.0/24, 10.10.0.5/32, 10.244.2.0/24` and a 25 s keepalive. That single line is why `10.10.0.5` (the Linode node's dummy address) and the Linode pod CIDR are reachable from the Pi at all. - -### 3.2 Address plan and AllowedIPs - -- **Mesh `10.10.0.0/24`** — the cluster's transport network. Node InternalIPs are `10.10.0.1/.2/.5`; the API is `10.10.0.2:6443`. -- **Remote hub `10.20.0.0/24`** — the Linode's hub addressing, plus phone and SG VPS spokes that never touch the mesh directly. -- **Spoke AllowedIPs are `10.10.0.0/24, 10.244.0.0/16`**, not a full tunnel — client traffic to the internet never traverses the Pi. siriussec's conf is exactly `Address = 10.10.0.2/32`, `Endpoint = 192.168.1.125:51820`, `AllowedIPs = 10.10.0.0/24, 10.244.0.0/16` *(live)*. -- **Pod CIDRs must be in some peer's AllowedIPs.** WireGuard cryptokey routing matches the *destination address*, so `autoDirectNodeRoutes` is useless unless the peer line covers the destination pod CIDR. That is why the hub's peer entries carry `10.244.x.0/24`, and why the Linode hub carries `10.96.0.0/12` and `10.244.0.0/16` toward the Pi. - -### 3.3 Why the mesh exists at all - -There is no flat L2 between the T480, the Pi and a cloud VPS. Two properties force the overlay: - -1. **Cilium native routing has no encapsulation.** With `routing-mode: native` and no VXLAN, a pod on siriussec addressed as `10.244.1.x` is sent as a plain packet, and the node must have a route to it. WireGuard supplies that route (`ip route get ` → `via 10.10.0.1 dev wg0`). -2. **The API server is firewalled to the overlay.** On siriussec, `/etc/nftables.d/k8s-api.nft` (loaded by `k8s-api-firewall.service`, active) is: - ``` - tcp dport 6443 iifname "lo" accept - tcp dport 6443 iifname "wg0" accept - ip saddr 10.244.0.0/16 tcp dport 6443 accept - tcp dport 6443 drop - ``` - *(live)* — so joins, kubelets and in-cluster controllers must arrive over `wg0` or from the pod network. LAN `192.168.1.179:6443` is closed by design. - -### 3.4 The `10.10.0.0/24` route-conflict hazard - -On the Pi the prefix `10.10.0.0/24` is claimed **twice**: by `wg0` (interface address `10.10.0.1/24`) and by `wg-remote`'s peer AllowedIPs (`10.10.0.0/24` toward the Linode, needed for the `10.10.0.5` dummy address). The kernel prefers `wg-remote`, which silently black-holes the Pi's path to the API while every tunnel still shows "up". - -The installed fix is `/32` pins on the hub's own peers: - -```bash -sudo ip route replace 10.10.0.2/32 dev wg0 -sudo ip route replace 10.10.0.4/32 dev wg0 -# 10.10.0.5 stays on wg-remote — it is the Linode's dummy address -``` - -*(live, current state)* -``` -$ ip route get 10.10.0.2 → 10.10.0.2 dev wg0 src 10.10.0.1 -$ ip route get 10.10.0.5 → 10.10.0.5 dev wg-remote src 10.20.0.2 -$ ip route get 10.10.0.3 → 10.10.0.3 dev wg0 src 10.10.0.1 -``` - -Persisted by `wg0-routes.service` on the Pi (oneshot, `After=wg-quick@wg0.service wg-quick@wg-remote.service`, `Before=kubelet.service`, **no `Requires=`** so a manually-started wg0 does not fail the unit). - -### 3.5 wg-quick unit state *(live, and it matters)* - -| Host | Unit | enabled | active | -|---|---|---|---| -| rpi | `wg-quick@wg0` | **enabled** | **inactive** (interface was brought up manually) | -| rpi | `wg-quick@wg-remote` | enabled | active | -| rpi | `cloudflared` | enabled | active | -| siriussec | `wg-quick@wg0` | enabled | **inactive** (interface present, started manually) | -| linode | `wg-quick@wg0` | enabled | active | - -`wg0` on both rpi and siriussec is up but its unit is inactive — expected, because the interfaces were started with `wg-quick up` directly. Do **not** "fix" this by cycling the systemd unit: `/etc/wireguard/wg0.conf` on the Pi is **wgportal-autogenerated** with `SaveConfig = true`, so `systemctl stop` rewrites the file from the live interface and can drop peers. - -### 3.6 Health checks, hop by hop - -```bash -# On the Pi -sudo wg show # both interfaces, handshake ages -sudo wg show wg0 dump | wc -l # 4 = header + 3 peers -ip route get 10.10.0.2 # must say dev wg0 -ip route get 10.10.0.5 # must say dev wg-remote -curl -sk https://10.10.0.2:6443/version # 200 = API reachable over the mesh -kubectl get nodes # 3/3 Ready -``` - -### 3.7 Peer management — wgportal is **not** running - -The skill describes `wgportal/wg-portal:v2` as the peer manager on the Pi. **Live: there is no `wg-portal` container and no systemd unit.** `/opt/wgportal/` still holds `docker-compose.yml`, `config/`, `data/` (sqlite) and `ADMIN.txt`, and `/etc/wireguard/wg0.conf` still carries the wgportal `AUTOGENERATED FILE - DO NOT EDIT` header — but nothing is running it. **Peer changes today are manual**, applied to `/etc/wireguard/wg0.conf` (and the live interface) by hand. This is a real operational gap, not a documentation detail: there is currently no UI or API to add a peer. - ---- - -## 4. Ingress path - -``` -Internet - │ Cloudflare TLS (DNS + edge) - ▼ -Cloudflare Tunnel "sirius home" (id 6d0702eb-99cc-4062-b57d-e70e2f1a7895, healthy, 4 connections) - │ - ▼ -cloudflared (systemd on rpi, token-managed via /etc/systemd/system/cloudflared.service) - │ HTTP, origin override per hostname - ▼ -http://10.10.0.2:8080 ← siriussec - │ -Cilium Gateway "public" (class cilium, listener http:8080) - │ hostNetwork Envoy (DaemonSet cilium-envoy, node-role.kubernetes.io/gateway=true) - ▼ -HTTPRoute (hostname match, path match) → Service → Pod -``` - -*(live: tunnel identity from the Cloudflare API, tunnel config from `curl -s http://127.0.0.1:20241/config` on the Pi, gateway/routes from the cluster)* - -### 4.1 The origin is `10.10.0.2:8080` — and only that address serves - -The tunnel's ingress list maps **every** public hostname to `http://10.10.0.2:8080`, with `originRequest.httpHostHeader` set to the hostname so HTTPRoute host matching works. Verified per node from the Pi with a `Host:` header *(live)*: - -| Origin | `Host: siriusdevops.com` | Result | -|---|---|---| -| `10.10.0.2:8080` (siriussec) | **200** (and 200 for forgejo) | ✅ production origin | -| `10.10.0.1:8080` (rpi) | no listener (000 in <1 ms) **since 2026-10-27**; before that, **503 after exactly 5.0 s** | ✗ rpi is not a gateway node any more — no Envoy, no ports | -| `10.10.0.5:8080` (linode) | no listener (000) | ✗ no envoy there | - -Note that the `Gateway` **status advertises all three addresses** (`10.10.0.1`, `10.10.0.2`, `10.10.0.5`) even though the label is now on siriussec alone: Cilium fills `status.addresses` with every node InternalIP and ignores `spec.addresses` (cilium#29060). **Do not treat `status.addresses` as a load-balanced VIP or a "try either IP" list** — it is not a list of bound ports either; it is just the node address set. Only `10.10.0.2` has a listener. - -### 4.2 The co-location rule - -Envoy runs `hostNetwork` on the gateway-labelled nodes. **Before 2026-10-27 rpi carried the label too**, so it had a listener on `0.0.0.0:8080` and every request for a mapped hostname **hung 5 s and returned 503** there: the Envoy on rpi forwards to backend pods that live on siriussec's pod CIDR, sources the connection as `reserved:ingress` (`10.244.1.x`), and the SYN-ACK never completes under Cilium native routing. The measurable signature is the exact **5.000 s** and `503`. Fixed by removing the label from rpi (one gateway node, one serving address); the same 5 s/503 signature was making `10.10.0.1:8081`/`:8084` flap for phone clients, and it answered the same way from rpi's own `127.0.0.1`. - -Consequences: - -- **The Envoy that serves traffic must be on the node that holds the backend pods.** All app pods are on siriussec ⇒ the usable origin is siriussec, which is what the tunnel already points at. -- Don't "fix" a 503 by rescheduling the site pods to rpi to match the gateway node — they are amd64 images and rpi is arm64. -- Don't add a second listener on rpi, don't `ip addr add` the ingress IP on `cilium_host`, don't iptables-SNAT Envoy. BPF bypasses netfilter; those edits look plausible and do nothing. - -### 4.3 503 vs 404 - -- **404** = the Gateway has no HTTPRoute for that hostname (or a route's path prefix swallowed it). A Cloudflare-visible 404 on a hostname that *is* in the tunnel's ingress list means "tunnel fine, no route". -- **503** = a route exists but its backend Service has no ready endpoints. -- `paaas.siriusdevops.com` is currently mapped in the tunnel and returns **404 with 0 bytes** because no HTTPRoute claims it *(live)*. - -### 4.4 Live public hostnames - -*(read from the tunnel's own metrics port on rpi — `curl -s http://127.0.0.1:20241/config`)* - -| Hostname | Origin | HTTPRoute | Status (live origin check) | -|---|---|---|---| -| `siriusdevops.com` | `http://10.10.0.2:8080` | `siriusdevops/siriusdevops` | 200, 31813 B | -| `www.siriusdevops.com` | `http://10.10.0.2:8080` | same | 200 | -| `forgejo.siriusdevops.com` | `http://10.10.0.2:8080` | `forgejo/forgejo` | 200, 15008 B | -| `paaas.siriusdevops.com` | `http://10.10.0.2:8080` | **none** | **404** (0 B) | -| `piedmonthomesvc.com` | `http://10.10.0.2:8080` | `piedmont/piedmont` | 200, 7067 B | -| `www.piedmonthomesvc.com` | `http://10.10.0.2:8080` | same | 200 | -| `siriusgrowthsolutions.com` | `http://10.10.0.2:8080` | `sirius-growth/sirius-growth` | 200, 72640 B | -| `www.siriusgrowthsolutions.com` | `http://10.10.0.2:8080` | same | 200 | -| *(catch-all)* | `http_status: 404` | — | must stay last | - -A second, **inactive** tunnel named `piedmonthomesvc` (`bdcee200-7deb-4c8d-956b-2c030ebf7545`) still exists in the Cloudflare account, with zero connections. Only `sirius home` serves traffic; do not create another. - -### 4.5 Routes as configured *(live, `kubectl get httproute -A -o json`)* - -All four routes attach to `gateway-system/public`. First-match path ordering matters — the `/api/contact` rule comes **before** `/`: - -| Route | Path → backend | -|---|---| -| `forgejo/forgejo` | `/` → `forgejo:3000` | -| `siriusdevops/siriusdevops` | `/api/contact` → `siriusdevops-contact:8090`; `/` → `siriusdevops-site:80` | -| `piedmont/piedmont` | `/api/contact` → `piedmont-contact:8090`; `/` → `piedmont-site:80` | -| `sirius-growth/sirius-growth` | `/api/contact` → `sirius-growth-contact:8090`; `/api/portal` → `sirius-growth-portal:8091`; `/` → `sirius-growth-site:80` | - -A single `ReferenceGrant` exists (`gateway-system/forgejo`) for the cross-namespace route. - -### 4.6 Second gateway: `internal` - -`internal/internal` (namespace `internal`) and `internal/hubble-ui` are Cilium Gateways on **port 8081** and **8084**, `allowedRoutes: All`, with no tunnel mapping. It carries the WireGuard-only services. Both are reachable **by bare IP** (phones cannot edit `/etc/hosts`): **Grafana** `http://10.10.0.2:8081/` and **Hubble UI** `http://10.10.0.2:8084/`; the named URLs (`grafana.lab.internal`, `hubble.lab.internal`) are laptop conveniences only. Hubble UI has its own `Gateway internal/hubble-ui` because Cilium merges hostname-less routes that share a Gateway. The enforcement point is the *host* firewall on both gateway nodes (nft `table inet internal_gw` on siriussec, ufw rules above the LAN catch-all on rpi), not the Gateway: a listener port is reachable on every node address the moment it is Programmed. Full pattern, negative tests and the add-next-service recipe: `docs/internal-wireguard-services.md`. - -Neither hostname is in the cloudflared ingress list, and `*.lab.internal` resolves nowhere public — `Host: .lab.internal` on the public gateway (`10.10.0.2:8080`) answers **404**. - ---- - -## 5. Garage object storage - -*(live — Docker container on the Pi, `garage status`, `garage bucket list`)* - -**What it is:** the homelab's S3-compatible object store, used for photo and client-file buckets behind the public sites. - -| Property | Value | -|---|---| -| Where | **Docker container on `rpi`**, not in Kubernetes — image `dxflrs/garage:v1.1.0`, container `garage` | -| Compose | **`infrastructure/garage/` in this repo** (installed to `/etc/garage/docker-compose.yml`); state stays at `/home/sirius/websites/garage/`. Flux does not apply it — see that directory's README | -| State | `data/` (bind → `/data/data`) and `meta/` (bind → `/data/meta`); config `/etc/garage/garage.toml`, RPC secret `/etc/garage/garage.env` (0600, not in git) | -| Ports | `10.10.0.1:3900` S3 API and `10.10.0.1:3903` metrics (WireGuard only), `127.0.0.1:3900` host-local. No `0.0.0.0` publish. 3901 (RPC) and 3902 (`[s3_web]`) are no longer published at all | -| Firewall | `host/garage-firewall.nft` — nftables PREROUTING priority -140 drop for 3900-3903 from anything but `lo`/`wg0`/`wg-remote`. Docker's DNAT bypasses ufw's INPUT chain, so ufw alone cannot stop a compose typo | -| Capacity | 100 GB configured; `354.3 GB (36.0%)` data available (single healthy node `d053db4dfc97bf78`) | -| Buckets | `sirius-growth-photos`, `piedmont-photos`, `siriusdevops-media`, `sirius-growth-blog-media`, `sirius-growth-client-files` | -| Keys | one per consumer — `ci-push` (W only) and `site-fetch` (R only) on `siriusdevops-media`; the shared `ci-key` was deleted 2026-11-19 | -| Backup | hourly `meta` snapshot + nightly `data` rsync to `root@10.20.0.1:/root/garage-backup` (systemd timers) | -| Metrics | Prometheus target `job="garage"` scraping `10.10.0.1:3903`, `monitoring/controllers/home/garage.yaml` | - -**Exposure model:** every published port binds an explicit address, and the host firewall drops the rest before Docker can rewrite the packet. A pod on siriussec reaches the S3 API at `http://10.10.0.1:3900` over the mesh; the LAN and the internet see nothing (measured off-mesh from the Linode node: all of 3900-3903 filtered). - -**What breaks:** anything that assumes `127.0.0.1:3902` (the removed static web endpoint) is reachable from inside the pod network. It never was — a pod's `127.0.0.1` is its own netns — and the listener is now gone. Kubernetes workloads must use the `10.10.0.1:3900` S3 endpoint, or the in-image `/photos/` alias baked into the site images as a fallback. That alias is a deliberate fallback, **not** evidence the bucket is gone. - -### 5.1 A *second*, unrelated Garage node: the WAL archive on the Linode - -`infrastructure/garage-linode/` (not Flux-applied, like the Pi's) runs a -single-node Garage on the **Linode hub** and holds exactly one bucket, -`pg-wal-archive`, for CloudNativePG point-in-time recovery (§8.1, §8.3). - -| Property | Value | -|---|---| -| Where | Linode VPS (`linode` node), **podman** + quadlet `/etc/containers/systemd/garage.container` — there is no Docker on a kubelet node | -| Node | `994fd2f42ae72da6`, zone `dc1`, capacity **20 GB**, `replication_factor = 1` — a separate store with its own `node_key`, **not** a peer of the Pi's node | -| Endpoint | `http://10.10.0.5:3900` (S3) — the dummy-k8s WireGuard address, reachable from every pod over the mesh. `:3903` metrics, mesh-only, not scraped yet | -| Config | `garage.toml` binds those two addresses explicitly (no `0.0.0.0`), RPC secret from `/etc/garage/garage.env` (0600, not in git) | -| Firewall | nft `inet wal_archive_guard`, PREROUTING priority -140: accept `lo`/`wg0` (+ pod CIDR), drop everything else. ufw on this host is unrelated and stays as it is | -| State | `/var/lib/garage/{meta,data}`, covered by the nightly cluster-backup tree on the same host | -| Bucket | `pg-wal-archive` — private (`Website access: false`, anonymous GET → 403) | -| Keys | `cnpg-portal-wal` (`GK7f2b4bb1fc9abaec50fde37b`, RW on that bucket only) → Secret `sirius-growth/portal-wal-s3` | - -This node exists **because of where it is**, not because the estate needed a -second S3 service: a WAL archive on the Pi would sit in the same building, power -domain and uplink as the CNPG primary on siriussec. Off-site or it is not a -backup. - -Producer: the **CNPG-I Barman Cloud plugin** (`cnpg-system/barman-cloud`, -`ObjectStore sirius-growth/portal-wal`) — not the operator's deprecated in-tree -`barmanObjectStore`. The bucket, key and layout are unchanged (`portal/base/…`, -`portal/wals/…`), because the plugin appends the same barman server name -(`portal`) to the same `s3://pg-wal-archive` root. See §8.4. - ---- - -## 6. Workloads - -*(live — `kubectl get pods -A -o wide` at 19:0x UTC. **31 Running**, 6 Completed. This table is the running set, 31 rows.)* - -### 6.1 Running pods - -| # | Namespace | Pod | Node | IP | Purpose | Exposure | -|---|---|---|---|---|---|---| -| 1 | cnpg-system | `cnpg-controller-manager-78484bd58d-m6rtk` | siriussec | 10.244.0.183 | CloudNativePG operator (1.30.0) | internal | -| 2 | flux-system | `helm-controller-5788b55f98-zzgmw` | siriussec | 10.244.0.210 | Flux HelmRelease reconciler | internal | -| 3 | flux-system | `kustomize-controller-645cdc4b67-r2gl6` | siriussec | 10.244.0.30 | Flux kustomize reconciler (applies all YAML) | internal | -| 4 | flux-system | `notification-controller-7cd6d4994b-drh8x` | siriussec | 10.244.0.125 | Flux alerts/webhooks | internal | -| 5 | flux-system | `source-controller-56549698b5-2lvmc` | siriussec | 10.244.0.44 | Flux git artifact fetcher | internal | -| 6 | forgejo | `forgejo-67847d596c-jpb7x` | siriussec | 10.244.0.197 | Forgejo **16.0.5** git/CI/registry UI | **public** `forgejo.siriusdevops.com` | -| 7 | forgejo | `forgejo-runner-amd64-65fdfdf884-bb88l` | siriussec | 10.244.0.17 | Actions runner (dind sidecar), labels `docker-amd64`, `amd64` | internal | -| 8 | forgejo | `forgejo-runner-arm64-7566647d9f-7q2wk` | rpi | 10.244.1.128 | Actions runner via Pi host Docker socket, labels `docker-arm64`, `arm64`, `docker` | internal | -| 9 | forgejo | `forgejo-runner-deploy-arm64-b748d7c6f-66r5j` | rpi | 10.244.1.167 | Actions runner, label **`deploy-arm64` only** (site deploys) | internal | -| 10 | forgejo | `pg-1` | siriussec | 10.244.0.159 | CNPG PostgreSQL for Forgejo (1 instance) | internal | -| 11 | kube-system | `cilium-cz7w6` | siriussec | 10.10.0.2 (host-net) | Cilium agent v1.20.1 | internal | -| 12 | kube-system | `cilium-dswfb` | rpi | 10.10.0.1 (host-net) | Cilium agent v1.20.1 | internal | -| 13 | kube-system | `cilium-lst6f` | linode | 10.10.0.5 (host-net) | Cilium agent v1.20.1 | internal | -| 14 | kube-system | ~~`cilium-envoy-kfd7w`~~ | ~~rpi~~ | — | **gone 2026-10-27** — rpi lost `gateway=true`; a gateway node that cannot reach the backends only served 5 s/503 (§4.2) | — | -| 15 | kube-system | `cilium-envoy-q2jn8` | siriussec | 10.10.0.2 (host-net) | Gateway data plane — **the one serving public traffic** | **public** (8080) | -| 16 | kube-system | `cilium-operator-6fc68c64d6-cw4rj` | siriussec | 10.244.0.2x | Cilium operator (leader election) | internal | -| 17 | kube-system | `coredns-589f44dc88-l28hh` | siriussec | 10.244.0.109 | cluster DNS (1 of 2) | internal | -| 18 | kube-system | `coredns-589f44dc88-xtzqq` | siriussec | 10.244.0.114 | cluster DNS (2 of 2) | internal | -| 19 | kube-system | `etcd-siriussec` | siriussec | 10.10.0.2 (host-net) | cluster datastore (static pod) | internal | -| 20 | kube-system | `kube-apiserver-siriussec` | siriussec | 10.10.0.2 (host-net) | API server `:6443` (static pod) | overlay + pod CIDR only | -| 21 | kube-system | `kube-controller-manager-siriussec` | siriussec | 10.10.0.2 (host-net) | controller manager (static pod) | internal | -| 22 | kube-system | `kube-scheduler-siriussec` | siriussec | 10.10.0.2 (host-net) | scheduler (static pod) | internal | -| 23 | local-path-storage | `local-path-provisioner-84f56599d-p9d6x` | siriussec | 10.244.0.63 | dynamic local PV provisioning | internal | -| 24 | piedmont | `piedmont-contact-7897cf4d4-z764g` | siriussec | 10.244.0.86 | PHS contact-form API (Telegram) | `/api/contact` on `piedmonthomesvc.com` | -| 25 | piedmont | `piedmont-site-66cbdd498d-tx2gc` | siriussec | 10.244.0.94 | PHS static site (nginx) | `piedmonthomesvc.com` | -| 26 | sirius-growth | `portal-1` | siriussec | 10.244.0.173 | CNPG PostgreSQL for SGS portal (1 instance) | internal | -| 27 | sirius-growth | `sirius-growth-contact-5448485967-n2flh` | siriussec | 10.244.0.219 | SGS contact API | `/api/contact` on `siriusgrowthsolutions.com` | -| 28 | sirius-growth | `sirius-growth-portal-89d598f55-pwf74` | siriussec | 10.244.0.146 | SGS customer portal (`:8091`) | `/api/portal` | -| 29 | sirius-growth | `sirius-growth-site-757d4f96b6-wcnpn` | siriussec | 10.244.0.170 | SGS marketing site (nginx) | `siriusgrowthsolutions.com` | -| 30 | siriusdevops | `siriusdevops-contact-b5df76cd4-b98sb` | siriussec | 10.244.0.244 | SiriusDevOps contact API | `/api/contact` on `siriusdevops.com` | -| 31 | siriusdevops | `siriusdevops-site-566968fffb-52z5n` | siriussec | 10.244.0.85 | SiriusDevOps site (nginx) | `siriusdevops.com` | - -Nothing runs on `linode` except its Cilium agent. `rpi` runs only the two runners plus its Cilium/Envoy agents. - -### 6.2 Completed / non-running pods (6) - -`forgejo/forgejo-67847d596c-xn2br` (old ReplicaSet, `Completed`, 42 d — harmless residue), three `forgejo-runner-prune-*` Job pods (the nightly docker-prune CronJob), and `kube-system/{curl-test,test}` (41 d one-off probes). - -### 6.3 Namespaces - -| Namespace | Age | Contents | -|---|---|---| -| `kube-system` | 45 d | control plane, Cilium, Envoy, CoreDNS, hubble-relay + hubble-ui | -| `kube-public`, `kube-node-lease`, `default` | 45 d | kubeadm defaults | -| `forgejo` | 45 d | Forgejo, its CNPG cluster, 3 runners, prune CronJob | -| `cnpg-system` | 45 d | CloudNativePG operator **+ the CNPG-I Barman Cloud plugin** (`barman-cloud`, §8.4) | -| `cert-manager` | 1 m | cert-manager v1.21.3 (controller + webhook + cainjector) — installed for the Barman Cloud plugin's mTLS pair, §8.4 | -| `monitoring` | 1 d | kube-prometheus-stack: Prometheus (7d/8GB), Grafana, kube-state-metrics, node-exporter | -| `flux-system` | 41 d | 4 Flux controllers, GitRepository, 7 Kustomizations (`flux-system`, `gateway-api-crds`, `cert-manager`, `databases`, `infrastructure`, `monitoring`, `apps`) | -| `gateway-system` | 45 d | Gateway `public` | -| `internal` | 41 d | Gateways `internal` (8081) and `hubble-ui` (8084) | -| `local-path-storage` | 45 d | provisioner | -| `siriusdevops` | 43 d | site + contact | -| `piedmont` | 26 d | site + contact | -| `sirius-growth` | 8 d | site + contact + portal + CNPG cluster | -| `cilium-secrets` | 45 d | Gateway TLS/secret sync target | - -### 6.4 Forgejo Actions runners - -**Three** runners, all registered against `https://forgejo.siriusdevops.com` (never an in-cluster URL — the checkout URL must resolve from inside job containers). - -| Deployment | Node | Docker access | `runs-on` labels | Config | -|---|---|---|---|---| -| `forgejo-runner-arm64` | rpi | Pi **host** socket `/var/run/docker.sock` + host `docker-static` binary + cli-plugins | `docker-arm64`, `arm64`, **`docker`** | CM `forgejo-runner-config` key `arm64.toml`; `capacity 1`; root + privileged; pod `supplementalGroups: [984]`; **no `docker_host`** (would duplicate the socket mount) | -| `forgejo-runner-amd64` | siriussec | privileged `docker:27-dind` sidecar, PVC `forgejo-runner-amd64` (20 Gi) | `docker-amd64`, `amd64` | key `amd64.toml`; `capacity 1`; `docker_host: unix:///var/run/docker.sock` | -| `forgejo-runner-deploy-arm64` | rpi | Pi host socket, same bind mounts | **`deploy-arm64` only** | key `deploy-arm64.toml`; `capacity 1`; `timeout 30m`; state on hostPath `/opt/siriusdevops/runner-deploy/data` | - -Label discipline that must not be broken: - -- `docker` lives **only** on the Pi arm64 runner, so legacy `runs-on: docker` jobs stay arm64. x86 builds must say `docker-amd64`. -- `deploy-arm64` is disjoint from the CI labels in both directions, so a 20–40 minute onionwire Rust build on the shared Pi runner (capacity 1) can no longer starve `deploy-site`. Residual coupling: `deploy-portal.yml` still uses `docker-amd64`, which a site build also uses. -- `capacity: 1` everywhere is load-bearing, not conservatism: the amd64 dind is one daemon (two concurrent builds starve and `apt` loops on `Ign:`), and the arm64 runner serialises writes into the shared `onionwire-target-ci` volume. - -Workflow labels actually present in the local checkouts *(live grep of `.forgejo/workflows`)*: `docker` (×8) and `docker-amd64` (×3) in `onionwire`; `deploy-arm64`, `docker-amd64` in `sirius-growth`; `docker-amd64` in `siriusdevops-contact`. - -### 6.5 Nightly disk reclamation (`forgejo/forgejo-runner-prune`) - -`apps/base/forgejo/prune-cronjob.yaml`, `17 4 * * *` **UTC** (the repo's one CronJob timezone convention), `concurrencyPolicy: Forbid`, `startingDeadlineSeconds: 1800`, `backoffLimit: 1`, `activeDeadlineSeconds: 3600`. - -**Two containers, because there are two kinds of daemon.** `host-daemon` (`docker:27-cli`) mounts the Pi's `/var/run/docker.sock`; `dind-daemons` (`alpine/k8s:1.36.4`) discovers in-cluster dind daemons — pods with label `app=forgejo-runner` **that have a container named `dind`** — and runs the same prune logic inside each over the exec API. The ServiceAccount `forgejo-prune` has only `pods get,list` and `pods/exec create` in namespace `forgejo`. No pod names are in the manifest, so the two arm64 dind daemons from the arm64 migration are picked up the first night they exist (proved by creating an unrelated `app=forgejo-runner` dind pod: the job reported `found=2 pruned=2`). - -**Retention.** Exited containers > 48 h, unused **Pi-host** images > 168 h (a week of rollback for the sites). Build cache is capped at **20 GB** on the Pi host and **4 GB** per dind daemon; above the cap the script walks `--filter until=` down from 72 h to 0 s and stops as soon as the cache is under the cap, so the newest layers survive and a cold cache is the last resort. In-cluster images are **dangling-only** pruned: an `until` filter on a *pulled* image compares the upstream build date, so it would delete `node:20-bullseye` / `rust:*-bookworm` every night and make every job cold. - -**Named volumes are never pruned** (`docker volume prune` is forbidden): `onionwire-target-ci` (95.8 GB on the Pi), the Android SDK/Gradle/cargo-registry volumes and the cargo registries are shared CI state. Every run prints `docker system df -v` per daemon so growth is recorded before it becomes an outage. The Pi host currently holds **33 volumes / 169.7 GB, 48.67 GB reclaimable**; capping any of them is a separate decision. - -**Busy guard.** A daemon with a running container is skipped and the Job still exits 0: on the dind daemons *any* running container counts (they have none when idle), on the Pi host a running container younger than 180 min counts (the standing containers — `sirius-growth-site`, `handyman-site`, `garage`, `registry` — are days old, so no name whitelist is needed). A busy night is not a red job; a *missing* night is what alerts. - -Force a run (safe any time; it self-skips when busy): - -```bash -kubectl -n forgejo create job --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s) -kubectl -n forgejo logs job/prune-manual- -c host-daemon # Pi daemon -kubectl -n forgejo logs job/prune-manual- -c dind-daemons # every dind daemon -``` - -**Two premises worth writing down, because the code depends on them** (both verified 2026-10-27): - -- The build-cache *capacity* flags are a no-op on this buildx (0.20.1). `--keep-storage`, `--max-storage` (rejected: unknown flag) and `--max-used-space` all report `Total: 0B` with a cache over the cap — a 21.44 GB cache with `--max-used-space 20GB`, and a 541 MB cache with `--max-used-space 100MB`. `--filter until=` *does* reclaim (541 MB → 0 with `until=0s`), which is why the cap is enforced by walking age windows. -- **Per-PVC usage is not measurable on this cluster, and no alert pretends otherwise.** `kubelet_volume_stats_*` was an ALPHA metric set served from kubelet's `/metrics/volumes` endpoint; on kubelet v1.36.4 that endpoint returns **404 on all three nodes** (`/metrics`, `/metrics/probes`, `/metrics/cadvisor`, `/metrics/resource` all return 200) and `/metrics` carries no volume-stats series — the upstream loss in kubelet 1.34 (kubernetes/kubernetes#133847, fix #133890), not a hostPath quirk. There is therefore no scrape config that can produce those series; re-deriving them would need a new exporter parsing kubelet's `/stats/summary` JSON (new Deployment + `nodes/stats` RBAC). The old `RunnerDindPvcHighWatermark` / `RunnerDindPvcCritical` rules were deleted for selecting a metric with no producer, and replaced by runner-scoped filesystem rules — see below. The chart's own per-PVC pair went the same way: kube-prometheus-stack's `kubernetes-storage` group (`KubePersistentVolumeFillingUp`, `KubePersistentVolumeInodesFillingUp`, both severities) used to select `kubelet_volume_stats_*` too, and its four rules are now suppressed with `defaultRules.disabled` in `monitoring/controllers/home/values.yaml` (`KubePersistentVolumeFillingUp: true`, `KubePersistentVolumeInodesFillingUp: true`) — one key disables both severities of a rule. `count(kubelet_volume_stats_used_bytes)` returns **0 series**, and a rule that registers `health=ok, state=inactive` on a missing metric reads as "no PVC is filling" when nothing can fire at all. The group's fifth rule, `KubePersistentVolumeErrors`, is *not* dead (kube-state-metrics `kube_persistentvolume_status_phase`, 40 series here), so it is deliberately left enabled — the group survives with one live rule instead of being dropped whole. Verify with `kubectl -n monitoring get prometheusrule kube-prometheus-stack-kubernetes-storage -o json` (one rule left) and `curl /api/v1/rules`. - -**Alerts** (`PrometheusRule monitoring/forgejo-prune`, label `release: kube-prometheus-stack`): `ForgejoPruneCronJobStale` (last success > 26 h, or the series absent), `ForgejoPruneJobFailed` (`kube_job_status_failed` for `forgejo-runner-prune-*` > 0 — `kube_job_failed` no longer exists), `NodeFilesystemFillingUp` / `NodeFilesystemCritical` (root fs > 85 % / > 92 % per node, joined to the hostname via `node_uname_info`), plus the node-filesystem guards that replaced them: `RunnerDindDiskHighWatermark` / `RunnerDindDiskCritical` (root fs > 80 % / > 90 % on nodes that run a `forgejo-runner` pod — joined node → `node_uname_info.nodename` → `kube_pod_info.node`, rpi excluded), and `RpiDindDataRootFillingUp` (group `dind-disk-cap`, rpi root fs > 70 %, because it carries 240 GiB of dind PVCs on a 917 G disk). The dind data-root is a plain directory under `/opt/local-path-provisioner` on that filesystem, so filesystem fill is the only honest per-runner signal. Alertmanager is disabled in this stack, so they surface in Prometheus → Alerts and Grafana → Alerting, not as pages. - ---- - -## 7. CI/CD flow - -**Application images** - -``` -git push → Forgejo Actions - ├─ arm64 / docker jobs → forgejo-runner-arm64 (rpi, host docker) - ├─ x86_64 jobs → forgejo-runner-amd64 (siriussec, dind) - └─ site deploys → forgejo-runner-deploy-arm64 (rpi) - → image pushed to the Forgejo registry (forgejo.siriusdevops.com/sirius/:latest) - → Deployments use imagePullPolicy: Always, so the pod must be recreated - (rollout restart alone can keep the old digest — verify the pod's imageID) -``` - -**Cluster manifests** - -``` -edit apps/base//* → push to sirius/homek8s master - → Flux GitRepository polls (interval 1m) → artifact at new SHA - → kustomization infrastructure (path ./infrastructure/home) - → kustomization apps (path ./apps/home, dependsOn infrastructure) -``` - -New app = new `apps/base//` (namespace, Deployment, Service, HTTPRoute) **plus** one line in `apps/home/kustomization.yaml`. New public hostname = that HTTPRoute **plus** one ingress entry on the existing `sirius home` tunnel. - -Force a recheck when Flux's status line is stale (a push is not applied until the GitRepository artifact is that SHA): - -```bash -kubectl -n flux-system annotate gitrepository flux-system \ - reconcile.fluxcd.io/requestedAt="$(date +%s)" --overwrite -kubectl -n flux-system annotate kustomization apps \ - reconcile.fluxcd.io/requestedAt="$(date +%s)" --overwrite -``` - -**Live Flux state:** GitRepository `flux-system` → `https://forgejo.siriusdevops.com/sirius/homek8s`, Ready, artifact `master@sha1:d5d1d28`; all five Kustomizations (`flux-system`, `gateway-api-crds`, `databases`, `infrastructure`, `apps`) `Ready=True` on the same revision. Cilium is managed as a HelmRelease **by Flux** — never `helm upgrade` it by hand. - -Repository layout: - -``` -clusters/homek8s/ flux-system GitRepository + 5 Kustomizations -infrastructure/home/ entrypoint for infra (cilium, gateway, storage) -infrastructure/databases/base/ CloudNativePG 1.30.0 operator, vendored + patched - (own Flux Kustomization `databases`, prune: false — CRDs) -apps/home/ forgejo, siriusdevops, piedmont, sirius-growth -monitoring/controllers/home/ (present in repo, NOT deployed — no monitoring namespace exists) -``` - ---- - -## 8. Storage and data - -*(live — `kubectl get pvc,pv -A`, `du` on siriussec)* - -StorageClass `local-path` (default, `WaitForFirstConsumer`, no expansion), provisioner pinned to siriussec, root `/opt/local-path-provisioner`. - -| PVC | NS | Size | On-disk dir | Used | Holds | -|---|---|---|---|---|---| -| `forgejo-data` | forgejo | 20 Gi | `pvc-75ba7bc3…_forgejo_forgejo-data` | **19 G** | Forgejo repos, LFS, avatars, attachments (13.6 G of that is package-registry blobs) — **backed up nightly** | -| `forgejo-runner-amd64` | forgejo | 20 Gi | `pvc-b867904c…_forgejo_forgejo-runner-amd64` | **22 G** (the dind `/docker` data-root) | CI scratch — **disposable**, but see the hazard below | -| `pg-1` | forgejo | 10 Gi | `pvc-3c0ba824…_forgejo_pg-1` | 653 M | Forgejo Postgres data — **backed up nightly (pg_dump)** | -| `portal-1` | sirius-growth | 5 Gi | `pvc-3348c52c…_sirius-growth_portal-1` | 595 M | SGS portal Postgres data — **backed up nightly (pg_dump)** | -| `osint-pgdata` / `osint-camera-snapshots` | osint | 15 Gi / 3 Gi | — | 289 M / 4 K | plain Postgres — **backed up nightly (pg_dump)**; the camera snapshot dir is 4 K of throwaway frames — **accepted gap** | -| `sgs-leadgen-data` | sirius-growth | 1 Gi | — | 4.9 M | lead-gen capture — **mirrored nightly** | -| `kube-prometheus-stack-grafana` | monitoring | 5 Gi | — | 55 M | Grafana sqlite: users/orgs/prefs/API keys/annotations (dashboards, datasources and alert rules are provisioned from git, so they are *not* in the db) — **snapshotted nightly** | -| `…prometheus-…-db-…prometheus-0` | monitoring | 10 Gi | — | 2.4 G | Prometheus TSDB — rebuildable metrics history, **not backed up** | - -**Dind growth hazard.** The amd64 runner's PVC is nominally 20 Gi and currently sits at **~22 G**: it has previously grown to ~50 GB from heavy Android/Rust builds and pushed the node into `DiskPressure`, which evicted the runner and left Forgejo and `pg-1` Pending. Docker image GC does not reclaim the data-root. Rule: when it approaches the cap, scale the runner to 0 **first**, then wipe `.../docker/*` (keeping `runner.ini` beside it), then scale back and re-pull the job image — wiping it under a live or restarting pod leaves `dockerd` half-initialised and every pull fails. Note the data-root also hosts the named volumes CI depends on (`cargo-target`, Android SDK, Gradle cache), so a wipe makes the next run fully cold. - -Host disks *(live)*: siriussec `/` 214 G, 167 G used (**83 %**, 37 G free); rpi `/` 917 G, 506 G used (58 %, 374 G free); linode `/` 79 G, 29 G used (**39 %**, 46 G free — this is the backup target, and since 2026-11-19 it also hosts the `pg-wal-archive` Garage node). - -### 8.1 Backup coverage - -Five independent scheduled paths, all **off** the T480 and **off** the Pi: - -1. **Cluster state → Linode VPS**, CronJob `forgejo/cluster-backup` - (`apps/base/forgejo/cluster-backup.yaml`; exec-only RBAC in - `apps/base/sirius-growth/backup-exec-rbac.yaml` and - `apps/base/osint/backup-exec-rbac.yaml`). Schedule `37 2 * * *` - UTC, `concurrencyPolicy: Forbid`. Destination is - `root@10.10.0.5:/root/cluster-backup` — **the mesh address, never the public - IP**. Everything is streamed: no dump is staged on siriussec. -2. **Two small PVC mirrors into the same tree**, because a PVC can only be - mounted by a pod in its own namespace: `monitoring/grafana-backup` - (`monitoring/controllers/home/grafana-backup.yaml`, `0 3 * * *`) and - `sirius-growth/leadgen-backup` (`apps/base/sirius-growth/leadgen-backup.yaml`, - `7 3 * * *`). Both mount the claim on siriussec and stream to - `root@10.10.0.5:/root/cluster-backup`, so retention and the manifest habit - are shared with path 1. -3. **Garage object store (Pi) → same Linode**, `infrastructure/garage/backup/` - `garage-meta-backup.timer` (hourly) + `garage-data-backup.timer` (nightly) → - `root@10.20.0.1:/root/garage-backup`. -4. **Point-in-time recovery for `sirius-growth/portal`**, continuous WAL archiving - + a daily base backup straight from the **CNPG-I Barman Cloud plugin** into a - **second Garage node running on the Linode** (`infrastructure/garage-linode/`, - bucket `pg-wal-archive`, bucket-private, `10.10.0.5:3900` WireGuard-only). This - is the only path with a **sub-24 h RPO**: recovery to any second inside the last - 14 days, not just "the state at 02:37". Config: - `apps/base/sirius-growth/objectstore-portal-wal.yaml` (`ObjectStore portal-wal`, - store + `retentionPolicy: 14d`), the Cluster's `spec.plugins` - (`barman-cloud.cloudnative-pg.io`, `isWALArchiver: true`, `serverName: portal`) - and `apps/base/sirius-growth/scheduled-backup.yaml` (`ScheduledBackup - portal-daily`, `20 3 * * *` UTC in **six**-field cron, seconds first, - `method: plugin`). The plugin Deployment itself is vendored in - `infrastructure/databases/base/` (§8.4). - -A fifth path covers the Pi's own hub state: `infrastructure/wireguard/backup/` -`wireguard-backup.timer` (nightly 04:13) → `root@10.20.0.1:/root/pihost-backup`. - -| Artifact | Method | On the Linode | Retention | -|---|---|---|---| -| `forgejo-data` PVC (`/data`) | `rsync -a --delete --link-dest` snapshot mirror, PVC mounted read-only | `forgejo-data//` + `latest` symlink | 7 snapshots (hardlinked: 1 full copy + nightly deltas) | -| `forgejo/pg` | `pg_dump -Fc -Z6` **inside the CNPG primary** over the local socket — no DB password exists in git or in the Job | `db/forgejo-pg-.dump` | 14 | -| `sirius-growth/portal` | two independent copies, on purpose. **(a)** `pg_dump -Fc -Z6` **inside the CNPG primary** over the local socket, through exec RBAC in `sirius-growth` — logical, human-readable with any `pg_restore`. **(b)** barman-cloud **continuous WAL archive + daily base backup** through the CNPG-I plugin (path 4) | (a) `db/sirius-growth-portal-.dump`; (b) `pg-wal-archive` bucket on the Linode: `portal/base//` + `portal/wals/…` | (a) 14 dumps; (b) 14 days of WAL (`ObjectStore.spec.retentionPolicy: 14d`) | -| `osint/osint-db` (plain Postgres Deployment, has TimescaleDB + PostGIS) | `pg_dump -Fc -Z6` **inside the pod** over the local socket, using its own `POSTGRES_USER`/`POSTGRES_DB` via exec RBAC in `osint` | `db/osint-osint-db-.dump` | 14 | -| `grafana.db` (sqlite) | **sqlite backup API** in a `python:3.12-alpine` pod that mounts the PVC — a `cp` of a live db can capture a torn page; the image is `-distroless`, so there is no shell to exec into | `grafana/grafana-.db` | 14 | -| `sgs-leadgen-data` PVC | `rsync -a --delete --link-dest` snapshot mirror, PVC mounted read-only | `leadgen-data//` + `latest` | 7 | -| Pi `/etc/wireguard/` + wgportal `sqlite.db` | Pi-side systemd timer: tarball (`/etc/wireguard` verbatim incl. `.bak` history + a sqlite-API copy of the peer db), sha256 checked on both sides | `root@10.20.0.1:/root/pihost-backup/wireguard/wireguard-.tar.gz` | 14 | - -- The data mirror is a *snapshot* mirror, not a rolling one: each night writes a - new directory whose unchanged files are hardlinks to the previous night's, so - a corrupted file in the source cannot rewrite history. -- DB dumps are checksummed on **both** sides (`sha256sum` on the pod's copy of - the stream vs the remote file) before the `.part` file is renamed; a short - stream fails the Job instead of silently shipping a broken archive. -- Each run appends sizes + checksums to `/root/cluster-backup/manifests/.txt`. -- The Job fails (a red Job, not a silent skip) if the Linode has less than - 8 GiB free, so a growing registry cannot quietly eat the last snapshot's room. -- The only secret is the backup SSH key: `forgejo/cluster-backup-ssh` (created - out of band, **not in git**, so Flux never reverts it) holding an ed25519 key - that is `from="10.10.0.0/24,10.244.0.0/16,10.20.0.0/24"`-restricted, - `no-pty`, no forwarding in `root@linode:~/.ssh/authorized_keys`. Host key is - pinned (`known_hosts` for `10.10.0.5`), so a MITM on the mesh fails closed. -- The Job lives in namespace `forgejo` (not a `backup` namespace) because a PVC - cannot be mounted cross-namespace and `forgejo-data` is the largest artifact. - -- **The WAL archive lives in a second Garage node on the Linode, and only there.** - Pointing barman at the Pi's Garage would put the archive in the same building, - power domain and uplink as the CNPG primary — a second copy of the same - failure. `infrastructure/garage-linode/` is a *separate* single-node store - (node `994fd2f42ae72da6`, capacity 20 GB, no relation to the Pi's - `d053db4dfc97bf78`): podman + a quadlet unit (this host has no Docker — it is a - kubelet node), `garage.toml` binding `10.10.0.5:3900`/`:3903` only, and an nft - table `inet wal_archive_guard` (PREROUTING -140) that drops 3900/3903 from - anything but `lo`/`wg0`. Measured off-mesh (from this laptop, straight to the - Linode's public IP, no VPN in the path): 3900 and 3903 **filtered**, and the - drop counter increments. Anonymous S3 GET on the bucket → **403 AccessDenied**. -- **Disk sizing for the WAL archive** *(measured 2026-11-19)*: Linode `/` is 79 G - with **46 G free**; Garage is capped at 20 GB. Actual usage after the first - base backup + 7 WAL segments: **4.9 MB** in 8 bucket objects (`data/` 9.3 MB - with Garage's block-store overhead, `meta/` 4.6 MB). `archive_timeout` is 5 min - and `wal_segment_size` 16 MB, so the archive takes at most 288 segments/day; - gzip turns a segment into 16–25 KB when the database is quiet (measured) → - ~6 MB WAL/day + a 4.5 MB base backup/day ≈ **150 MB for the whole 14-day - window**. Worst case on a busy database (every segment full at a typical 3–5× - gzip ratio) is ~1.5 GB/day → 21 GB for 14 days, i.e. it would hit the 20 GB - cap. The cap is deliberate: Garage answers `507 InsufficientStorage` and - barman-cloud fails loudly (a red `Backup`/`ScheduledBackup`) rather - than filling the Linode disk. If that ever fires, the lever is - `ObjectStore portal-wal` → `spec.retentionPolicy` (7d) — not deleting WALs by - hand. -- **The barman credentials are a namespaced Secret, not git**: - `sirius-growth/portal-wal-s3` (`ACCESS_KEY_ID` / `ACCESS_SECRET_KEY` / - `REGION`), created out of band from Garage key `cnpg-portal-wal` - (`GK7f2b4bb1fc9abaec50fde37b`, scope **read+write on `pg-wal-archive` only**, - no bucket-create). Recording key IDs is fine; the values are not in git, in the - docs, or in any comment. -- **The 1.31 gate is closed — WAL archiving runs on the CNPG-I plugin, not the - in-tree path.** CNPG 1.30 deprecated `spec.backup.barmanObjectStore` and warns - on every apply that 1.31 removes it. `sirius-growth/portal` was migrated on - **2026-11-19** (kanban `t_5df331de`) to the Barman Cloud plugin - (`infrastructure/databases/base/upstream/plugin-barman-cloud-0.16.0.yaml`, - Deployment `cnpg-system/barman-cloud`, `ObjectStore sirius-growth/portal-wal`, - `Cluster.spec.plugins`, `ScheduledBackup.method: plugin`), so bumping the - operator pin from 1.30.0 to 1.31 no longer breaks archiving or PITR. The bucket - layout did not move: `portal/base` + `portal/wals` are the same objects the - in-tree archiver wrote, and the restore rehearsal in §8.3 ran against that - mixed archive. The plugin needs cert-manager (its mTLS pair is an - `Issuer` + two `Certificate`s), installed as `cert-manager` HelmRelease v1.21.3 - — see §8.4. - -**Accepted gaps (with the reason, not just a TODO):** - -- **Prometheus TSDB** (2.4 GiB) — deliberately excluded: regenerated metrics - history, and a volume loss only costs graphs, not state. -- **`osint/osint-camera-snapshots`** (4 K) — throwaway camera frames; the - camera re-captures on demand and nothing reads old frames. -- **Runner PVCs** (`forgejo-runner-amd64`, `*-dind`) — CI scratch, rebuildable - by design (the dind data-root only holds named build caches). -- **Grafana dashboards / datasources / alert rules are not in the backup and do - not need to be**: they are provisioned from `monitoring/controllers/home/` - in git. The sqlite db carries the parts git cannot rebuild — users, orgs, - preferences, annotations and API keys. -- **Pi `/etc/wireguard` is only as fresh as the last nightly run** — a peer - added today is in the db and on the Pi, and reaches the Linode at 04:13. - -**Closed 2026-11-19 — point-in-time recovery.** There is no longer a "restore to -02:37 or lose the day" gap: `sirius-growth/portal` can be recovered to any second -inside the 14-day window, and that restore has been rehearsed end to end (§8.3). -`forgejo/pg` is deliberately **not** on barman yet — a day of git history is -annoying, not costly, and one cluster proves the pattern; `osint/osint-db` is a -plain Deployment and cannot use CNPG backup at all. - -A new CloudNativePG cluster is **not** picked up automatically by either -mechanism. For dumps: add `/` to `CNPG_TARGETS` in the CronJob env -*and* an equivalent exec-only Role/RoleBinding for the `forgejo/cluster-backup` -ServiceAccount in that namespace. For WAL archiving: create an `ObjectStore` in -that namespace whose `spec.configuration.destinationPath` is -`s3://pg-wal-archive` (the bucket root — the plugin appends the barman server -name, which defaults to the cluster name, so clusters share one bucket without -colliding), point its `s3Credentials` at a `sirius-growth/portal-wal-s3`-shaped -Secret in that namespace, give it its own `retentionPolicy`, add -`spec.plugins: [{name: barman-cloud.cloudnative-pg.io, isWALArchiver: true, -parameters: {barmanObjectName: }}]` to the Cluster and a -`ScheduledBackup` with `method: plugin`. - -### 8.2 Restoring - -Rehearsed on 2026-11-19 (see the completion note on task `t_dcad85f6`); the DB -restore below was exercised against a throwaway Postgres pod and produced the -live row count. - -```bash -# 1. Forgejo data: stop Forgejo, then mirror the newest snapshot back. -kubectl -n forgejo scale deploy/forgejo --replicas=0 -# on the node holding the PVC (siriussec), or from any pod that mounts it: -# rsync -a --delete root@10.10.0.5:/root/cluster-backup/forgejo-data/latest/ /data/ -kubectl -n forgejo scale deploy/forgejo --replicas=1 - -# 2. A CNPG database: pull the dump and restore it with pg_restore, e.g. into a -# scratch pod or a scratch database on the cluster: -ssh root@10.10.0.5 'cat /root/cluster-backup/db/forgejo-pg-.dump' \ - | kubectl -n forgejo exec -i -c postgres -- \ - pg_restore -U postgres -d --no-owner --no-privileges -``` - -`pg_restore` is **not** installed on the Linode — pull the dump and restore with -a Postgres client (the `ghcr.io/cloudnative-pg/postgresql:16` primary has one). - -```bash -# 3. osint-db (plain Postgres **with TimescaleDB**): a naive pg_restore into a -# fresh database fails on hypertable catalog rows ("could not find hypertable -# with id N" / "ONLY option not supported on hypertable operations") and -# silently drops one hypertable's data. Pre/post-restore commands are -# mandatory, and the extensions must exist BEFORE them. -kubectl -n osint exec deploy/osint-db -- psql -U osint -d postgres \ - -c 'create database osint_restore' -kubectl -n osint exec deploy/osint-db -- psql -U osint -d osint_restore \ - -c 'create extension if not exists timescaledb' \ - -c 'create extension if not exists postgis' \ - -c 'select timescaledb_pre_restore()' -ssh root@10.10.0.5 'cat /root/cluster-backup/db/osint-osint-db-.dump' \ - | kubectl -n osint exec -i deploy/osint-db -- \ - pg_restore -U osint -d osint_restore --no-owner --no-privileges -kubectl -n osint exec deploy/osint-db -- psql -U osint -d osint_restore \ - -c 'select timescaledb_post_restore()' - -# 4. Grafana: readable with the sqlite backup API and integrity_check=ok. -# Stop Grafana first (it also runs `strategy: Recreate`) so the restored file -# is not overwritten by the running instance's open handle. -kubectl -n monitoring scale deploy/kube-prometheus-stack-grafana --replicas=0 -ssh root@10.10.0.5 'cat /root/cluster-backup/grafana/grafana-.db' \ - | kubectl -n monitoring exec -i -- \ - sh -c 'cat > /var/lib/grafana/grafana.db && chown 472:472 /var/lib/grafana/grafana.db' -kubectl -n monitoring scale deploy/kube-prometheus-stack-grafana --replicas=1 -# Users come back from the db; dashboards/datasources re-provision from git. - -# 5. Lead-gen capture: plain mirror — pull it back onto the claim with rsync. -rsync -a --delete root@10.10.0.5:/root/cluster-backup/leadgen-data/latest/ /leadgen/ - -# 6. Pi hub state (keys included — pull it to a root-only path, never a shared one). -ssh -i /home/sirius/.ssh/linode_admin root@10.20.0.1 \ - 'cat /root/pihost-backup/wireguard/wireguard-.tar.gz' | sudo tar -tzf - -# stop wg-quick first: SaveConfig = true rewrites wg0.conf from the live iface -sudo wg-quick down wg0 || true -ssh -i /home/sirius/.ssh/linode_admin root@10.20.0.1 \ - 'cat /root/pihost-backup/wireguard/wireguard-.tar.gz' | sudo tar -xzf - -C / -sudo systemctl start wg-quick@wg0 && sudo wg show -``` - - -### 8.3 Point-in-time recovery (`sirius-growth/portal`) - -Rehearsed end to end twice: **2026-11-19** with the in-tree barman-cloud archiver -(task `t_ce7d6772`) and again the same day **on the CNPG-I Barman Cloud plugin** -(task `t_5df331de`, §8.4) — marker row → forced WAL switch → unwanted row → -forced WAL switch → throwaway cluster restored with `targetTime` between the -two. Both times the marker came back and the later row did not. - -**Step 1 — establish the target time.** Take it from the data, never from -memory: - -```bash -kubectl -n sirius-growth exec portal-1 -c postgres -- \ - psql -U postgres -d portal -tAc "select max(updated_at) from leads" # or pg_last_xact_replay_timestamp-style reasoning -date -u +%FT%TZ -``` - -**Step 2 — restore into a throwaway cluster.** Never into `portal` itself while -it is serving: CNPG recovery bootstraps a *new* data dir from the archive. -`externalClusters[].plugin` replaces `barmanObjectStore`; `serverName` is the -barman prefix and must stay the **source** cluster name. - -```yaml -apiVersion: postgresql.cnpg.io/v1 -kind: Cluster -metadata: - name: portal-pitr-test - namespace: sirius-growth -spec: - instances: 1 - imageName: ghcr.io/cloudnative-pg/postgresql:16 - storage: {size: 5Gi, storageClass: local-path} - affinity: {nodeSelector: {kubernetes.io/hostname: siriussec}} - bootstrap: - recovery: - source: portal-wal - recoveryTarget: - targetTime: "2026-11-19T23:05:00Z" # UTC, RFC3339 - externalClusters: - - name: portal-wal - plugin: - name: barman-cloud.cloudnative-pg.io - parameters: - barmanObjectName: portal-wal # the ObjectStore in this namespace - serverName: portal # MUST be the *source* cluster name -``` - -```bash -kubectl apply -f portal-pitr-test.yaml -kubectl -n sirius-growth get cluster portal-pitr-test -w # Ready=True, "Cluster in healthy state" -``` - -**Step 3 — verify the cut, and then promote the result.** - -```bash -# the restore must stop before the unwanted transaction -kubectl -n sirius-growth exec portal-pitr-test-1 -c postgres -- \ - psql -U postgres -d portal -c "select id, note, at from order by id" -kubectl -n sirius-growth exec portal-pitr-test-1 -c postgres -- \ - psql -U postgres -tAc "select pg_is_in_recovery(), pg_last_xact_replay_timestamp()" -``` - -Rehearsal transcript on the plugin path (2026-11-19 23:04–23:06 UTC), target -`2026-11-19T23:05:00Z`, marker written 23:04:53.07, unwanted row 23:05:15.80: - -``` -# live primary, the mistake - 1 | MARKER-plugin-before-target | 2026-11-19 23:04:53.072104+00 - 2 | POISON-plugin-after-target | 2026-11-19 23:05:15.798408+00 -# pg_stat_archiver after forcing both segments out: ...062 (23:04:54), ...063 (23:05:16), failed_count 6 (historical, static) - -# restored cluster portal-pitr-test (targetTime 23:05:00Z) -id | note | at -----+-----------------------------+------------------------------- - 1 | MARKER-plugin-before-target | 2026-11-19 23:04:53.072104+00 -(1 row) -select count(*) from pitr_probe where note like 'POISON%' -> 0 -select pg_is_in_recovery(), pg_last_xact_replay_timestamp() -> f| -clients=4 calendar_tokens=3 applications=1 # identical to the primary -``` - -`pg_is_in_recovery() = f` on a single-instance recovery cluster means replay -finished and it has already been promoted. **A recovery cluster is writable the -moment it is Ready** — do not leave `portal-pitr-test` running, and do not point -application traffic at it. - -**Step 4 — make it the real one.** Two supported shapes: cut the app over to the -restored cluster (preferred — reversible), or re-point the PVC: - -```bash -# cut over: patch the API/portal Deployments' POSTGRES_HOST to portal-pitr-test-rw, -# then, once verified, keep it and delete the old cluster. -# in-place: let the recovery cluster finish, stop portal, and restore the portal-1 -# PVC from the test cluster's data dir — only after the app is confirmed correct. -``` - -**What recovery does not do:** it does not replay anything after the target, so -a "restore to now" is only as good as the last archived WAL. If -`pg_stat_archiver.failed_count` is non-zero, fix archiving *before* relying on a -timestamp near the present. - -**If the archive is lost or corrupt:** fall back to the nightly `pg_dump` -(§8.2 step 2) — 24 h RPO, logical, and readable without barman. That is exactly -why `sirius-growth/portal` stayed in `CNPG_TARGETS`. - -### 8.4 The CNPG-I Barman Cloud plugin (how it is wired) - -Active since **2026-11-19**. Three moving parts, all in git: - -| Piece | Where | Notes | -|---|---|---| -| Plugin Deployment | `infrastructure/databases/base/upstream/plugin-barman-cloud-0.16.0.yaml` (vendored verbatim, sha256 `aee61468…7155`), patched only for `--log-level=info` + resources | `cnpg-system/barman-cloud`, port 9090, `replicas: 1`; **registered through Service annotations** `cnpg.io/pluginName: barman-cloud.cloudnative-pg.io` + `cnpg.io/pluginPort`/`pluginClientSecret`/`pluginServerSecret` — there is no `Plugin` CR in CNPG 1.30; delete the Service and the operator deregisters it | -| mTLS | `infrastructure/controllers/cert-manager/` (HelmRelease `cert-manager` v1.21.3, `crds.enabled: true`) issuing `barman-cloud-server-tls` / `barman-cloud-client-tls` from the vendored `Issuer` + `Certificate`s | cert-manager is a hard dependency of the plugin manifest, not a nice-to-have | -| Store + wiring | `ObjectStore sirius-growth/portal-wal`, `Cluster portal` `spec.plugins`, `ScheduledBackup portal-daily` `method: plugin` | `ObjectStore` must live in the Cluster's namespace, and its `serverName` field must stay **empty** (the CRD enforces this); the prefix comes from `spec.plugins[].parameters.serverName` | - -Instance side: the operator injects an init-container sidecar -(`plugin-barman-cloud`, restartable sidecar) into `portal-1` and mounts a -`plugins` volume, which is why the Cluster restarted its primary once at -migration time. That sidecar runs `barman-cloud-wal-archive` / -`barman-cloud-backup` and enforces `retentionPolicy` every 30 min; the archive -URL it uses is `s3://pg-wal-archive portal ` — same prefix as before. - -Metrics change family with the archiver: `barman_cloud_cloudnative_pg_io_*` -(`…_last_available_backup_timestamp`, `…_first_recoverability_point`, -`…_last_failed_backup_timestamp`) replace `cnpg_collector_*` for this cluster. -The CNPG Grafana board accepts both. The deprecated -`cnpg_collector_last_available_backup_timestamp` is still *scraped* for portal -and holds the pre-migration value (22:34 UTC), so a panel that selects it alone -freezes at the last in-tree backup — that is why §8.4's dashboard change puts -the plugin metric first in the `or`. - -Dependency order in Flux: `cert-manager` → `databases` (plugin + `ObjectStore` -CRD) → `apps` (the `ObjectStore` CR and the Cluster that references it). - - ---- - -## 9. Known hazards and runbook pointers - -### 9.1 The four that actually bite - -1. **A Pi reboot loses `wg0` and silently breaks the cluster.** `wg-quick@wg0` is *enabled now* (a past gap was fixed), but after any reboot re-check the route pins: `ip route get 10.10.0.2` must say `dev wg0`. The Pi's kubelet symptom is `node "rpi" not found`, while cloudflared and Forgejo look perfectly healthy — see `references/pi-reboot-recovery.md` in the `home-k8s` skill. Work outside-in: LAN SSH → power-event check → `wg-quick@wg0` → **route pins** → per-hop curls. -2. **DiskPressure on siriussec takes the whole ingress stack with it.** Forgejo 503 from Cloudflare with `no healthy upstream` is almost always node `DiskPressure` (dind growth, §8), not the tunnel. Check `curl http://127.0.0.1:20241/ready` on rpi first; `readyConnections ≥ 1` means the tunnel is fine. -3. **`10.10.0.0/24` claimed by two interfaces on the Pi** (§3.4). Any edit to `wg-remote` AllowedIPs or a peer change can reintroduce it. Re-check both `ip route get 10.10.0.2` and `ip route get 10.10.0.5` after touching WireGuard. -4. **The T480 must boot `linux-lts`.** Running `6.18.50-2-lts` now; `7.2.3-arch1-3` is installed on disk and Cilium's BPF probe fails on it. GRUB default must stay on LTS, and never reboot onto a kernel whose `/lib/modules/$(uname -r)` was already removed by a pacman upgrade. - -### 9.2 Smaller, still real - -- **Leader-election fatals are an I/O-contention problem, and the two GitOps operators are now fixed for it.** The root cause is *shared-NVMe contention from CI build I/O*, not a slow or failing disk: etcd `wal_fsync` on `/dev/nvme0n1p3` (the same device as the dind data-root and `forgejo-data`) records **158 samples >8.192 s and 2,518 >2.048 s out of 14,813,192**, while 99.6 % land ≤32 ms — i.e. tail stalls of 5–10.4 s, worst **10.39 s at `2026-10-23T02:48:44Z`**. Every one of the 8 hours containing a ≥2 s stall had CI build I/O running (7 of 8 the amd64 dind runner); light deploy-only hours with the runner present produced none. A single stall exceeds client-go's 5 s lease-renewal HTTP timeout, controller-runtime reports `leader election lost`, and the manager fatals by design (`exit 1`). - - `cnpg-controller-manager` — **223 restarts / 45 d, fixed in `d5d1d28`** with `--leader-lease-duration=60 --leader-renew-deadline=45` (integer **seconds**; CNPG has no `resource-lock-timeout` flag, unlike Cilium). The same commit vendors the pinned 1.30.0 operator manifest into `infrastructure/databases/base/` and gives it its own Flux Kustomization `databases` (`prune: false` — the bundle carries the 11 CNPG CRDs, and pruning those would delete both clusters), so the args are declared state instead of a hand patch. The patch also preserves the pre-existing live deltas upstream does not ship (overlay API env `10.10.0.2:6443`, 500m/512Mi limits, 3 min startup probe). Live lease `cnpg-system/db9c8771.cnpg.io` reports `leaseDurationSeconds: 60`. - - `cilium-operator` — widened earlier in `bd5057c` (`--leader-election-lease-duration=60s`, `renew-deadline=45s`, `resource-lock-timeout=20s`) in `infrastructure/networking/cilium/values.yaml`. - - `kube-controller-manager` (~227) and `kube-scheduler` (~230) restarts are the *same stall event*, but they are kubeadm static pods, not GitOps: they were **not** changed and need their own `--leader-elect` tuning pass. - - Honest gap: one stall hour (`2026-10-24 22`, 18 events, worst 5.95 s) had **no** amd64 runner job and began the same minute a Pi-side `onionwire` job started. Unexplained but observed — do not claim dind-on-siriussec is the sole source. - - 60 s is a tourniquet, comfortably above the 10.4 s worst case; widening further fixes nothing. The remedy now shipped is **`infrastructure/node-io`** (`etcd-io-guard`, a one-node DaemonSet on siriussec): `vm.dirty_bytes=64 MiB` / `dirty_background_bytes=16 MiB` bound the host writeback backlog, and `io.max wbps=40 MiB/s` caps the **dind container's own cgroup** (never a slice — etcd is in `kubepods-burstable.slice`). Both are re-applied on drift every 30 s and re-discovered after a runner pod recreation, so a new dind cgroup is capped within one tick. - - Why not `io.latency`/iocost: this kernel exposes **no** `/sys/block/nvme0n1/queue/io.cost.*`, and cgroup-v2 applies `io.latency` targets only between **peers of the same parent** — kubelet gives every pod its own slice, so an etcd target can never throttle the dind pod (measured: dind's `io.stat` stayed `depth=max`). `io.max` is the available lever. - - Measured 2026-10-26 (identical 150 s, 4×128 MiB `dd conv=fsync` load run **inside** the dind container): worst `slow fdatasync` **1.40 s** and **1** warning line vs 11, **0** fsyncs >8.192 s, **no** apiserver/KCM/scheduler restarts during the run, and exactly 6.0 GiB written in 157 s (41 MB/s — the cap binds). Unmitigated baseline on the same device: 68.9 s / 26.6 s / 17.6 s stalls with apiserver restart and lost KCM/scheduler leases. - - Cost and limits: the 40 MiB/s cap costs ~11 % of dind write bandwidth and the 64 MiB dirty bound is host-global (every writer on siriussec). Moving the dind data-root off `/dev/nvme0n1p3` is still the only change that lets both knobs go back to default. Verify per the `node-io/README.md` checklist; `fstrim.timer` should also be enabled (it was disabled while the device reports `DISC-MAX 2T`). -- Pi ufw allows `22/tcp` from anywhere, plus `10.10.0.0/24`, `10.244.0.0/16` and `51820/udp`; the WG forward rules between `wg0` and `wg-remote` are in place. The Linode hub also needs its own `FORWARD` accepts or spoke traffic dies past the hub. -- Two stale WireGuard peers exist: mesh `10.10.0.4` (6 days, Tailscale endpoint) and Linode-hub `10.20.0.4` (no handshake). Harmless but misleading in `wg show`. -- The Pi runs **Tailscale** (`tailscale0`, `100.71.235.119`) alongside WireGuard. Do not plan recovery around Tailscale-only paths; treat WireGuard/LAN as the primary. -- Pi still runs three leftover Docker services outside Kubernetes: `registry:2` on `127.0.0.1:5000`, and two containers of site images (`handyman-site` on `:8082`, `sirius-growth-site`). The in-cluster GitOps deployments supersede the site containers; the local registry is still what `deploy-handyman.yml`/`deploy-site.yml` push to. - -### 9.3 Drift found: this document vs the `home-k8s` skill - -| Skill says | Reality (live 2026-10-26) | -|---|---| -| Cilium **1.18.13** | Cilium **v1.20.1**, Envoy `v1.37.5` | -| `linode` worker retired / "not down, gone" (task spec) | `linode` is **back as a Ready worker**, joined ~60 min before this reading, pod CIDR `10.244.2.0/24` | -| `linode` tainted `dedicated=network:PreferNoSchedule` | label present, **no taint** (same for rpi) | -| Public origin `10.10.0.5:8080` in the older paragraph | origin is **`10.10.0.2:8080`** (the skill's newer paragraph is right; the older one is stale) | -| Gateway listener on `10.10.0.5` / one Gateway | Gateway `public` advertises **three** addresses (`.1/.2/.5`) but only `.2:8080` completes requests; a second Gateway `internal:8081` exists | -| Garage: systemd unit, loopback only | **Docker container** `dxflrs/garage:v1.1.0`; `10.10.0.1:3900` (S3) + `10.10.0.1:3903` (metrics) + `127.0.0.1:3900`, nothing on `0.0.0.0`; compose now committed at `infrastructure/garage/` | -| wgportal is the peer manager on the Pi | **wgportal is not running** — dir + compose remain, no container, no unit; peers are edited manually | -| "Only wgportal compose should stay on the Pi" | Pi also runs `registry`, `handyman-site`, `sirius-growth-site` containers | -| PHS/piedmont pods pinned to `linode` | pinned to **siriussec** (`nodeSelector: kubernetes.io/hostname`) | -| Two Actions runners | **Three** — `forgejo-runner-deploy-arm64` (`deploy-arm64` only) added | -| — | `metrics-server` absent, so `kubectl top` does not work | -| — | `paaas.siriusdevops.com` is in the tunnel with **no** HTTPRoute → 404 | - ---- - -## 10. Verification log - -All times 2026-10-26 UTC. `kubeconfig` on the Legion admin laptop → `https://10.10.0.2:6443`; SSH `sirius@192.168.1.125` (rpi) and `Lancelot@192.168.1.179` (siriussec, capital L), key `~/.ssh/lancelot_priv`; Linode only via the Pi hop (`ssh -i ~/.ssh/linode_admin root@10.20.0.1`). - -| # | Command | Key result | -|---|---|---| -| 1 | `kubectl get nodes -o wide` | 3 nodes, all Ready, v1.36.4, `linode` age 60 m | -| 2 | `kubectl get nodes -o json` (labels/taints/conditions) | no taints anywhere; `gateway=true` on rpi + siriussec; `dedicated=network` on rpi + linode | -| 3 | `kubectl get pods -A -o wide` | 37 rows = **31 Running** + 6 Completed | -| 4 | `kubectl get svc,ingress,httproute,gateway -A` | no Ingress objects; 4 HTTPRoutes; Gateways `public` (8080) and `internal` (8081) | -| 5 | `kubectl get pvc,pv -A`, `kubectl get sc` | 4 Bound PVs, all `local-path`, all on siriussec | -| 6 | `kubectl get cluster -A` | `forgejo/pg` and `sirius-growth/portal`, both `ClusterIsReady`, 1 instance each | -| 7 | `kubectl -n flux-system get gitrepository,kustomization -o wide` | all Ready, revision `master@sha1:bd5057c` | -| 8 | `kubectl -n kube-system get cm cilium-config -o jsonpath=…` | `routing-mode: native`, `ipv4-native-routing-cidr 10.244.0.0/16`, `kube-proxy-replacement true`, `bpf-lb-external-clusterip true` | -| 9 | `kubectl -n kube-system get ds,deploy` / image tags | cilium `v1.20.1`, envoy `v1.37.5` | -| 10 | `kubectl -n kube-system exec ds/cilium -- cilium-dbg status --brief` | `OK` | -| 11 | `kubectl top nodes` | `error: Metrics API not available` → no metrics-server | -| 12 | `kubectl -n forgejo get deploy -o json` | 3 runner Deployments + nodeSelectors; pod/container securityContext as documented | -| 13 | `kubectl -n forgejo get cm forgejo-runner-config -o jsonpath` | three TOMLs: `amd64.toml`, `arm64.toml`, `deploy-arm64.toml`, all `capacity: 1` | -| 14 | `kubectl -n forgejo exec deploy/forgejo -- forgejo --version` | `16.0.5` | -| 15 | rpi: `sudo wg show` | `wg0` 3 peers (handshakes 1 min / 48 min / 6 d); `wg-remote` 1 peer, 35 s | -| 16 | rpi: `sudo wg show wg0 dump \| wc -l` | `4` | -| 17 | rpi: `systemctl is-enabled/is-active wg-quick@{wg0,wg-remote} cloudflared` | enabled/enabled/enabled; active state: wg0 **inactive**, wg-remote **active** | -| 18 | rpi: `ip route get 10.10.0.2 / 10.10.0.5 / 10.10.0.3` | `dev wg0` / `dev wg-remote` / `dev wg0` — pins correct | -| 19 | rpi: `curl -s http://127.0.0.1:20241/ready` | `{"status":200,"readyConnections":4}` | -| 20 | rpi: `curl -s http://127.0.0.1:20241/config` | 8 hostnames + catch-all, **all** → `http://10.10.0.2:8080` | -| 21 | rpi: `curl -H 'Host: ' http://10.10.0.2:8080/` ×5 | 200/31813 / 200/15008 / 200/72640 / 200/7067 / **404 paaas** | -| 22 | rpi: same against `10.10.0.1:8080` and `10.10.0.5:8080` | rpi → **503 in 5.000 s**; linode → no listener (000) | -| 23 | Cloudflare API `GET /accounts/…/cfd_tunnel` | `sirius home` healthy, 4 connections; `piedmontomesvc` tunnel inactive, 0 | -| 24 | rpi: `docker ps -a` | garage, registry, handyman-site, sirius-growth-site up; **no wg-portal**; 5 exited `onionwire-ci-*` containers | -| 25 | rpi: `docker exec garage /garage status` and `bucket list` | node `d053db4dfc97bf78` healthy, 3 buckets | -| 26 | rpi: `ss -ltnp \| grep 390` | `127.0.0.1:3900` **and `10.10.0.1:3900`/`:3903`** — no `0.0.0.0`, no 3901/3902 | -| 27 | rpi: `df -h`, `free -h`, `vcgencmd get_throttled` | 58% used; 7.9 GiB RAM; `throttled=0x0` | -| 28 | siriussec: `wg show` | peer = Pi hub, `AllowedIPs 10.10.0.0/24, 10.244.0.0/16`, handshake 1 min | -| 29 | siriussec: `sudo nft list table inet k8s-api` | lo / wg0 / `10.244.0.0/16` accept, else drop | -| 30 | siriussec: `sudo du -sh /opt/local-path-provisioner/pvc-*` | 224 M / 643 M / 12 G / **18 G** (dind) | -| 31 | siriussec: `uname -r`, `pacman -Q linux-lts` | `6.18.50-2-lts`; `7.2.3-arch1-3` also installed | -| 32 | linode (via Pi hop): `hostname`, `ip -br addr`, `wg show wg0` | `dummy-k8s 10.10.0.5/32`, `wg0 10.20.0.1/24`, 4 peers, uptime 3 d 17 h | - -**CNPG leader-election fix, re-verified 2026-10-26 19:37–19:45 UTC (commit `d5d1d28`):** - -| # | Command | Key result | -|---|---|---| -| 33 | `kubectl -n cnpg-system get deploy cnpg-controller-manager` (`--show-managed-fields`) | args `--leader-lease-duration=60`, `--leader-renew-deadline=45`; preserved `KUBERNETES_SERVICE_HOST=10.10.0.2`, 500m/512Mi, startupProbe 36; managedFields owner `kustomize-controller` `Apply` → Flux owns it | -| 34 | `kubectl -n cnpg-system get lease db9c8771.cnpg.io -o jsonpath` | `leaseDurationSeconds: 60` (was 15), holder = new pod `78484bd58d-m6rtk`, `renewTime` advancing; `leader election lost` count in the new pod's log: **0**; restarts 223 → **0** on the new ReplicaSet | -| 35 | `kubectl -n flux-system get kustomization`; `kubectl get cluster -A` | new `databases` Kustomization `Ready=True` at `master@sha1:d5d1d28`; all 5 Ready; `forgejo/pg` + `sirius-growth/portal` both `Ready=True`; `forgejo.siriusdevops.com` **200** public and `Host:` curl to `10.10.0.2:8080` **200** | -| 36 | siriussec: `curl :2381/metrics` (etcd) | `wal_fsync` 158 >8.192 s / 2,518 >2.048 s of 14,813,192; `backend_commit` 187 >8.192 s of 6,652,027; 99.6 %/99.7 % ≤32 ms — matches the stated stall profile, so this is spiky contention, not a failing disk | - -**Not verified, deliberately:** Cloudflare DNS records, Forgejo's `app.ini`, any secret material, and the SG-VPS/phone spoke routing beyond what the Linode's `wg show` reports. - -**CNPG-I Barman Cloud plugin migration, verified 2026-11-19 22:57–23:07 UTC (commits `f3a8233`, `c452552`; kanban `t_5df331de`):** - -| # | Command | Key result | -|---|---|---| -| 37 | `kubectl -n cert-manager get pods`; `kubectl -n flux-system get kustomization` | controller/webhook/cainjector `1/1 Running`; all 7 Kustomizations `Ready=True` at the same revision, `databases` `dependsOn cert-manager`, `apps` `dependsOn databases` | -| 38 | `kubectl -n cnpg-system get pods,certificate` | `barman-cloud-7b779d49d8-2pnbk 1/1 Running`; `barman-cloud-client` + `barman-cloud-server` certificates `READY=True` — the operator logged `Registered plugin` for `barman-cloud.cloudnative-pg.io` | -| 39 | `kubectl -n sirius-growth get cluster portal -o jsonpath='{.status.pluginStatus}'` | `[{name: barman-cloud.cloudnative-pg.io, version: 0.16.0, capabilities: [TYPE_RECONCILER_HOOKS, TYPE_LIFECYCLE_SERVICE, TYPE_INSTANCE_SIDECAR_INJECTION]}]`; pod `portal-1` now carries the `plugin-barman-cloud` init-sidecar and `plugins` volume; Cluster `Ready=True` | -| 40 | `kubectl -n sirius-growth logs portal-1 -c plugin-barman-cloud` | `Executing barman-cloud-wal-archive … ["--gzip","--endpoint-url","http://10.10.0.5:3900","--cloud-provider","aws-s3","s3://pg-wal-archive","portal", …05D]` → `Archived WAL file … elapsedWalTime 0.586`; retention runnable applied `14d` | -| 41 | `kubectl -n sirius-growth get backup portal-plugin-proof-1 -o wide` | `METHOD plugin`, `PHASE completed` (on-demand base backup through the plugin) | -| 42 | `aws --endpoint-url http://10.10.0.5:3900 s3 ls --recursive s3://pg-wal-archive/` (from a pod, Secret `portal-wal-s3`) | `portal/base/20261119T223452/…` (in-tree) **and** `portal/base/20261119T230300/…` (plugin) side by side, `portal/wals/…` continuous — the prefix did not move; 4 objects under `base/`, 10 under `wals/` | -| 43 | PITR rehearsal: marker `23:04:53.07`, poison `23:05:15.80`, `targetTime 2026-11-19T23:05:00Z` | restored `portal-pitr-test` → marker row present, `count(POISON%)=0`, `pg_is_in_recovery()=f`, `clients 4 / calendar_tokens 3 / applications 1` identical to the primary; test cluster + PVC deleted, probe table dropped afterwards | -| 44 | Prometheus (`/api/v1/query`) | `barman_cloud_cloudnative_pg_io_last_available_backup_timestamp` = 1795129385 (23:03:05, the plugin backup), `…_first_recoverability_point` = 1795127697; the legacy `cnpg_collector_last_available_backup_timestamp` for `portal` still returns the **pre-migration** 1795127697 — hence the dashboard's `or` lists the plugin metric first | diff --git a/docs/grafana-persistence.md b/docs/grafana-persistence.md deleted file mode 100644 index 02c683d..0000000 --- a/docs/grafana-persistence.md +++ /dev/null @@ -1,112 +0,0 @@ -# Grafana persistence and the admin password - -Grafana (`monitoring/kube-prometheus-stack-grafana`) used to run with **no -persistence at all**: `/var/lib/grafana` was an `emptyDir`, so its sqlite DB -(`grafana.db`) — the admin user row, sessions, API keys, alert state and any -UI-created dashboard — died with the pod. `GF_SECURITY_SECRET_KEY` was also -unset, so every restart generated a fresh session-signing key. The visible -symptom was a browser holding a session cookie that could never validate: -`logger=authn.service msg="Failed to authenticate request" -client=auth.client.session error="user token not found"` followed by -`path=/ status=302`, i.e. a client bouncing on `/` — which looks like -"Grafana is unreachable" but is not a network fault. - -Both are fixed in `monitoring/controllers/home/values.yaml`: - -| What | Where | -|------|-------| -| DB + plugins | PVC `monitoring/kube-prometheus-stack-grafana`, 5Gi `local-path`, mounted at `/var/lib/grafana` (Grafana's `GF_PATHS_DATA`) | -| `GF_SECURITY_SECRET_KEY` | Secret `monitoring/grafana-secret-key`, key `secret_key` (out of band — **not in git**), injected with `grafana.envValueFrom` | -| Deployment strategy | `Recreate` — a RWO `local-path` PVC cannot be mounted by an old and a new pod at once, so `RollingUpdate` deadlocks the rollout | - -The PVC is `local-path`, so the data physically lives on **siriussec** -(`nodeSelector: kubernetes.io/hostname: siriussec` is unchanged) under -`/opt/local-path-provisioner/pvc-_monitoring_kube-prometheus-stack-grafana/`. -That also means the data does **not** follow the pod to another node — if -siriussec is rebuilt, the admin state is gone with the rest of the local PVs. - -## Provisioned dashboards still win - -Dashboards and datasources are sidecar-loaded from ConfigMaps -(`grafana_dashboard` / `grafana_datasource` labels, provider -`allowUiUpdates: false`, `foldersFromFilesStructure` off). They are the source -of truth: editing a provisioned dashboard in the UI is **overwritten on the next -sidecar reload/restart**, and deleting the ConfigMap deletes the dashboard. That -is intended — persistence exists for credential/session state, not to turn -Grafana into a hand-edited dashboard store. A *new* dashboard created purely in -the UI has no ConfigMap and does persist in the DB, but nothing backs it up and -it will not exist after a node rebuild. - -## Where the admin password lives - -**Two owners, one rule: the Secret is only the *seed*.** - -* `monitoring/grafana-admin` (`admin-user`, `admin-password`) is used through - `grafana.admin.existingSecret` → `GF_SECURITY_ADMIN_USER` / - `GF_SECURITY_ADMIN_PASSWORD`. Grafana creates the admin row from these values - **only when the DB has no admin user** (first boot on an empty PVC). -* After that the DB owns the password. An in-app change sticks across restarts, - and the Secret is **not** updated by Grafana — the two drift the moment - someone changes the password in the UI. - -So: changing `grafana-admin` alone on a populated PVC does **nothing**. That is -by design (no silent password resets on redeploy), and it is exactly why the -recovery path below matters. - -## Recovery: reset a lost admin password - -The trap with a persistent DB is that re-applying the Secret no longer helps. -Reset it from inside the pod against the live DB: - -```bash -kubectl -n monitoring exec deploy/kube-prometheus-stack-grafana -c grafana -- \ - grafana cli --homepath /usr/share/grafana admin reset-admin-password '' -``` - -That rewrites the password in `grafana.db` (and clears the admin's sessions), so -it survives restarts. Then **also** update the Secret so the seed matches the -DB and nobody gets a surprise if the PVC is ever lost: - -```bash -# keep the value out of shell history / the terminal: read it from a 0600 file -kubectl -n monitoring patch secret grafana-admin --type merge \ - -p "{\"stringData\":{\"admin-password\":\"$(cat /root/gf-admin.pw)\"}}" -``` - -Full reset (last resort, **destroys every UI-created dashboard, API key and -alert rule**): scale the Deployment to 0, `rm -rf` the PV sub-directory on -siriussec (or delete the PVC), scale back to 1. Grafana re-seeds the admin user -from `grafana-admin` on the empty DB. - -## Recreating the secret_key Secret - -`grafana-secret-key` is out of band. If it is lost, Grafana will not start -(the `secretKeyRef` is not optional). Recreate it with a fresh random value — -this invalidates every existing session, which is the acceptable cost: - -```bash -kubectl -n monitoring create secret generic grafana-secret-key \ - --from-literal=secret_key="$(head -c 48 /dev/urandom | base64 | tr -d '\n=/+' | head -c 63)" -kubectl -n monitoring rollout restart deploy/kube-prometheus-stack-grafana -``` - -(Or apply `stringData` from stdin so the value never touches a file. Never -commit it.) - -## One-time transition note (2026-10-27) - -Switching the existing Deployment to `strategy: Recreate` needed one manual step: -the live Deployment still owned `spec.strategy.rollingUpdate` from the previous -release, and server-side apply does not drop a field merely by omitting it, so -Helm failed with - -``` -Deployment.apps "kube-prometheus-stack-grafana" is invalid: -spec.strategy.rollingUpdate: Forbidden: may not be specified when strategy `type` is 'Recreate' -``` - -Putting `rollingUpdate: null` in the values does not help — Helm drops null keys -during values coalescing. The fix was a one-off -`kubectl -n monitoring patch deploy kube-prometheus-stack-grafana -p -'{"spec":{"strategy":{"type":"Recreate","rollingUpdate":null}}}'` followed by a -HelmRelease reconcile. A fresh install never needs it. diff --git a/docs/internal-wireguard-services.md b/docs/internal-wireguard-services.md deleted file mode 100644 index 46842df..0000000 --- a/docs/internal-wireguard-services.md +++ /dev/null @@ -1,804 +0,0 @@ ---- -title: Internal (WireGuard-only) services on the home cluster -created: 2026-10-27 -updated: 2026-10-27 -author: Lance Walters (written with Hermes devops agent) -tags: [homelab, kubernetes, wireguard, cilium, gateway-api, observability] -status: current -verified: 2026-10-27T05:20Z ---- - -# Internal (WireGuard-only) services - -How a service in this cluster is exposed **to the WireGuard mesh and nothing -else** — not to the LAN, not to the internet — and how to add the next one. -First user: Grafana (`monitoring`). Second: Hubble UI (`kube-system`). - -Related: [[Home-Lab-Kubernetes-Cluster]], `docs/cluster-overview.md`, -`infrastructure/networking/internal/`. - ---- - -## 1. Why this is not just "an HTTPRoute without a hostname" - -Cilium's Gateway implementation runs **one hostNetwork Envoy per gateway node** -(`cilium-envoy` DaemonSet, node selector `node-role.kubernetes.io/gateway=true` -— **`siriussec` 10.10.0.2 only**, since 2026-10-27) and binds **every** -listener port on `0.0.0.0`. There is no Gateway API field for "listen on wg0 -only". Consequences: - -- A listener on port 8081 is reachable on `192.168.1.179:8081` (siriussec's - LAN address) and on siriussec's WG address the moment it is Programmed. - Nothing binds `:8081` on rpi: it lost the `gateway=true` label on 2026-10-27, - so `10.10.0.1:8081` is a **closed port**, not a second origin. -- The Gateway object cannot enforce the network boundary. **The host firewall - is the enforcement point.** That is the whole trick. -- The service is reached as **`http://10.10.0.2:/`** — no `/etc/hosts` - entry, no `Host` header. The HTTPRoute must therefore carry **no - `hostnames`**, or a phone (which cannot edit a hosts file) sends - `Host: 10.10.0.2:8081`, matches no `.lab.internal` route, and Envoy answers - **404**. A hostname-less route matches any `Host` on its listener, so the - named `http://.lab.internal:8081` URL keeps working for laptops that - do have the hosts line. -- **One service per listener port AND per Gateway.** Two hostname-less routes - on one listener make precedence ambiguous — and worse, Cilium renders **one - RouteConfiguration per Gateway**, shared by all of that Gateway's listeners, - so two hostname-less routes merge into a single route with `weightedClusters` - weight 1/1: every request then hits a random backend, on *every* port of the - gateway. Splitting them onto different ports of the same Gateway does not - help. Each bare-IP service therefore gets its own **Gateway** (its own port, - its own RouteConfiguration) — see `gateway-hubble-ui.yaml` and §9. - -Public traffic has no path here: the only public ingress is the cloudflared -tunnel, whose ingress list is an explicit allow-list of hostnames pointing at -`http://10.10.0.2:8080` (the `public` gateway). Nothing points at 8081, and -`*.lab.internal` resolves nowhere publicly. - -## 2. The pieces - -| Object / unit | Where | Purpose | -|---|---|---| -| `Gateway internal/internal` | `infrastructure/networking/internal/gateway.yaml` (Flux: `infrastructure`) | listener `http-internal`, **port 8081**, `allowedRoutes: All` so any namespace can attach. **One bare-IP service only** (Grafana) — see the merge gotcha above | -| `Gateway internal/hubble-ui` | `infrastructure/networking/internal/gateway-hubble-ui.yaml` | listener `http-internal`, **port 8084**, its own RouteConfiguration, so its hostname-less route cannot merge with Grafana's | -| `HTTPRoute ` | the app's own tree (e.g. `monitoring/controllers/home/httproute.yaml`, `infrastructure/networking/cilium/hubble-ui-httproute.yaml`) | `parentRefs: /internal#http-internal`, **no `hostnames`** | -| `table inet internal_gw` + `internal-gw-firewall.service` | siriussec host (`/etc/nftables.d/internal-gw.nft`) | drop `:8081`+`:8084` from everything but `10.10.0.0/24`, `10.244.0.0/16`, `lo`; the accept rules carry `counter`s so "traffic arrived and was allowed" is provable, not inferred from a 200 | -| ufw rules (inserted above the LAN catch-all) | rpi host | **inert since 2026-10-27** — left in place as a belt-and-braces guard in case the Pi is ever relabelled `gateway=true`, but nothing binds those ports on rpi any more, so they just make stale `10.10.0.1:8081` clients time out instead of being refused | -| `infrastructure/networking/internal/host-firewall/` | repo | the host artifacts + install/verify instructions | - -Only siriussec runs `cilium-envoy`, so only its `internal_gw` table is load -bearing. **If a second node is ever given `gateway=true`**, it needs the same -firewall rules *and* its backends co-located, or it will serve 503s for -everything (see §7). - -## 3. Current internal services - -| Service | URL (over WireGuard) | Optional client `/etc/hosts` line | Route | Port | -|---|---|---|---|---| -| Grafana | **`http://10.10.0.2:8081/`** (also `http://grafana.lab.internal:8081/`) | `10.10.0.2 grafana.lab.internal` | `monitoring/grafana` | 8081 | -| Hubble UI | **`http://10.10.0.2:8084/`** (also `http://hubble.lab.internal:8084/`) | `10.10.0.2 hubble.lab.internal` | `kube-system/hubble-ui` | 8084 | - -**The rule: every internal service must be reachable as -`http://10.10.0.2:/` with no `Host` header and no hosts-file entry**, -because phones cannot edit `/etc/hosts`. The bare-IP URL is the one to hand -out; the named URL is a convenience for machines that already have the line. - -**`10.10.0.2` is the only serving address.** The Gateways' `status.addresses` -lists *every* node InternalIP (`10.10.0.1`, `10.10.0.2`, `10.10.0.5`) regardless -of which nodes run `cilium-envoy`, and Cilium ignores `spec.addresses` -(cilium#29060), so the status list is **not** a load-balanced VIP and not a -"try either IP" guide. `10.10.0.1` and `10.10.0.5` have no listener; -`10.10.0.1` times out (ufw DROP), `10.10.0.5` is reachable only as a mesh -address. Hand out the bare-IP URL on 10.10.0.2 and nothing else. - -Historical note (fixed 2026-10-27): while rpi carried `gateway=true` its Envoy -completed the TCP handshake but could never finish a request to a backend pod -on siriussec — every request to `10.10.0.1:8081`/`:8084` hung 5 s and returned -**503**, *including from the Pi's own `127.0.0.1`*. That is the co-location -fault (SYN-ACK back, no ACK on `reserved:ingress`), and it is why the label now -lives on siriussec alone. - -## 4. Add the next internal service - -1. **Confirm the port is firewalled.** `:8081` is closed to the LAN already; a - new listener port needs its own rules (see §5). **Do not reuse 8081** — one - listener port carries exactly one internal service, so a second - hostname-less route can never compete with Grafana's. -2. **Deploy the workload** in its own namespace, pinned with - `nodeSelector: {kubernetes.io/hostname: siriussec}` (amd64 + local-path; the - Pi is arm64 and its listener only serves pods scheduled on the Pi). -3. **Add the Gateway** (its own object, its own port, its own - RouteConfiguration) — copy `infrastructure/networking/internal/gateway-hubble-ui.yaml`: - - ```yaml - apiVersion: gateway.networking.k8s.io/v1 - kind: Gateway - metadata: - name: - namespace: internal - spec: - gatewayClassName: cilium - listeners: - - name: http-internal - protocol: HTTP - port: # unique; firewalled first, see §5 - allowedRoutes: {namespaces: {from: All}} - ``` - - Then the route next to the workload — **without `hostnames`**: - - ```yaml - apiVersion: gateway.networking.k8s.io/v1 - kind: HTTPRoute - metadata: - name: - namespace: - spec: - parentRefs: - - name: # the Gateway above, NOT `internal` - namespace: internal - sectionName: http-internal - rules: - - matches: - - path: {type: PathPrefix, value: /} - backendRefs: - - name: - port: - ``` - - A `ReferenceGrant` is only needed for cross-namespace *backends*; the route - itself is allowed by `allowedRoutes: All` on the listener. -4. Commit, push, reconcile (repo → `gitrepository`, then the app's - `kustomization`), then **prove it from the mesh** — bare IP first, because - that is the phone path: - - ```bash - curl -sS -o /dev/null -w '%{http_code}\n' http://10.10.0.2:/ # -> 200/302, never 404 - curl -sSL -m 6 http://10.10.0.2:/login | head -c 200 # -> HTML, no absolute redirect - ``` -5. Add the row to the table in §3. - -## 5. Firewall changes for a new port - -siriussec — add the same three lines with the new port to -`/etc/nftables.d/internal-gw.nft` and `systemctl reload-or-restart -internal-gw-firewall.service` (it is a oneshot `nft -f`, so re-running is safe): - -``` -tcp dport iifname "lo" accept -tcp dport ip saddr { 10.10.0.0/24, 10.244.0.0/16 } accept -tcp dport counter drop -``` - -rpi — the ufw equivalents, inserted **above** the `allow from 192.168.1.0/24` -catch-all (`ufw insert`, never plain `ufw allow`, or the LAN allow matches -first): - -```bash -ufw insert 1 deny to any port proto tcp comment 'internal gateway: wg only' -ufw insert 1 allow from 10.10.0.0/24 to any port proto tcp comment 'internal gateway (wg mesh)' -ufw insert 2 allow from 10.244.0.0/16 to any port proto tcp comment 'internal gateway (pods)' -``` - -## 6. Negative tests (run these after every change) - -```bash -# 0. From a mesh host: the BARE-IP phone path, and the login page via it. -# Grafana must not hard-redirect to a .internal name (no root_url/domain set). -curl -sS -m 6 -o /dev/null -w '%{http_code}\n' http://10.10.0.2:8081/ # -> 302 (login), never 404 -curl -sSL -m 6 -o /dev/null -w '%{http_code} redirects=%{num_redirects}\n' \ - http://10.10.0.2:8081/login # -> 200, no absolute Location -curl -sS -m 6 -D- -o /dev/null http://10.10.0.2:8081/ | grep -i '^location:' # -> /login (relative) - -# 1. From a LAN host (Legion on 192.168.1.0/24, or rpi toward siriussec): -# DROP = timeout, not connection-refused and never 200. -curl -m 3 -sS -o /dev/null -w '%{http_code}\n' http://192.168.1.179:8081/ # -> 000 (timed out) -curl -m 3 -sS -o /dev/null -w '%{http_code}\n' http://192.168.1.125:8081/ # -> 000 (timed out) - -# 2. From a mesh host, the named URL must still work: -curl -sS -o /dev/null -w '%{http_code}\n' -H 'Host: grafana.lab.internal' http://10.10.0.2:8081/ # -> 302 (login) - -# 3. Not in the public tunnel's ingress list (run on rpi): -curl -s http://127.0.0.1:20241/config | python3 -c \ - "import json,sys; d=json.load(sys.stdin)['config']; print([i.get('hostname') for i in d['ingress']])" - -# 4. The public gateway is untouched: -curl -sS -o /dev/null -w '%{http_code}\n' -H 'Host: forgejo.siriusdevops.com' http://10.10.0.2:8080/ -``` - -## 7. Gotchas - -- **A `cluster.local`-style name will not resolve.** Use the bare-IP URL (no - DNS at all); an `/etc/hosts` entry plus `http://.lab.internal:/` - is a laptop-only convenience. There is no internal DNS zone yet. -- **Cilium merges hostname-less routes across listeners of the same Gateway.** - Giving the second bare-IP service its own *listener port* is not enough: - Cilium compiled both hostname-less `PathPrefix /` routes into one route - table, so `10.10.0.2:8081` and `:8082` each answered for **either** backend - (measured 9/11 split over 20 requests pre-fix). Each bare-IP service needs - its **own Gateway object** (`internal`/8081 → Grafana, `internal/hubble-ui` - on 8082 → Hubble), not just its own listener. -- **After adding/moving a listener, restart `cilium-envoy`** — the stale route - stayed programmed on the old port until - `kubectl -n kube-system delete pod -l k8s-app=cilium-envoy` (the pods were - 6 days old). Verify per port with a repeated-request loop, not a single curl: - a 50/50 mix of two backends looks like a flaky service, not a config bug. -- **Do not add these hostnames to the cloudflared tunnel** "to make them easier - to reach". That is a public exposure of a service that has no authentication - story beyond Grafana's own. The tunnel ingress list is the public allow-list. -- **`sudo nft -f` is not persistent by itself** — it must go through - `internal-gw-firewall.service` (enabled at boot), same as - `k8s-api-firewall.service`. -- Changing the `internal` Gateway's `allowedRoutes` does not need an Envoy - restart; Cilium reconciles the route table. Changing the **listener** (port, - protocol) does need the `cilium-envoy` pods restarted - (`kubectl -n kube-system delete pod -l k8s-app=cilium-envoy`). -- **Only `siriussec` carries `node-role.kubernetes.io/gateway=true`.** Keep it - that way: `kubectl get nodes -l node-role.kubernetes.io/gateway=true` must - return exactly one node. A 503-after-exactly-5.0 s on a node's own IP (even - `127.0.0.1`) means Envoy is running there but the backend pod is not on that - node — remove the label rather than firewalling around it. Removing the label - deletes the `cilium-envoy` DaemonSet pod on that node within seconds and the - ports go with it; no restart of the remaining pod is needed (the Gateway - object is unchanged). -- **The probe in `monitoring/controllers/home/gateway-probe.yaml` is the flap - detector**: blackbox-exporter + a `Probe` for `http://10.10.0.2:8081/` and - `:8084/` every 30 s, alerting `InternalGatewayUnreachable` - (`probe_success == 0` for 3 min) and `InternalGatewayProbeMissing` - (`absent()`) as a `PrometheusRule`. Watch it in Prometheus `/alerts` or - Grafana → Alerting. There is no Alertmanager in the stack yet, so nothing is - *paged*; the alert is visible, not pushed. - -## 8. Verification log — 2026-10-27 (Grafana) - -Commit `d3741df` on `master`, reconciled by Flux (`gitrepository` first, then -`kustomization flux-system`, which created `kustomization monitoring`). - -``` -# flux -NAME READY STATUS -monitoring True Applied revision: master@sha1:d3741df... -# helm + workloads -kube-prometheus-stack True Helm install succeeded for release monitoring/kube-prometheus-stack.v1 with chart kube-prometheus-stack@92.14.0 -prometheus-kube-prometheus-stack-prometheus-db-... Bound 10Gi RWO local-path -pods: grafana 3/3, kube-state-metrics 1/1, operator 1/1, node-exporter 1/1, prometheus 2/2 (all on siriussec) -Prometheus CR: retention 7d / retentionSize 8GB, replicas 1, remoteWrite none, PVC 10Gi local-path -active scrape targets: 18 up / 0 down - -# positive — from Legion over WireGuard -$ curl -sS -o /dev/null -w '%{http_code}' -L http://grafana.lab.internal:8081/ -200 (POST /login with the secret creds -> 200 "Logged in"; /api/user -> admin) -$ curl -sS -o /dev/null -w '%{http_code}' http://10.10.0.2:8081/ # no Host match -404 (SUPERSEDED 2026-10-27 04:35Z by §9 — the route now has no - hostnames, so this same request is a 302 to /login) - -# negative 1 — LAN (from Legion, 192.168.1.0/24) -$ curl -m 3 http://192.168.1.179:8081/ -> timed out (curl 28), http_code 000 -$ curl -m 3 http://192.168.1.125:8081/ -> timed out (curl 28), http_code 000 - (nft table inet internal_gw counts the drops on siriussec; ufw rules at - positions 1-3 on rpi sit above `allow from 192.168.1.0/24`) - -# negative 2 — internet -cloudflared ingress (9 entries): siriusdevops.com, www., forgejo., paaas., -piedmonthomesvc.com, www., siriusgrowthsolutions.com, www., 404-catch-all - -> no grafana/lab.internal entry; and `curl -H 'Host: grafana.lab.internal' - http://10.10.0.2:8080/` returns 404 (the public gateway has no such route). - -# regression — public ingress intact (from rpi) -$ curl -H 'Host: forgejo.siriusdevops.com' http://10.10.0.2:8080/ -> 200 - -# grafana provisioning -24 dashboards in Grafana (includes Node Exporter / Nodes, Kubernetes / -Compute Resources / Pod, ... / Cluster, ... / Namespace); datasource -`kube-prometheus-stack-grafana-datasource` -> Prometheus; anonymous disabled, -allow_sign_up false; admin creds from Secret monitoring/grafana-admin -(admin-user / admin-password). -``` - -## 9. Verification log — 2026-10-27 (bare-IP fix: Grafana on `http://10.10.0.2:8081/`) - -Commits `8939cbd` (Grafana: drop `hostnames` from the route) and, from the -concurrent Hubble card, `dcb708d` (Hubble moved to its own Gateway object — -required, see §7). Flux `monitoring` applied `master@sha1:dcb708d…`, which -contains `8939cbd`. - -``` -# the change -$ kubectl -n monitoring get httproute grafana -o yaml | sed -n '/^spec:/,/^status:/p' -spec: - parentRefs: - - {group: gateway.networking.k8s.io, kind: Gateway, name: internal, namespace: internal, sectionName: http-internal} - rules: - - backendRefs: [{group: "", kind: Service, name: kube-prometheus-stack-grafana, port: 80, weight: 1}] - matches: [{path: {type: PathPrefix, value: /}}] - # no `hostnames:` — any Host on the listener matches - -$ kubectl -n flux-system get kustomizations | grep monitoring -monitoring True Applied revision: master@sha1:dcb708dff4cd3952436f4d5887e071dbde703945 - -# PHONE PATH — bare IP, no hosts entry, no Host header. From Legion (mesh): -$ curl -sS -D- -o /dev/null http://10.10.0.2:8081/ -HTTP/1.1 302 Found -location: /login # relative — no absolute .internal redirect -server: envoy -$ curl -sSL -o /dev/null -w '%{http_code} final=%{url_effective} redirects=%{num_redirects}\n' \ - http://10.10.0.2:8081/login -200 final=http://10.10.0.2:8081/login redirects=0 -Grafana # real login HTML, 0 redirects - -# same request from rpi (source 10.10.0.1) and from a pod in the cluster: -$ ssh sirius@192.168.1.125 'curl -sS -o /dev/null -w "%{http_code}" http://10.10.0.2:8081/' -> 302 -$ kubectl -n monitoring run gw-probe --rm -i --image=curlimages/curl:8.10.1 -- \ - curl -sS -o /dev/null -w 'pod_bare=%{http_code}' http://10.10.0.2:8081/ -pod_bare=302 - -# named URL still works -$ curl -sS -o /dev/null -w '%{http_code}' -H 'Host: grafana.lab.internal' http://10.10.0.2:8081/ -> 302 - -# port ownership — 8081 is Grafana's alone (15 consecutive requests, no hubble) -8081: grafana=15 hubble=0 other=0 -$ kubectl -n internal get gateway internal -o jsonpath='{range .status.listeners[*]}{.name} attached={.attachedRoutes}{"\n"}{end}' -http-internal attached=1 - -# negative 1 — LAN (echoed from Legion, 192.168.1.126 on the LAN, while on WG too) -$ curl -m 4 http://192.168.1.179:8081/ -> curl: (28) timed out, http_code 000 -$ curl -m 4 http://192.168.1.125:8081/ -> curl: (28) timed out, http_code 000 - -# negative 2 — internet (cloudflared ingress on rpi: still 8 hostnames + 404 catch-all) -siriusdevops.com, www., forgejo., paaas., piedmonthomesvc.com, www., -siriusgrowthsolutions.com, www., -> http_status:404 - -> no grafana/lab.internal entry -$ curl -H 'Host: grafana.lab.internal' http://10.10.0.2:8080/ -> 404 (public gateway has no such route) - -# regression — public ingress intact (from rpi) -$ curl -H 'Host: forgejo.siriusdevops.com' http://10.10.0.2:8080/ -> 200 - -# phone peer at the time of the fix (Pi hub): still offline, reconnect required -$ sudo wg show wg0 latest-handshakes -A1NSWT7K9Dz…("Peer SiriusMobile", 10.10.0.4) age=570919s (~6.6 days) -``` - -**The URL to use on the phone: `http://10.10.0.2:8081/`** — tunnel connected, -client `AllowedIPs` covering `10.10.0.0/24`. - -## 10. Verification log — 2026-10-27 (Hubble UI on `http://10.10.0.2:8084/`) - -Hubble relay + UI are chart values in `infrastructure/networking/cilium/values.yaml` -(`hubble.relay.enabled`, `hubble.ui.enabled`, both pinned to siriussec); the UI -is exposed by `internal/hubble-ui` (port **8084**, own Gateway, no `hostnames`). - -**Port choice cost a cycle.** The first attempt used 8082, which is free on -siriussec but held on **rpi** by the leftover `handyman-site` Docker container -(`127.0.0.1:8082`; its nginx holds `127.0.0.1:8083`). Cilium binds the listener -`0.0.0.0:8082` on *both* gateway nodes, so rpi's Envoy rejected the config -(`cannot bind '0.0.0.0:8082': Address already in use`, ~640 lines/s) and -restart-looped the node that fronts the public ingress. 8084 was verified free -on both nodes before the move. **Check `ss -lntH "sport = :<port>" | wc -l` = 0 -on every node with `k8s-app=cilium-envoy`, not just the control-plane.** - -``` -# values -> rendered config (not a guess) -$ kubectl -n kube-system get hr cilium -o jsonpath='{.status.conditions[?(@.type=="Ready")].status} {.status.lastAttemptedRevision}' -True 1.20.1 # Ready=True -$ kubectl -n kube-system get cm cilium-values-* -o jsonpath='{.data.values\.yaml}' | grep -A2 ' relay:' - relay: {enabled: true, replicas: 1, nodeSelector: {kubernetes.io/hostname: siriussec}} -$ kubectl -n kube-system get cm cilium-config -o jsonpath='{.data.hubble-metrics}' -flow drop tcp port-distribution icmp httpV2 dns # + hubble-metrics-server :9965 - -$ kubectl -n kube-system get pods | grep -E 'hubble' -hubble-relay-6f87554656-wznnw 1/1 Running -hubble-ui-567ccf4fbd-skkwm 2/2 Running -$ kubectl -n kube-system logs deploy/hubble-relay --tail=3 -msg=Connecting address=10.10.0.1:4244 tls=true peer=rpi -msg=Connected address=10.10.0.2:4244 tls=true peer=siriussec -msg=Connected address=10.10.0.5:4244 tls=true peer=linode - -# scrape targets (Prometheus CR selects label release=kube-prometheus-stack) -serviceMonitor/kube-system/hubble/0 up 10.10.0.1:9965 / 10.10.0.2:9965 / 10.10.0.5:9965 -serviceMonitor/kube-system/hubble-relay/0 up 10.244.0.75:9966 -serviceMonitor/kube-system/cilium-operator/0 up 10.10.0.2:9963 -23 active targets, 23 up / 0 down (was 18/18 before this card) - -# flows are real (Prometheus) -hubble_flows_processed_total = 4586 hubble_drop_total = 8 -hubble_tcp_flags_total = 1471 hubble_icmp_total = 36 -hubble_flows_processed_total{type="PolicyVerdict"} = 178 # policy-verdict data -hubble_http_requests_total = 281 -# relay's own view: hubble_relay_pool_peer_connection_status{status="READY"} = 3 - -# PHONE PATH — bare IP, no hosts entry, no Host header (from Legion) -$ curl -sS -o /dev/null -w '%{http_code}' http://10.10.0.2:8084/ -> 200 -$ curl -sS http://10.10.0.2:8084/ | grep -o '<title>.*' -> Hubble UI -$ curl -sS -o /dev/null -w '%{http_code}' http://10.10.0.2:8081/ -> 302 (Grafana, unbroken) - -# the UI actually works, not just its shell: headless Chromium against the bare IP -# /?namespace=kube-system -> service map rendered, status dot green, -# "64.7 flows/s", "3/3 nodes", flow table populated -# backend log: GetEventsRequest parsed (ServiceMapStream) + watcher is running -# (ControlStream) -> hubble-relay:80, FlowStream streaming -$ kubectl -n kube-system logs deploy/hubble-ui -c backend --tail=2 | grep -c Stream -2 - -# negative 1 — LAN (from Legion, 192.168.1.0/24) -$ curl -m 3 http://192.168.1.179:8084/ -> 000 (timeout) # siriussec nft -$ curl -m 3 http://192.168.1.125:8084/ -> 000 (timeout) # rpi ufw -# negative 2 — internet: no hubble/lab.internal entry in the cloudflared ingress -# (9 hostnames, all public sites), and no tunnel points at 8084. -# regression: forgejo.siriusdevops.com -> 200 through the tunnel; Grafana 302. - -# envoy health after the move -kubectl -n kube-system get pods -l k8s-app=cilium-envoy # both 1/1, RESTARTS 0 -logs --since=60s | grep -c 'cannot bind' # 0 -``` - -**Only `10.10.0.2` answers.** As of 2026-10-27 that is true structurally, not -just in practice: `10.10.0.1:8081/:8084` have **no listener** (rpi lost -`gateway=true` — see §12); before the fix they returned **503 after exactly -5 s, even from rpi's own `127.0.0.1`**, because Envoy on a node that does not -run the backend completes the TCP handshake and never ACKs. The Gateway status -still lists all three node addresses (Cilium ignores `spec.addresses`); the -serving address is the one the backends are pinned to, `10.10.0.2`. - -## 11. Internal DNS: the `lab.internal` zone - -Facts: zone `lab.internal`, resolver `10.10.0.1` (and `10.20.0.2`), records -`grafana.lab.internal` and `hubble.lab.internal` → `10.10.0.2`, configured by -`infrastructure/networking/internal/dns/`. The record does **not** carry a -port: Grafana stays on `:8081`, Hubble UI on `:8084`, so the URLs are -`http://grafana.lab.internal:8081/` and `http://hubble.lab.internal:8084/`. - -### 11.1 What "split DNS" can and cannot mean here - -The WireGuard clients in use (Android, iOS, and the desktop clients) hand the -tunnel's DNS server to the OS as **the device resolver for everything while -the tunnel is up**. There is no client-side per-domain split, and nothing on -the server side can create one. So: - -- the resolver on the hub **answers `lab.internal` itself** (authoritative, - `local=/lab.internal/`, never forwarded), and -- **forwards every other query** to the upstreams in the Pi's - `/etc/resolv.conf` (today `100.100.100.100` = Tailscale MagicDNS, which - forwards to the ISP resolvers `137.118.204.9` / `137.118.1.32`). - -Public resolution therefore keeps working *through* the tunnel resolver — it -is not "split on the client", it is "one resolver that knows one private zone -and forwards the rest". Public names stay on public DNS; there are no -split-horizon records for `siriusdevops.com`, `piedmonthomesvc.com` or -`siriusgrowthsolutions.com` and there must not be. - -**The risk this creates:** while the tunnel is up, a dead resolver is a dead -internet connection for that device. Rollback is in §11.6. - -### 11.2 Where it runs, and why not in the cluster - -`dnsmasq` **on rpi** — the WireGuard hub, `10.10.0.1` on `wg0` and `10.20.0.2` -on `wg-remote`. It is a host service, deliberately **not** behind Cilium's -internal Gateway: those listeners have their own failure mode (`t_e9564aa3`, -Envoy on the wrong node answers 503 after 5 s) and DNS must not inherit it. -Host ports on the Pi over WireGuard work (SSH on `10.10.0.1:22` is proof). - -dnsmasq was already the Pi's resolver (it also answers `.rpi.local`), so this -extends it instead of adding a second resolver on port 53. Artifacts: - -| File | Installed to | Purpose | -|---|---|---| -| `dns/lab-internal.conf` | `/etc/dnsmasq.d/lab-internal.conf` | zone authority, `addn-hosts`, bind list | -| `dns/lab-internal.hosts` | `/etc/dnsmasq-lab-internal.hosts` | the records (hosts(5) syntax) | -| `dns/rpi-ufw-dns.sh` | — | ufw allow/deny for `:53` | -| `dns/install-rpi-dns.sh` | — | installs all of the above, restarts, prints bind view | - -The hosts file lives **outside** `/etc/dnsmasq.d` on purpose: the unit passes -`-7 /etc/dnsmasq.d`, so every file in that directory is parsed as config, and a -hosts file there fails the start with `bad option at line 9`. - -Install / re-install (host artifacts — a Pi reinstall has to re-run this): - -```bash -bash infrastructure/networking/internal/dns/install-rpi-dns.sh # as root on rpi -``` - -### 11.3 Listen addresses and the firewall boundary - -`bind-dynamic` + `interface=lo`, `interface=wg0`, `interface=wg-remote`: -53 is bound on `127.0.0.1`, `10.10.0.1`, `10.20.0.2` (and `::1`) and **nowhere -else** — not on `192.168.1.125`, not on the tailscale address. `bind-dynamic` -also means a WireGuard interface that is down at boot is picked up when it -appears, with no restart and no hard `Requires=` on a `wg-quick@` template unit. - -ufw is the second layer (and the one that produces the DROP evidence), inserted -above the `allow from 192.168.1.0/24` catch-all: - -``` -53/udp,tcp ALLOW IN 10.10.0.0/24 # mesh (siriussec, Pi-hub peers) -53/udp,tcp ALLOW IN 10.20.0.0/24 # remote hub + its spokes (the phone, Legion) -53/udp,tcp ALLOW IN 10.244.0.0/16 # pods -53/udp,tcp DENY IN Anywhere # LAN, tailscale, internet -``` - -`10.20.0.0/24` is not optional: the phone and Legion are spokes of the -**linode** hub (`10.20.0.1`), so their DNS packets reach the Pi on `wg-remote` -with source `10.20.0.3` / `10.20.0.5`. With only the mesh subnet allowed, the -hub-spoke clients time out (§11.7 negative 3). - -No Cloudflare change: the tunnel's ingress list is an allow-list of HTTP -hostnames pointing at `:8080`; UDP/TCP 53 is not proxied by it and there is no -port-forward on the LAN edge. `*.lab.internal` has no public record. - -### 11.4 Adding a record - -1. Add one line to `dns/lab-internal.hosts` — `
\t` — commit it. -2. On rpi: `sudo install -m 0644 dns/lab-internal.hosts /etc/dnsmasq-lab-internal.hosts - && sudo systemctl reload dnsmasq` (a reload re-reads `addn-hosts`; no restart, - no dropped queries). -3. Verify: `dig +short @10.10.0.1`. - -Only `lab.internal` is authoritative. A query for anything else, *including* -`siriusdevops.com`, is forwarded — do not add public names here. - -Which address to record: **`10.10.0.2`** today, because siriussec is the only -node carrying `node-role.kubernetes.io/gateway=true` and therefore the only one -with a listener that can complete a request to the backends. If that changes -(the label moving back to rpi once the arm64/Envoy co-location issue is solved), -it is a one-line change in `dns/lab-internal.hosts` + reload. - -### 11.5 Client configuration - -The phone is **`Pixel 9 Pro`**, WireGuard peer `10.20.0.3` on the **linode** -hub (`10.20.0.1:51820`) — not a `wg0` peer of the Pi: its handshake is -seconds old on the linode hub, while the Pi's `wg0` peer `10.10.0.4` -(`Peer SiriusMobile`) has been stale for days. Its DNS therefore has to be set -in the phone's own WireGuard profile. The Pi's `wg0.conf` peers (and the -`wgportal` DB) are *not* where the phone's DNS lives, and wgportal is not even -running on the Pi today (`docker ps` has no wgportal container) — so nothing on -the server side can push this; do not go looking for a portal toggle. - -**Android (WireGuard app) — 3 steps:** - -1. Open the WireGuard app → tap the tunnel → pencil (Edit) → **Interface** - section → **DNS servers** → enter `10.10.0.1` (leave "Excluded applications" - alone). -2. Save, then toggle the tunnel **off and on** (Android keeps the old - `resolver1` until the tunnel restarts). -3. Check: browser to `http://grafana.lab.internal:8081/` → login page; and any - public site still loads (proof forwarding works). - -If that profile's `AllowedIPs` does not cover `10.10.0.0/24`, use **`10.20.0.2`** -(the Pi's address on the hub subnet) instead — both answer, both are the same -resolver. - -**iOS:** WireGuard app → tunnel → Edit → *DNS Servers* → `10.10.0.1` → Save → -toggle off/on. - -**Desktop (wg-quick):** in the tunnel's `[Interface]` add `DNS = 10.10.0.1` -and, because this is a non-systemd-resolved-specific option, -`resolvconf`/`openresolv` must be present (`wg-quick` uses it to point the -system resolver at the tunnel); then `wg-quick down && wg-quick up `. -There is no per-domain split — the whole machine uses it while the tunnel is -up. - -Do not point a **cluster node** at this resolver: nodes and pods must keep -their own DNS (`CoreDNS` / `/etc/resolv.conf`) or kubelet and pod lookups will -break. This is for client devices only. - -### 11.6 Rollback (do this first when DNS "breaks the internet") - -On the device: WireGuard app → tunnel → Edit → clear the **DNS servers** field -→ Save → toggle the tunnel off/on. That restores the OS resolver immediately. -On the server: `sudo systemctl disable --now dnsmasq` stops the Pi's resolver -(don't — it also serves `.rpi.local`); to remove only the zone, delete -`/etc/dnsmasq.d/lab-internal.conf` and `/etc/dnsmasq-lab-internal.hosts` and -`systemctl restart dnsmasq`. To close the port again, remove the six `wg-dns` -ufw rules (`ufw status numbered`, then `ufw delete `). - -### 11.7 Verification log — 2026-10-27 - -Resolver: `dnsmasq` 2.91 on rpi, enabled at boot (`systemctl is-enabled dnsmasq` -= `enabled`), ufw `enabled`. Listeners (no `0.0.0.0`, no LAN address): - -``` -$ sudo ss -lntuH 'sport = :53' -udp 127.0.0.1:53 udp 10.10.0.1:53 udp 10.20.0.2:53 udp [::1]:53 -tcp 127.0.0.1:53 tcp 10.10.0.1:53 tcp 10.20.0.2:53 tcp [::1]:53 -$ sudo journalctl -u dnsmasq -n 4 -using nameserver 100.100.100.100#53 # forwarded upstreams (tailscale MagicDNS) -using only locally-known addresses for lab.internal -read /etc/dnsmasq-lab-internal.hosts - 2 names -``` - -`10.10.0.1:8081`/`:8084` flap. `:53` does not: it is a host socket, not Envoy. - -**Positive — from a WireGuard client (Legion, `10.20.0.5`, via the linode hub):** - -``` -$ dig +short grafana.lab.internal @10.10.0.1 -> 10.10.0.2 -$ dig +short hubble.lab.internal @10.10.0.1 -> 10.10.0.2 -$ dig +short grafana.lab.internal @10.20.0.2 -> 10.10.0.2 -$ dig +tcp +short grafana.lab.internal @10.10.0.1 -> 10.10.0.2 -$ dig +short example.com @10.10.0.1 -> 104.20.23.154 / 172.66.147.243 # forwarding -$ dig nosuch.lab.internal @10.10.0.1 -> status: NXDOMAIN # authoritative, not forwarded -``` - -From a mesh peer (`siriussec`, `10.10.0.2`): all three names `rcode 0` -(`grafana.lab.internal`, `hubble.lab.internal`, `example.com`). From the Pi's -own loopback: same, plus `nope.lab.internal` → `NXDOMAIN`. - -**Negative — LAN and counters** (from Legion on `192.168.1.126`, same host that -resolved fine over the tunnel a second earlier): - -``` -$ dig +time=3 grafana.lab.internal @192.168.1.125 -> timed out, no servers could be reached -$ dig +tcp +time=3 grafana.lab.internal @192.168.1.125 -> timed out -$ sudo iptables -L ufw-user-input -n -v | grep dpt:53 - 2 120 ACCEPT tcp 10.20.0.0/24 dpt:53 # hub spokes (the phone's path) - 3 188 ACCEPT udp 10.10.0.0/24 dpt:53 # mesh - 7 602 ACCEPT udp 10.20.0.0/24 dpt:53 - 3 180 DROP tcp 0.0.0.0/0 dpt:53 # LAN / internet - 1 89 DROP udp 0.0.0.0/0 dpt:53 -``` - -**Regression:** `http://10.10.0.2:8081/` → 302 (Grafana login), `:8084/` → 200 -(Hubble UI), public sites through the tunnel unchanged (no Cloudflare object -touched). - -**Reboot survival:** `systemctl is-enabled dnsmasq` = `enabled`; the unit -`Requires=network-online.target` and has **no** `Requires=`/`After=` on any -`wg-quick@` template (which is `enabled` but currently `inactive` because `wg0` -was brought up by hand — a hard dependency would fail the boot). `bind-dynamic` -picks up `wg0`/`wg-remote` whenever they appear. Records and the bind list live -in `/etc/dnsmasq*`, not in `/run`; ufw rules are persistent. - -## 12. Verification log — 2026-10-27 (the flap: rpi was a second, broken gateway node) - -Symptom Lance saw: the internal dashboards "work / don't work" from his phone, -while they were rock-steady from a laptop. Nothing was flapping at 10.10.0.2 — -the flapping address was **10.10.0.1**. - -**Root cause.** rpi carried `node-role.kubernetes.io/gateway=true` alongside -siriussec, so `cilium-envoy` ran there and bound `0.0.0.0:8080/8081/8084`. Its -Envoy completes TCP to a backend pod on siriussec but never finishes the -request (SYN-ACK back, no ACK on `reserved:ingress`), so every request on the Pi -hung and then failed. Fixed by removing the label: **one gateway node, one -serving address.** - -**Premise corrected — the Pi's listener was not "bound but unresponsive".** A -4 s `curl` timeout made it look like a dead socket; the socket is fine and -answers. The exact shape of the failure is a **503 after 5.000 s**, which is the -upstream-connect timeout, not a stuck accept loop (`ss -lnt` Recv-Q 0, backlog -never filled): - -``` -# on rpi, before the fix -$ curl -s -o /dev/null -m 15 -w '%{http_code} %{time_total}\n' http://127.0.0.1:8081/ -503 5.003515 -$ curl -s -o /dev/null -m 15 -w '%{http_code} %{time_total}\n' http://127.0.0.1:8084/ -503 5.003963 -$ curl -s -o /dev/null -m 15 -w '%{http_code} %{time_total}\n' http://10.10.0.1:8081/ -503 5.000658 -``` - -**Envoy's own config (admin unix socket), pre-fix** — all three listeners are -identical in shape, which rules out a per-listener config fault: - -``` -$ sudo curl -s --unix-socket /var/run/cilium/envoy/sockets/admin.sock \ - http://localhost/config_dump -LISTENER internal/cilium-gateway-hubble-ui/listener addr={'address': '0.0.0.0', 'port_value': 8084} -LISTENER gateway-system/cilium-gateway-public/listener addr={'address': '0.0.0.0', 'port_value': 8080} -LISTENER internal/cilium-gateway-internal/listener addr={'address': '0.0.0.0', 'port_value': 8081} - transparent=None use_original_dst=None - listener_filters=['envoy.filters.listener.tls_inspector', 'cilium.bpf_metadata'] - FC match: {"transport_protocol": "raw_buffer"} # no per-address filter chains -``` - -Killed hypotheses: no `original_dst` / address-scoped filter chains (so the -destination IP is irrelevant — that is why `127.0.0.1` failed the same way), no -missing bind, no firewall. What differed was **which node the Envoy pod ran on**. - -``` -# the fix: exactly one node carries the label -$ kubectl label node rpi node-role.kubernetes.io/gateway- -node/rpi unlabeled -$ kubectl get nodes -l node-role.kubernetes.io/gateway=true -o name -node/siriussec -$ kubectl -n kube-system get pods -l k8s-app=cilium-envoy -o wide -cilium-envoy-xfkfq 1/1 Running 0 10.10.0.2 siriussec # the rpi pod is gone -``` - -`Gateway.status.addresses` still lists `10.10.0.1 10.10.0.2 10.10.0.5` (every -node InternalIP) and Cilium ignores `spec.addresses` (cilium#29060), so that -field is not a VIP and not a "try either IP" list. Also note the Pi's ufw accept -rules never showed a packet counter while requests to `10.10.0.1:8081` *were* -reaching Envoy (proved by the 503 body) — `ufw status` does not expose counters, -and "0 packets" there is not evidence the packet never arrived. - -**Matrix after the fix** (`curl -m 6`, code + seconds): - -| Vantage point | 10.10.0.1:8081 | 10.10.0.1:8084 | 10.10.0.2:8081 | 10.10.0.2:8084 | -|---|---|---|---|---| -| Legion over WG (10.20.0.5 → mesh) | 000 (6.00, ufw DROP) | 000 (6.00) | **302** (0.11) | **200** (0.11) | -| rpi itself, `10.10.0.1` | 000 (0.0002, no listener) | 000 (0.0002) | **302** (0.003) | **200** (0.002) | -| rpi itself, `127.0.0.1` | 000 (0.0002, no listener) | 000 (0.0002) | — | — | -| pod on siriussec (10.244.0.118) | 000 (0.0006) | 000 (0.0007) | **302** (0.001) | **200** (0.001) | - -`sudo ss -lntH` on rpi: **0** sockets on 8081/8084 (was 4 + 4, reuseport). - -**Firewall counters — the working path is provably accepted, not just "no -error"** (the accept rules now carry `counter`): - -``` -$ curl http://10.10.0.2:8081/ ; curl http://10.10.0.2:8084/ # from Legion, a pod, and locally on siriussec -$ sudo nft list table inet internal_gw # on siriussec -tcp dport { 8081, 8084 } iifname "lo" counter packets 48 bytes 3200 accept -tcp dport { 8081, 8084 } ip saddr { 10.10.0.0/24, 10.244.0.0/16 } counter packets 948 bytes 164449 accept -tcp dport { 8081, 8084 } counter packets 17 bytes 1020 drop # LAN attempts -``` - -**Flap detection** — `monitoring/controllers/home/gateway-probe.yaml` -(blackbox-exporter on siriussec + a `Probe` every 30 s + `PrometheusRule` -`InternalGatewayUnreachable` / `InternalGatewayProbeMissing`): - -``` -$ kubectl -n flux-system get kustomization monitoring -o jsonpath='{.status.lastAppliedRevision}' -master@sha1:48b2b6a... -$ kubectl -n monitoring get pods | grep blackbox -blackbox-exporter-78b95b789c-b4gl8 1/1 Running -$ # /api/v1/targets (Prometheus, port-forward) -probe/monitoring/internal-gateway http://10.10.0.2:8081/ up -probe/monitoring/internal-gateway http://10.10.0.2:8084/ up -probe_success{job="internal-gateway"} 1, 1 -# it also caught a real flap while this card was being verified: the concurrent -# Grafana-persistence card recreated the pod and 8081 answered 503 for ~25 s. -# Negative proof of the detector: a third target pointed at the (dead) -# 10.10.0.1:8081 produced probe_success 0 and -# ALERTS{alertname="InternalGatewayUnreachable",alertstate="pending", -# instance="http://10.10.0.1:8081/"} = 1 -# (state cleared when Flux re-applied the Probe from git before `for: 3m` -# elapsed, so `firing` was not observed end-to-end). -``` - -There is **no Alertmanager** in the stack, so this is visible in Prometheus -`/alerts` and Grafana → Alerting, not paged. Next step if a page is wanted: add -a contact point/receiver, not another probe. - -The probe catches the **symptom**; `GatewayNodeCountNotOne` -(`count(kube_node_role{role="gateway"}) != 1`, 5 m) catches the **cause** — -kube-state-metrics exposes role labels as `kube_node_role`, so relabelling a -node is visible without a second scrape target. Both were proved by putting the -bug back on purpose: - -``` -$ kubectl label node rpi node-role.kubernetes.io/gateway=true --overwrite -node/rpi labeled -$ kubectl -n kube-system get pods -l k8s-app=cilium-envoy --no-headers -cilium-envoy-fwcqm Running rpi # the second Envoy is back -cilium-envoy-xfkfq Running siriussec -# the original fault, reproduced exactly, from rpi itself: -$ curl -m 15 -w '%{http_code} %{time_total}\n' http://10.10.0.1:8081/ -> 503 4.999340 -$ curl -m 15 -w '%{http_code} %{time_total}\n' http://127.0.0.1:8081/ -> 503 5.001838 -$ curl -m 6 -w '%{http_code} %{time_total}\n' http://10.10.0.2:8081/ -> 302 0.005733 -# ~5 min later, the label alert fires (nothing paged, no user impact): -ALERTS{alertname="GatewayNodeCountNotOne",alertstate="firing"} = 1 -$ kubectl label node rpi node-role.kubernetes.io/gateway- -node/rpi unlabeled -$ kubectl get nodes -l node-role.kubernetes.io/gateway=true -o name -node/siriussec -# and 10.10.0.1 is a closed port again (000 in 0.2 ms), 10.10.0.2 still 302/200 -``` - -**Negatives re-proved after the change** - -``` -# LAN (from Legion, 192.168.1.0/24) — DROP on both nodes, both ports -192.168.1.179:8081 -> 000 (curl 28, 4.0 s) 192.168.1.179:8084 -> 000 -192.168.1.125:8081 -> 000 (curl 28, 4.0 s) 192.168.1.125:8084 -> 000 -# public: internal hostnames have no route on the public listener -curl -H 'Host: grafana.lab.internal' http://10.10.0.2:8080/ -> 404 -curl -H 'Host: hubble.lab.internal' http://10.10.0.2:8080/ -> 404 -# tunnel ingress = 9 entries, every service http://10.10.0.2:8080, no lab.internal -# public sites through the tunnel still 200 (from rpi): -# siriusdevops.com 200 forgejo.siriusdevops.com 200 piedmonthomesvc.com 200 -# siriusgrowthsolutions.com 200 -``` - -Commit `48b2b6a` (label removal is host state — `kubectl label node rpi -node-role.kubernetes.io/gateway-`; the manifests, the counter-augmented nft file -and this document are in git). diff --git a/docs/monitoring-dashboards.md b/docs/monitoring-dashboards.md deleted file mode 100644 index 8d2704d..0000000 --- a/docs/monitoring-dashboards.md +++ /dev/null @@ -1,246 +0,0 @@ -# Monitoring dashboards - -Three custom Grafana dashboards, all provisioned from this repo. Nothing on these -boards is created in the UI: the `kube-prometheus-stack` Grafana sidecar watches -for ConfigMaps labelled `grafana_dashboard=1` in **every** namespace -(`NAMESPACE=ALL`, `LABEL_VALUE=1`, `FOLDER=/tmp/dashboards`) and reloads them, so -a UI edit is overwritten on the next sidecar poll. - -| Dashboard | UID | Answers | -|---|---|---| -| Forgejo Runners | `forgejo-runners` | Are the runners alive and polling, is CI queueing, how do runs end, and how full is the disk CI fills? | -| CNPG Postgres | `cnpg-postgres` | Are both Postgres clusters up, how busy, how big, how much WAL, is anything erroring? | -| Home lab workloads | `home-lab-workloads` | Which namespace is burning CPU/memory, what is Pending or restarting, are the nodes healthy, do the internal services answer? | - -Open them (WireGuard only, no public hostname — see -`docs/internal-wireguard-services.md`): - -``` -http://10.10.0.2:8081/d/forgejo-runners/ -http://10.10.0.2:8081/d/cnpg-postgres/ -http://10.10.0.2:8081/d/home-lab-workloads/ -``` - -They land in the default **General** folder, next to the chart's own dashboards — -not in a custom folder. That is a consequence of *how* they get imported: the -sidecar's API-backed import POSTs to `/api/admin/provisioning/dashboards/reload` -with `GF_SECURITY_ADMIN_USER/PASSWORD`, and on this Grafana that returns **401** -because the live admin password is the out-of-band one set in the UI -(`docs/grafana-persistence.md`) while `monitoring/grafana-admin` is only the -first-boot seed. Grafana's own **file** provider then imports `/tmp/dashboards` -on its 10 s rescan anyway — that is what actually registers these boards — and -the file provider has no per-dashboard folder option. Hence no `grafana_folder` -annotation: it would only describe a path the boards do not take. - -## Where the files live - -``` -monitoring/controllers/home/dashboards/ -├── build.py # source of truth: panel definitions + PromQL -├── kustomization.yaml -├── forgejo-runners.yaml # GENERATED ConfigMap (JSON inside) -├── cnpg-postgres.yaml # GENERATED -└── home-lab-workloads.yaml # GENERATED -``` - -**Edit `build.py`, then regenerate.** The generated YAML is committed so Flux -applies exactly what was reviewed, but a hand edit to the YAML fights the next -regeneration. - -```bash -cd ~/Projects/homek8s -python3 monitoring/controllers/home/dashboards/build.py monitoring/controllers/home/dashboards -``` - -## Getting Postgres metrics at all - -Neither CNPG cluster was scraped before this work. Two pieces, both in git: - -1. **A PodMonitor per cluster** — `apps/base/forgejo/podmonitor.yaml`, - `apps/base/sirius-growth/podmonitor.yaml`. They carry - `release: kube-prometheus-stack`, which is mandatory: Prometheus here keeps - the chart default `podMonitorSelectorNilUsesHelmValues: true`, so its selector - is literally `release=kube-prometheus-stack` (same reason the Cilium - ServiceMonitors in `kube-system` land). A PodMonitor without that label exists - happily and is never scraped — the failure mode is silence, not an error. -2. **`spec.monitoring.customQueriesConfigMap` on each `Cluster`** — the - operator's own `cnpg-default-monitoring` query set, plus, for `forgejo/pg`, - `forgejo-actions-queries`. - -`spec.monitoring.enablePodMonitor` is deliberately **false**. It still works on -operator 1.30, but CNPG deprecated it in 1.27 ("we strongly recommend you remove -or set `enablePodMonitor` to `false` and manually create a PodMonitor") and the -operator-generated object gives no control over labels — which is precisely the -knob this stack needs. Owning the PodMonitor in git is both the upstream -recommendation and the only way to make the selector contract explicit. - -### The Forgejo Actions metrics and their GRANT - -`apps/base/forgejo/pg-actions-queries.yaml` adds four queries against the -`forgejo` database (CNPG runs custom queries on the cluster's *main* database — -`initdb.database`, i.e. `forgejo` here): - -| Metric | Meaning | -|---|---| -| `cnpg_actions_queue_depth` | jobs handed to a runner that have not started (`started=0, stopped=0, status<>4`) | -| `cnpg_actions_queue_oldest_pending_seconds` | age of the oldest of those | -| `cnpg_actions_running_total` | jobs executing right now | -| `cnpg_actions_jobs_window_total{window,status}` | jobs finished in a rolling 1h/24h window, by status | -| `cnpg_actions_runners_last_online_seconds{runner}` | seconds since each runner polled Forgejo | - -**Custom queries run as `cnpg_metrics_exporter`, not as `postgres`.** That role -has `pg_monitor` but no rights on Forgejo's tables, and a query that cannot read -its table yields **no metric at all** — silently. So once per database (not once -per deploy; it survives as long as the data directory does): - -```bash -kubectl -n forgejo exec pg-1 -c postgres -- psql -U postgres -d forgejo -c \ - 'GRANT USAGE ON SCHEMA public TO cnpg_metrics_exporter; - GRANT SELECT ON action_run_job, action_task, action_runner TO cnpg_metrics_exporter;' -``` - -Re-apply it after a restore into a fresh cluster (a fresh `initdb` has no grants). - -### Status codes - -`action_run_job.status` / `action_run.status` are **1 = success, 2 = failure, -3 = cancelled, 4 = skipped**. This was verified on this instance, not assumed: -DB run 1189 (status 1) reports `conclusion: success` on -`/api/v1/repos/sirius/onionwire/actions/runs`, run 1191 (status 2) `failure`. -Queue depth excludes status 4 because skipped jobs never start, never stop, and -are never pruned — including them would pin the queue at "3" forever. - -## The tricky panels, and the PromQL behind them - -**Queue while a job is running (contention).** The single-slot runners are -deliberate (`capacity = 1`), so the useful signal is "queued *and* running": -`(queue > bool 0) * (running > bool 0)` — the `bool` modifier turns each -comparison into 0/1 so the product is always a number (a bare `and` would render -"No data" instead of a green 0). - -```promql -max((cnpg_actions_queue_depth{namespace="forgejo"} > bool 0) - * (cnpg_actions_running_total{namespace="forgejo"} > bool 0)) -``` - -**Days to full.** Linear fit of free space, floored and capped: - -```promql -clamp_max(node_filesystem_avail_bytes{instance="10.10.0.2:9100",mountpoint="/"} - / clamp_min(-deriv(node_filesystem_avail_bytes{instance="10.10.0.2:9100",mountpoint="/"}[1h]), 0.0000001) - / 86400, 365) -``` - -`clamp_min` on the *denominator* keeps a growing-filesystem division from going -negative or infinite; `clamp_max 365` renders "not filling" as a flat year rather -than a huge number. It needs a few hours of history to be meaningful. - -**Commit share / cache hit ratio.** Both are `a / (a + b)` and both would render -`NaN` on an idle database, so the denominator is floored: - -```promql -sum(rate(cnpg_pg_stat_database_xact_commit[5m])) - / clamp_min(sum(rate(cnpg_pg_stat_database_xact_commit[5m])) - + sum(rate(cnpg_pg_stat_database_xact_rollback[5m])), 0.0000001) -``` - -**Quiet-database error counters.** `increase()` over a counter that exists -(e.g. `cnpg_pg_stat_database_deadlocks`) returns a hard `0`, so deadlocks read 0 -instead of "No data". Never use a `> 0` filter for these — it deletes the panel's -only series. - -**Rolling job counts instead of `rate()`.** Forgejo prunes old `action_run_job` -rows. `rate()` over a row count would show a fake drop at every prune, so the -throughput panels query "how many rows stopped inside the last hour" directly -(`cnpg_actions_jobs_window_total{window="1h"}`). - -## Adding a panel - -1. Edit `monitoring/controllers/home/dashboards/build.py` — `ts()` for a - timeseries, `stat()` for a single number, `note()` for markdown. -2. Regenerate (command above). -3. **Validate the PromQL, not just the YAML.** `validate_panels.py` (next to - `build.py`) reads the dashboard JSON *out of the provisioned ConfigMap*, - extracts every target expression, substitutes the `$namespace` "All" case and - queries Prometheus. Anything that returns no series is a failed panel. It - needs a Prometheus port-forward (`kubectl -n monitoring port-forward - svc/kube-prometheus-stack-prometheus 9090:9090`). - ```bash - python3 monitoring/controllers/home/dashboards/validate_panels.py \ - monitoring/controllers/home/dashboards http://127.0.0.1:9090 - ``` -4. Commit + push to `master`, then force the reconcile: - ```bash - kubectl -n flux-system annotate gitrepository flux-system \ - reconcile.fluxcd.io/requestedAt="$(date +%s)" --overwrite - kubectl -n flux-system annotate kustomization monitoring \ - reconcile.fluxcd.io/requestedAt="$(date +%s)" --overwrite - ``` - (`kustomization monitoring` will sit on `dependency 'flux-system/infrastructure' - is not ready` until you also annotate `kustomization infrastructure` — its - Ready condition is stale, not broken.) -5. Confirm the board registered. Grafana 13 stores dashboards in **unified - storage**, so `dashboard` table is empty and the UID lives in `resource`: - ```bash - ssh Lancelot@10.10.0.2 "sudo sqlite3 /opt/local-path-provisioner/pvc-*_monitoring_kube-prometheus-stack-grafana/grafana.db \ - \"select name, json_extract(value,'\$.spec.title') from resource where resource='dashboards' and name='';\"" - ``` - -Dashboards are data sources for humans: if a new panel needs a metric that does -not exist yet, add it to `pg-actions-queries.yaml` (Postgres) rather than -deploying another exporter. - -### Panel-query patterns worth copying - -- **A stat that can legitimately have no series needs `or vector(0)`.** A bare - `sum(x == 1)` over zero matching series is an *empty vector*, and Grafana - renders that as "No data" — which looks identical to a broken query. Every - count-style stat here that can hit zero ends in `or vector(0)`. -- **Beware broad pod regexes.** `pod=~"forgejo-runner-.*"` also matches the - `forgejo-runner-prune-*` CronJob pods, which are `Completed` and therefore - permanently "not Ready" — that turned a not-Ready stat from 0 into 3 until the - selector was narrowed to the three Deployment pod prefixes. -- **CNPG custom-query metrics carry `namespace`/`pod` from the scrape, not the - exporter's `cluster` label.** `cnpg_collector_*` has `cluster`; the - `cnpg_actions_*` and `cnpg_pg_stat_*` families do not. Filter those by - `namespace="forgejo"`. - -## Known unknowns (deliberate, documented on the boards themselves) - -- **Arm64 runner jobs are invisible to kube metrics.** `forgejo-runner-arm64` - and `forgejo-runner-deploy-arm64` drive the Pi's **host** Docker socket, so - their jobs are host containers with no pod identity. cAdvisor and - kube-state-metrics see only the runner pod. Per-job CPU/mem/disk on rpi is - therefore unavailable — the board shows rpi's root filesystem instead, because - that is where those containers write. -- **No per-PV usage.** kubelet 1.34+ no longer exports the alpha - `kubelet_volume_stats_*` metrics: its `/metrics/volumes` endpoint 404s on every - node here (kubelet v1.36.4, upstream kubernetes/kubernetes#133847), so there is - nothing to chart per PV and no scrape config would change that. The dind PVC's - 20Gi is shown as *requested capacity* next to siriussec's root-filesystem usage, - which is the number that actually produced the DiskPressure evictions — and the - same filesystem is what `RunnerDindDiskHighWatermark` / `RunnerDindDiskCritical` - alert on, scoped to nodes that run a runner. The chart's own - `KubePersistentVolumeFillingUp` / `KubePersistentVolumeInodesFillingUp` rules - had the same defect and are suppressed too — both are listed under - `defaultRules.disabled` in `monitoring/controllers/home/values.yaml`, so the - `kubernetes-storage` group keeps only its live rule, - `KubePersistentVolumeErrors` (kube-state-metrics). No loaded rule in this - stack selects `kubelet_volume_stats_*`. -- **Single-instance Postgres.** Both clusters run `instances: 1`, so replication - lag, streaming replicas and in-recovery are structurally zero. The panels show - the zero and say why instead of being hidden. -- **No CNPG backups exist** (`kubectl get backups.postgresql.cnpg.io -A` is - empty), so "Last available backup" reads 0 = never. That is the state, not a - broken panel. -- **No Alertmanager.** `PrometheusRule` objects (e.g. `InternalGatewayUnreachable`) - surface on Prometheus `/alerts` and in Grafana → Alerting; nothing pages. - -## Cardinality / retention - -`retention: 7d` and `retentionSize: 8GB` are unchanged. The additions are small: -two Postgres instances add a few hundred series each (the CNPG default query set -plus the four Forgejo queries), and `prometheus-node-exporter` now runs on every -node instead of only siriussec (~700 series per node) — that is what makes the -Pi's disk visible at all, and it costs far less than one day of cAdvisor for a -build pod. diff --git a/docs/site-image-pinning.md b/docs/site-image-pinning.md deleted file mode 100644 index 6c25120..0000000 --- a/docs/site-image-pinning.md +++ /dev/null @@ -1,118 +0,0 @@ -# Site images: immutable sha tags pinned in git - -Every first-party site image runs from a **tag pinned in this repo** and is rolled -by Flux. CI builds and pushes `:` and prints the exact ref; the -operator copies that ref into the Deployment manifest. There are **no cluster -credentials in any site repo** — CI cannot roll a Deployment and cannot read a -kubeconfig. - -This replaces the old model (`:latest` + `imagePullPolicy: Always` + CI patching -`kubectl.kubernetes.io/restartedAt` through a `site-deployer` ServiceAccount -token). That path is gone: the SA/Role/RoleBinding were removed and the -`KUBE_CONFIG` action secrets deleted. - -## Operator flow - -1. Push to a site repo (or `workflow_dispatch` it). The workflow builds the - amd64 image, pushes `/:`, and ends with a - `### Pin this in sirius/homek8s …` step that prints the ref. It also pushes - `:latest`, but **nothing in the cluster reads `:latest`** — it is a - convenience pointer for humans only. -2. Edit the Deployment in `apps/base//deployment*.yaml`: - - ```yaml - image: forgejo.siriusdevops.com/sirius/: - imagePullPolicy: IfNotPresent - ``` - -3. Commit + push `master`, then force the Flux recheck (gitrepository **first**, - kustomization **second** — an `apps` annotate that still reports the previous - sha has not fetched the commit): - - ```bash - kubectl -n flux-system annotate gitrepository flux-system reconcile.fluxcd.io/requestedAt="$(date +%s)" --overwrite - kubectl -n flux-system annotate kustomization apps reconcile.fluxcd.io/requestedAt="$(date +%s)" --overwrite - ``` - -4. Verify: the pod template changed, so the Deployment rolls within ~1m and the - pod reports the pinned ref. - - ```bash - kubectl -n get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.containerStatuses[0].imageID}{"\n"}{end}' - ``` - - `imageID` must name `:` and carry the digest the registry returns for - that tag (`Docker-Content-Digest`, below). - -Rollback is `git revert` of the pin commit — Flux reconciles back in ~1m. - -## Why the site repos are not Flux sources - -The only `GitRepository` cluster-wide is `flux-system` → `sirius/homek8s`. Flux -owns the *manifests*; the site repos own only their image builds. The content -revision a visitor sees is therefore chosen by the tag committed here, not by -whatever CI pushed last. A site repo push alone changes nothing in the cluster. - -## Current pins - -| Namespace | Deployment | Image ref | -|---|---|---| -| siriusdevops | siriusdevops-site | `siriusdevops-site:f0dde2f48c8224fb80d801ecb0d155c93332dc13` | -| siriusdevops | siriusdevops-contact | `siriusdevops-contact:f0dde2f48c8224fb80d801ecb0d155c93332dc13` | -| sirius-growth | sirius-growth-site | `sirius-growth-site:ea306b73b0d7c9ae8c33393a420e6d1d452b802b` | -| sirius-growth | sirius-growth-portal | `sirius-growth-portal:d9e558c4e0922d3ecd28214f7698ec0994170481` | -| sirius-growth | sirius-growth-contact | `sirius-growth-contact:c9c9379ebceca6879d3bbeff1c2601b6484e87b0` | -| piedmont | piedmont-site | `phs-site:5b590cddab6d7889fdd3c272255f28c4560e752e` | -| piedmont | piedmont-contact | `phs-contact:5035443abb62913362e416ab7030a64726886886` | - -Each pin is the tag CI printed for the commit that was deployed. (The first six -pins were chosen as the tag whose manifest was **the image already running**, so -pinning was a no-op for visitors; the two contact APIs were re-pinned after -their pipelines first ran — same source, freshly built.) - -### Contact APIs - -Both contact APIs now build in CI, on `docker-amd64`, tagging `:$sha` and -promoting `:latest` as a pointer only: - -| Repo | Workflow | `paths:` | Source | Image | -|---|---|---|---|---| -| `sirius-growth` (`master`) | `.forgejo/workflows/deploy-contact.yml` | `contact-api/**` | `contact-api/` | `sirius/sirius-growth-contact` | -| `sirius/websites` (`main`) | `.forgejo/workflows/deploy-phs-contact.yml` | `phs-contact-api/**` | `phs-contact-api/` | `sirius/phs-contact` | - -They used to be hand-built (`:latest` only) and therefore pinned by `@sha256:`. -A change to either API is now a push → printed `:` ref → bump the pin here. - -## Registry facts - -- Registry: `forgejo.siriusdevops.com` (Forgejo packages, `[packages] ENABLED = true`). -- Reads/writes need a `read:package` / `write:package` scoped token; the stored - `~/.git-credentials` oauth2 token is git-scoped and is rejected by `/v2/`. -- **Tags do not expire.** `package_cleanup_rule` has zero rows and `app.ini` has - no cleanup cron, so a pinned `:` stays resolvable. -- Prove a pin `T` for image `I` without pulling anything: - - ```bash - curl -s -u "sirius:$TOK" -H 'Accept: application/vnd.oci.image.index.v1+json,application/vnd.docker.distribution.manifest.list.v2+json,application/vnd.docker.distribution.manifest.v2+json' \ - -D - -o /dev/null "https://forgejo.siriusdevops.com/v2/sirius/$I/manifests/$T" | grep -i docker-content-digest - ``` - -## Pitfalls - -- **`docker buildx imagetools create` (the `:latest` promote step) wraps a - single-arch image in an index**, so the `:latest` digest differs from the - `:` digest even though the content is identical. Compare the *config* - digest, or compare the running pod's digest to the `:` tag, never - `:latest` vs the sha tag. -- The amd64 runner's job image (`node:20-bullseye`) has no docker CLI, so the - site workflows fetch the binaries each run — and both hosts have been observed - to stall for the full 300s (`curl: (28) … 0 out of 0 bytes`). The static docker - client tries `download.docker.com` then `mirrors.aliyun.com`; **buildx is copied - out of the `docker:27-dind` image the runner already holds** - (`docker create docker:27-dind` → `docker cp …/cli-plugins/docker-buildx`), - with the GitHub release URL only as a fallback. Before that change a - three-attempt retry of the GitHub CDN failed all three times inside a job - container while the same URL fetched fine outside one. -- `runs-on` matters: site images are `linux/amd64` and only siriussec serves - them. Build them on `docker-amd64` / `deploy-arm64`, never on the arm64 - `docker` runner. diff --git a/infrastructure/controllers/cert-manager/kustomization.yaml b/infrastructure/controllers/cert-manager/kustomization.yaml deleted file mode 100644 index 77c66d9..0000000 --- a/infrastructure/controllers/cert-manager/kustomization.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: cert-manager -resources: - - namespace.yaml - - repository.yaml - - release.yaml diff --git a/infrastructure/controllers/cert-manager/namespace.yaml b/infrastructure/controllers/cert-manager/namespace.yaml deleted file mode 100644 index c90416f..0000000 --- a/infrastructure/controllers/cert-manager/namespace.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: cert-manager diff --git a/infrastructure/controllers/cert-manager/release.yaml b/infrastructure/controllers/cert-manager/release.yaml deleted file mode 100644 index a58ae37..0000000 --- a/infrastructure/controllers/cert-manager/release.yaml +++ /dev/null @@ -1,64 +0,0 @@ -# cert-manager — installed for one reason: the Barman Cloud CNPG-I plugin -# expects its operator/plugin mTLS pair as cert-manager `Certificate` objects -# (the upstream v0.16.0 manifest ships an Issuer + two Certificates and assumes -# cert-manager is present). CNPG-I *can* run on hand-made cert bundles, but that -# would put a CA private key in a hand-maintained Secret with no renewal; the -# chart is the supported path and is ~3 small pods. -# -# CRDs: `crds.enabled: true` is required — `Certificate`/`Issuer` do not exist -# otherwise. The chart annotates its CRDs with `helm.sh/resource-policy: keep`, -# so uninstalling the release does not delete issued certs' CRDs out from under -# the running plugin. Do not add `crds.keep: false`. -apiVersion: helm.toolkit.fluxcd.io/v2 -kind: HelmRelease -metadata: - name: cert-manager - namespace: cert-manager -spec: - releaseName: cert-manager - interval: 15m - chart: - spec: - chart: cert-manager - version: "v1.21.3" - sourceRef: - kind: HelmRepository - name: jetstack - namespace: cert-manager - install: - crds: CreateReplace - remediation: - retries: 3 - upgrade: - crds: CreateReplace - remediation: - retries: 3 - values: - crds: - enabled: true - # Homelab sizing: upstream requests are already small, but the webhook and - # cainjector each get a memory ceiling so a runaway cannot evict the CNPG - # primary that shares this node. - resources: - requests: - cpu: 10m - memory: 64Mi - limits: - memory: 192Mi - webhook: - resources: - requests: - cpu: 10m - memory: 32Mi - limits: - memory: 128Mi - cainjector: - resources: - requests: - cpu: 10m - memory: 64Mi - limits: - memory: 192Mi - # No Prometheus Operator CRs here (ServiceMonitor is not installed). - prometheus: - enabled: false diff --git a/infrastructure/controllers/cert-manager/repository.yaml b/infrastructure/controllers/cert-manager/repository.yaml deleted file mode 100644 index 2fad310..0000000 --- a/infrastructure/controllers/cert-manager/repository.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1 -kind: HelmRepository -metadata: - name: jetstack - namespace: cert-manager -spec: - interval: 24h - url: https://charts.jetstack.io/ diff --git a/infrastructure/databases/base/kustomization.yaml b/infrastructure/databases/base/kustomization.yaml index 89db5d0..b83b23e 100644 --- a/infrastructure/databases/base/kustomization.yaml +++ b/infrastructure/databases/base/kustomization.yaml @@ -1,27 +1,3 @@ -# CloudNativePG operator, pinned at 1.30.0, plus the CNPG-I Barman Cloud plugin. -# -# The operator was installed by hand at some point and Flux did not own it, so -# a kubectl patch was lost on every reinstall. The upstream release manifest is -# vendored verbatim (sha256 f8bede43fe4ee0d478c2355b204a36876b2ae4faac60f2a9452280b293da3b88, -# https://github.com/cloudnative-pg/cloudnative-pg/releases/download/v1.30.0/cnpg-1.30.0.yaml) -# and patched only for the deltas that already existed live plus the widened -# leader-election window. Do not upgrade the version in this directory without -# a separate, tested change: the CRDs are in this bundle. -# -# The Barman Cloud plugin is the replacement for the in-tree barman-cloud -# integration that 1.30 still ships but deprecates (removed in 1.31). Also -# vendored verbatim (sha256 -# aee614683892dd4b44ff9f7afaca55254f1c28de17abbaa0552bf2e1228f7155, -# https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v0.16.0/manifest.yaml): -# a separate Deployment in cnpg-system, registered with the operator through -# Service annotations, carrying the `ObjectStore` CRD (barmancloud.cnpg.io). Its -# operator<->plugin mTLS pair is issued by cert-manager (Flux Kustomization -# `cert-manager`). v0.16.0 requires CloudNativePG >= 1.30 — satisfied above. apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -resources: - - upstream/cnpg-1.30.0.yaml - - upstream/plugin-barman-cloud-0.16.0.yaml -patches: - - path: patch-controller-manager.yaml - - path: patch-barman-cloud.yaml +resources: [] diff --git a/infrastructure/databases/base/patch-barman-cloud.yaml b/infrastructure/databases/base/patch-barman-cloud.yaml deleted file mode 100644 index 7b4cb19..0000000 --- a/infrastructure/databases/base/patch-barman-cloud.yaml +++ /dev/null @@ -1,36 +0,0 @@ -# Delta on the vendored Barman Cloud plugin manifest (0.16.0). -# -# Upstream ships the plugin operator with `--log-level=debug`. On this cluster -# nothing scrapes the plugin's logs and siriussec's root filesystem is the -# tightest disk in the estate, so the arg is lowered to `info`. Everything else -# in the release manifest is used verbatim — including the Service annotations -# (`cnpg.io/pluginName`, `cnpg.io/pluginPort`, `cnpg.io/pluginClientSecret`, -# `cnpg.io/pluginServerSecret`) that are the actual CNPG-I registration. -# -# The whole `args` list is restated because strategic merge replaces a container -# `args` list rather than merging it. -apiVersion: apps/v1 -kind: Deployment -metadata: - name: barman-cloud - namespace: cnpg-system -spec: - template: - spec: - containers: - - name: barman-cloud - args: - - operator - - --server-cert=/server/tls.crt - - --server-key=/server/tls.key - - --client-cert=/client/tls.crt - - --server-address=:9090 - - --leader-elect - - --log-level=info - resources: - requests: - cpu: 50m - memory: 64Mi - limits: - cpu: 500m - memory: 256Mi diff --git a/infrastructure/databases/base/patch-controller-manager.yaml b/infrastructure/databases/base/patch-controller-manager.yaml deleted file mode 100644 index ea7acc1..0000000 --- a/infrastructure/databases/base/patch-controller-manager.yaml +++ /dev/null @@ -1,51 +0,0 @@ -# Live-state delta for the CloudNativePG operator, kept deliberate. -# -# Everything below is a hand-applied change that exists on the running -# cnpg-controller-manager but is NOT in the upstream 1.30.0 release manifest. -# Adopting upstream raw would silently revert them, so they are declared here -# as the operator's real configuration. -# -# Leader election: single-node etcd on the T480's PM991 NVMe stalls WAL fsync -# for multiple seconds during heavy Forgejo dind builds. The apiserver stops -# answering, client-go's 5s lease-renewal HTTP timeout expires, and -# controller-runtime fatals with "leader election lost" (223 restarts / 45d). -# Lease 60s / renew 45s rides out a stall instead of restarting the operator. -# Safe with replicas: 1 -- there is no second holder to split-brain against. -# NOTE: these flags are integer SECONDS, not Go durations. -apiVersion: apps/v1 -kind: Deployment -metadata: - name: cnpg-controller-manager - namespace: cnpg-system -spec: - template: - spec: - containers: - - name: manager - args: - - controller - - --leader-elect - - --leader-lease-duration=60 - - --leader-renew-deadline=45 - - --max-concurrent-reconciles=10 - - --config-map-name=cnpg-controller-manager-config - - --secret-name=cnpg-controller-manager-config - - --webhook-port=9443 - # The pod talks to the API over the WireGuard overlay address - # (10.10.0.2:6443); the in-cluster 10.96.0.1 Service VIP is not - # reachable from this namespace (see k8s-api firewall on the T480). - env: - - name: KUBERNETES_SERVICE_HOST - value: "10.10.0.2" - - name: KUBERNETES_SERVICE_PORT - value: "6443" - # Upstream ships 100m/200Mi, which is tight enough that the operator - # was starved on this box. Raised by hand; keep it. - resources: - limits: - cpu: 500m - memory: 512Mi - # Upstream gives the manager 6*5s = 30s to answer /readyz, which is - # shorter than a real NVMe fsync stall. 36*5s = 3min. - startupProbe: - failureThreshold: 36 diff --git a/infrastructure/databases/base/upstream/cnpg-1.30.0.yaml b/infrastructure/databases/base/upstream/cnpg-1.30.0.yaml deleted file mode 100644 index 4f7364a..0000000 --- a/infrastructure/databases/base/upstream/cnpg-1.30.0.yaml +++ /dev/null @@ -1,20846 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - labels: - app.kubernetes.io/name: cloudnative-pg - name: cnpg-system ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.21.0 - name: backups.postgresql.cnpg.io -spec: - group: postgresql.cnpg.io - names: - kind: Backup - listKind: BackupList - plural: backups - singular: backup - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - jsonPath: .spec.cluster.name - name: Cluster - type: string - - jsonPath: .spec.method - name: Method - type: string - - jsonPath: .status.phase - name: Phase - type: string - - jsonPath: .status.error - name: Error - type: string - name: v1 - schema: - openAPIV3Schema: - description: A Backup resource is a request for a PostgreSQL backup by the - user. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: |- - Specification of the desired behavior of the backup. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - cluster: - description: The cluster to backup - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - method: - default: barmanObjectStore - description: |- - The backup method to be used, possible options are `barmanObjectStore`, - `volumeSnapshot` or `plugin`. Defaults to: `barmanObjectStore`. - enum: - - barmanObjectStore - - volumeSnapshot - - plugin - type: string - online: - description: |- - Whether the default type of backup with volume snapshots is - online/hot (`true`, default) or offline/cold (`false`) - Overrides the default setting specified in the cluster field '.spec.backup.volumeSnapshot.online' - type: boolean - onlineConfiguration: - description: |- - Configuration parameters to control the online/hot backup with volume snapshots - Overrides the default settings specified in the cluster '.backup.volumeSnapshot.onlineConfiguration' stanza - properties: - immediateCheckpoint: - description: |- - Control whether the I/O workload for the backup initial checkpoint will - be limited, according to the `checkpoint_completion_target` setting on - the PostgreSQL server. If set to true, an immediate checkpoint will be - used, meaning PostgreSQL will complete the checkpoint as soon as - possible. `false` by default. - type: boolean - waitForArchive: - default: true - description: |- - If false, the function will return immediately after the backup is completed, - without waiting for WAL to be archived. - This behavior is only useful with backup software that independently monitors WAL archiving. - Otherwise, WAL required to make the backup consistent might be missing and make the backup useless. - By default, or when this parameter is true, pg_backup_stop will wait for WAL to be archived when archiving is - enabled. - On a standby, this means that it will wait only when archive_mode = always. - If write activity on the primary is low, it may be useful to run pg_switch_wal on the primary in order to trigger - an immediate segment switch. - type: boolean - type: object - pluginConfiguration: - description: Configuration parameters passed to the plugin managing - this backup - properties: - name: - description: Name is the name of the plugin managing this backup - type: string - parameters: - additionalProperties: - type: string - description: |- - Parameters are the configuration parameters passed to the backup - plugin for this backup - type: object - required: - - name - type: object - target: - description: |- - The policy to decide which instance should perform this backup. If empty, - it defaults to `cluster.spec.backup.target`. - Available options are empty string, `primary` and `prefer-standby`. - `primary` to have backups run always on primary instances, - `prefer-standby` to have backups run preferably on the most updated - standby, if available. - enum: - - primary - - prefer-standby - type: string - required: - - cluster - type: object - x-kubernetes-validations: - - message: BackupSpec is immutable once set - rule: oldSelf == self - status: - description: |- - Most recently observed status of the backup. This data may not be up to - date. Populated by the system. Read-only. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - azureCredentials: - description: The credentials to use to upload data to Azure Blob Storage - properties: - connectionString: - description: The connection string to be used - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - inheritFromAzureAD: - description: Use the Azure AD based authentication without providing - explicitly the keys. - type: boolean - storageAccount: - description: The storage account where to upload data - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - storageKey: - description: |- - The storage account key to be used in conjunction - with the storage account name - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - storageSasToken: - description: |- - A shared-access-signature to be used in conjunction with - the storage account name - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - useDefaultAzureCredentials: - description: |- - Use the default Azure authentication flow, which includes DefaultAzureCredential. - This allows authentication using environment variables and managed identities. - type: boolean - type: object - backupId: - description: The ID of the Barman backup - type: string - backupLabelFile: - description: Backup label file content as returned by Postgres in - case of online (hot) backups - format: byte - type: string - backupName: - description: The Name of the Barman backup - type: string - beginLSN: - description: The starting xlog - type: string - beginWal: - description: The starting WAL - type: string - commandError: - description: The backup command output in case of error - type: string - commandOutput: - description: Unused. Retained for compatibility with old versions. - type: string - destinationPath: - description: |- - The path where to store the backup (i.e. s3://bucket/path/to/folder) - this path, with different destination folders, will be used for WALs - and for data. This may not be populated in case of errors. - type: string - encryption: - description: Encryption method required to S3 API - type: string - endLSN: - description: The ending xlog - type: string - endWal: - description: The ending WAL - type: string - endpointCA: - description: |- - EndpointCA store the CA bundle of the barman endpoint. - Useful when using self-signed certificates to avoid - errors with certificate issuer and barman-cloud-wal-archive. - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - endpointURL: - description: |- - Endpoint to be used to upload data to the cloud, - overriding the automatic endpoint discovery - type: string - error: - description: The detected error - type: string - googleCredentials: - description: The credentials to use to upload data to Google Cloud - Storage - properties: - applicationCredentials: - description: The secret containing the Google Cloud Storage JSON - file with the credentials - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - gkeEnvironment: - description: |- - If set to true, will presume that it's running inside a GKE environment, - default to false. - type: boolean - type: object - instanceID: - description: Information to identify the instance where the backup - has been taken from - properties: - ContainerID: - description: The container ID - type: string - podName: - description: The pod name - type: string - sessionID: - description: |- - The instance manager session ID. This is a unique identifier generated at instance manager - startup and changes on every restart (including container reboots). Used to detect if - the instance manager was restarted during long-running operations like backups, which - would terminate any running backup process. - type: string - type: object - majorVersion: - description: |- - The PostgreSQL major version that was running when the - backup was taken. - type: integer - method: - description: The backup method being used - type: string - online: - description: Whether the backup was online/hot (`true`) or offline/cold - (`false`) - type: boolean - phase: - description: The last backup status - type: string - pluginMetadata: - additionalProperties: - type: string - description: A map containing the plugin metadata - type: object - reconciliationStartedAt: - description: When the backup process was started by the operator - format: date-time - type: string - reconciliationTerminatedAt: - description: When the reconciliation was terminated by the operator - (either successfully or not) - format: date-time - type: string - s3Credentials: - description: The credentials to use to upload data to S3 - properties: - accessKeyId: - description: The reference to the access key id - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - inheritFromIAMRole: - description: Use the role based authentication without providing - explicitly the keys. - type: boolean - region: - description: The reference to the secret containing the region - name - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - secretAccessKey: - description: The reference to the secret access key - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - sessionToken: - description: The references to the session key - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - type: object - serverName: - description: |- - The server name on S3, the cluster name is used if this - parameter is omitted - type: string - snapshotBackupStatus: - description: Status of the volumeSnapshot backup - properties: - elements: - description: The elements list, populated with the gathered volume - snapshots - items: - description: BackupSnapshotElementStatus is a volume snapshot - that is part of a volume snapshot method backup - properties: - name: - description: Name is the snapshot resource name - type: string - tablespaceName: - description: |- - TablespaceName is the name of the snapshotted tablespace. Only set - when type is PG_TABLESPACE - type: string - type: - description: Type is tho role of the snapshot in the cluster, - such as PG_DATA, PG_WAL and PG_TABLESPACE - type: string - required: - - name - - type - type: object - type: array - type: object - startedAt: - description: When the backup execution was started by the backup tool - format: date-time - type: string - stoppedAt: - description: When the backup execution was terminated by the backup - tool - format: date-time - type: string - tablespaceMapFile: - description: Tablespace map file content as returned by Postgres in - case of online (hot) backups - format: byte - type: string - type: object - required: - - metadata - - spec - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.21.0 - name: clusterimagecatalogs.postgresql.cnpg.io -spec: - group: postgresql.cnpg.io - names: - kind: ClusterImageCatalog - listKind: ClusterImageCatalogList - plural: clusterimagecatalogs - singular: clusterimagecatalog - scope: Cluster - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1 - schema: - openAPIV3Schema: - description: ClusterImageCatalog is the Schema for the clusterimagecatalogs - API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: |- - Specification of the desired behavior of the ClusterImageCatalog. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - componentImages: - description: |- - ComponentImages is a list of named images for components other than PostgreSQL - (e.g. pgbouncer). Keys must be unique within a catalog. - items: - description: CatalogComponentImage is a named image entry for a - non-PostgreSQL component. - properties: - image: - description: Image is the container image reference. - type: string - key: - description: Key is the unique identifier for this image within - the catalog. - maxLength: 63 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - required: - - image - - key - type: object - maxItems: 32 - type: array - x-kubernetes-list-map-keys: - - key - x-kubernetes-list-type: map - x-kubernetes-validations: - - message: Component image keys must be unique - rule: self.all(e, self.filter(f, f.key==e.key).size() == 1) - images: - description: List of CatalogImages available in the catalog - items: - description: CatalogImage defines the image and major version - properties: - extensions: - description: The configuration of the extensions to be added - items: - description: |- - ExtensionConfiguration is the configuration used to add - PostgreSQL extensions to the Cluster. - properties: - bin_path: - description: |- - A list of directories within the image to be appended to the - PostgreSQL process's `PATH` environment variable. - items: - type: string - type: array - dynamic_library_path: - description: |- - The list of directories inside the image which should be added to dynamic_library_path. - If not defined, defaults to "/lib". - items: - type: string - type: array - env: - description: |- - Env is a list of custom environment variables to be set in the - PostgreSQL process for this extension. It is the responsibility of the - cluster administrator to ensure the variables are correct for the - specific extension. Note that changes to these variables require - a manual cluster restart to take effect. - items: - description: |- - ExtensionEnvVar defines an environment variable for a specific extension - image volume. - properties: - name: - description: |- - Name of the environment variable to be injected into the - PostgreSQL process. - minLength: 1 - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ - type: string - value: - description: |- - Value of the environment variable. CloudNativePG performs a direct - replacement of this value, with support for placeholder expansion. - The ${`image_root`} placeholder resolves to the absolute mount path - of the extension's volume (e.g., `/extensions/my-extension`). This - is particularly useful for allowing applications or libraries to - locate specific directories within the mounted image. - Unrecognized placeholders are rejected. To include a literal ${...} - in the value, escape it as $${...}. - minLength: 1 - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - extension_control_path: - description: |- - The list of directories inside the image which should be added to extension_control_path. - If not defined, defaults to "/share". - items: - type: string - type: array - image: - description: The image containing the extension. - properties: - pullPolicy: - description: |- - Policy for pulling OCI objects. Possible values are: - Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. - Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. - type: string - reference: - description: |- - Required: Image or artifact reference to be used. - Behaves in the same way as pod.spec.containers[*].image. - Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. - More info: https://kubernetes.io/docs/concepts/containers/images - This field is optional to allow higher level config management to default or override - container images in workload controllers like Deployments and StatefulSets. - type: string - type: object - ld_library_path: - description: The list of directories inside the image - which should be added to ld_library_path. - items: - type: string - type: array - name: - description: |- - The name of the extension, required. The limit of 59 characters - leaves room for the prefix the operator adds when deriving the - extension's Kubernetes Volume name (capped at 63 characters). - maxLength: 59 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9_]*[a-z0-9])?$ - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - image: - description: The image reference - type: string - major: - description: The PostgreSQL major version of the image. Must - be unique within the catalog. - minimum: 10 - type: integer - required: - - image - - major - type: object - maxItems: 8 - minItems: 1 - type: array - x-kubernetes-validations: - - message: Images must have unique major versions - rule: self.all(e, self.filter(f, f.major==e.major).size() == 1) - required: - - images - type: object - required: - - metadata - - spec - type: object - served: true - storage: true - subresources: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.21.0 - name: clusters.postgresql.cnpg.io -spec: - group: postgresql.cnpg.io - names: - kind: Cluster - listKind: ClusterList - plural: clusters - singular: cluster - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - description: Number of instances - jsonPath: .status.instances - name: Instances - type: integer - - description: Number of ready instances - jsonPath: .status.readyInstances - name: Ready - type: integer - - description: Cluster current status - jsonPath: .status.phase - name: Status - type: string - - description: Primary pod - jsonPath: .status.currentPrimary - name: Primary - type: string - name: v1 - schema: - openAPIV3Schema: - description: |- - Cluster defines the API schema for a highly available PostgreSQL database cluster - managed by CloudNativePG. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: |- - Specification of the desired behavior of the cluster. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - affinity: - description: Affinity/Anti-affinity rules for Pods - properties: - additionalPodAffinity: - description: AdditionalPodAffinity allows to specify pod affinity - terms to be passed to all the cluster's pods. - properties: - preferredDuringSchedulingIgnoredDuringExecution: - description: |- - The scheduler will prefer to schedule pods to nodes that satisfy - the affinity expressions specified by this field, but it may choose - a node that violates one or more of the expressions. The node that is - most preferred is the one with the greatest sum of weights, i.e. - for each node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling affinity expressions, etc.), - compute a sum by iterating through the elements of this field and adding - "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the - node(s) with the highest sum are the most preferred. - items: - description: The weights of all of the matched WeightedPodAffinityTerm - fields are added per-node to find the most preferred node(s) - properties: - podAffinityTerm: - description: Required. A pod affinity term, associated - with the corresponding weight. - properties: - labelSelector: - description: |- - A label query over a set of resources, in this case pods. - If it's null, this PodAffinityTerm matches with no Pods. - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are - ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that - the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - matchLabelKeys: - description: |- - MatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both matchLabelKeys and labelSelector. - Also, matchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - mismatchLabelKeys: - description: |- - MismatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. - Also, mismatchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - namespaceSelector: - description: |- - A label query over the set of namespaces that the term applies to. - The term is applied to the union of the namespaces selected by this field - and the ones listed in the namespaces field. - null selector and null or empty namespaces list means "this pod's namespace". - An empty selector ({}) matches all namespaces. - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are - ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that - the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaces: - description: |- - namespaces specifies a static list of namespace names that the term applies to. - The term is applied to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector means "this pod's namespace". - items: - type: string - type: array - x-kubernetes-list-type: atomic - topologyKey: - description: |- - This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where co-located is defined as running on a node - whose value of the label with key topologyKey matches that of any node on which any of the - selected pods is running. - Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - weight: - description: |- - weight associated with matching the corresponding podAffinityTerm, - in the range 1-100. - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - x-kubernetes-list-type: atomic - requiredDuringSchedulingIgnoredDuringExecution: - description: |- - If the affinity requirements specified by this field are not met at - scheduling time, the pod will not be scheduled onto the node. - If the affinity requirements specified by this field cease to be met - at some point during pod execution (e.g. due to a pod label update), the - system may or may not try to eventually evict the pod from its node. - When there are multiple elements, the lists of nodes corresponding to each - podAffinityTerm are intersected, i.e. all terms must be satisfied. - items: - description: |- - Defines a set of pods (namely those matching the labelSelector - relative to the given namespace(s)) that this pod should be - co-located (affinity) or not co-located (anti-affinity) with, - where co-located is defined as running on a node whose value of - the label with key matches that of any node on which - a pod of the set of pods is running - properties: - labelSelector: - description: |- - A label query over a set of resources, in this case pods. - If it's null, this PodAffinityTerm matches with no Pods. - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the - selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - matchLabelKeys: - description: |- - MatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both matchLabelKeys and labelSelector. - Also, matchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - mismatchLabelKeys: - description: |- - MismatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. - Also, mismatchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - namespaceSelector: - description: |- - A label query over the set of namespaces that the term applies to. - The term is applied to the union of the namespaces selected by this field - and the ones listed in the namespaces field. - null selector and null or empty namespaces list means "this pod's namespace". - An empty selector ({}) matches all namespaces. - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the - selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaces: - description: |- - namespaces specifies a static list of namespace names that the term applies to. - The term is applied to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector means "this pod's namespace". - items: - type: string - type: array - x-kubernetes-list-type: atomic - topologyKey: - description: |- - This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where co-located is defined as running on a node - whose value of the label with key topologyKey matches that of any node on which any of the - selected pods is running. - Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - type: array - x-kubernetes-list-type: atomic - type: object - additionalPodAntiAffinity: - description: |- - AdditionalPodAntiAffinity allows to specify pod anti-affinity terms to be added to the ones generated - by the operator if EnablePodAntiAffinity is set to true (default) or to be used exclusively if set to false. - properties: - preferredDuringSchedulingIgnoredDuringExecution: - description: |- - The scheduler will prefer to schedule pods to nodes that satisfy - the anti-affinity expressions specified by this field, but it may choose - a node that violates one or more of the expressions. The node that is - most preferred is the one with the greatest sum of weights, i.e. - for each node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling anti-affinity expressions, etc.), - compute a sum by iterating through the elements of this field and subtracting - "weight" from the sum if the node has pods which matches the corresponding podAffinityTerm; the - node(s) with the highest sum are the most preferred. - items: - description: The weights of all of the matched WeightedPodAffinityTerm - fields are added per-node to find the most preferred node(s) - properties: - podAffinityTerm: - description: Required. A pod affinity term, associated - with the corresponding weight. - properties: - labelSelector: - description: |- - A label query over a set of resources, in this case pods. - If it's null, this PodAffinityTerm matches with no Pods. - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are - ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that - the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - matchLabelKeys: - description: |- - MatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both matchLabelKeys and labelSelector. - Also, matchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - mismatchLabelKeys: - description: |- - MismatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. - Also, mismatchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - namespaceSelector: - description: |- - A label query over the set of namespaces that the term applies to. - The term is applied to the union of the namespaces selected by this field - and the ones listed in the namespaces field. - null selector and null or empty namespaces list means "this pod's namespace". - An empty selector ({}) matches all namespaces. - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are - ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that - the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaces: - description: |- - namespaces specifies a static list of namespace names that the term applies to. - The term is applied to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector means "this pod's namespace". - items: - type: string - type: array - x-kubernetes-list-type: atomic - topologyKey: - description: |- - This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where co-located is defined as running on a node - whose value of the label with key topologyKey matches that of any node on which any of the - selected pods is running. - Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - weight: - description: |- - weight associated with matching the corresponding podAffinityTerm, - in the range 1-100. - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - x-kubernetes-list-type: atomic - requiredDuringSchedulingIgnoredDuringExecution: - description: |- - If the anti-affinity requirements specified by this field are not met at - scheduling time, the pod will not be scheduled onto the node. - If the anti-affinity requirements specified by this field cease to be met - at some point during pod execution (e.g. due to a pod label update), the - system may or may not try to eventually evict the pod from its node. - When there are multiple elements, the lists of nodes corresponding to each - podAffinityTerm are intersected, i.e. all terms must be satisfied. - items: - description: |- - Defines a set of pods (namely those matching the labelSelector - relative to the given namespace(s)) that this pod should be - co-located (affinity) or not co-located (anti-affinity) with, - where co-located is defined as running on a node whose value of - the label with key matches that of any node on which - a pod of the set of pods is running - properties: - labelSelector: - description: |- - A label query over a set of resources, in this case pods. - If it's null, this PodAffinityTerm matches with no Pods. - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the - selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - matchLabelKeys: - description: |- - MatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both matchLabelKeys and labelSelector. - Also, matchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - mismatchLabelKeys: - description: |- - MismatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. - Also, mismatchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - namespaceSelector: - description: |- - A label query over the set of namespaces that the term applies to. - The term is applied to the union of the namespaces selected by this field - and the ones listed in the namespaces field. - null selector and null or empty namespaces list means "this pod's namespace". - An empty selector ({}) matches all namespaces. - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the - selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaces: - description: |- - namespaces specifies a static list of namespace names that the term applies to. - The term is applied to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector means "this pod's namespace". - items: - type: string - type: array - x-kubernetes-list-type: atomic - topologyKey: - description: |- - This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where co-located is defined as running on a node - whose value of the label with key topologyKey matches that of any node on which any of the - selected pods is running. - Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - type: array - x-kubernetes-list-type: atomic - type: object - enablePodAntiAffinity: - description: |- - Activates anti-affinity for the pods. The operator will define pods - anti-affinity unless this field is explicitly set to false - type: boolean - nodeAffinity: - description: |- - NodeAffinity describes node affinity scheduling rules for the pod. - More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity - properties: - preferredDuringSchedulingIgnoredDuringExecution: - description: |- - The scheduler will prefer to schedule pods to nodes that satisfy - the affinity expressions specified by this field, but it may choose - a node that violates one or more of the expressions. The node that is - most preferred is the one with the greatest sum of weights, i.e. - for each node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling affinity expressions, etc.), - compute a sum by iterating through the elements of this field and adding - "weight" to the sum if the node matches the corresponding matchExpressions; the - node(s) with the highest sum are the most preferred. - items: - description: |- - An empty preferred scheduling term matches all objects with implicit weight 0 - (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). - properties: - preference: - description: A node selector term, associated with the - corresponding weight. - properties: - matchExpressions: - description: A list of node selector requirements - by node's labels. - items: - description: |- - A node selector requirement is a selector that contains values, a key, and an operator - that relates the key and values. - properties: - key: - description: The label key that the selector - applies to. - type: string - operator: - description: |- - Represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: |- - An array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. If the operator is Gt or Lt, the values - array must have a single element, which will be interpreted as an integer. - This array is replaced during a strategic merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchFields: - description: A list of node selector requirements - by node's fields. - items: - description: |- - A node selector requirement is a selector that contains values, a key, and an operator - that relates the key and values. - properties: - key: - description: The label key that the selector - applies to. - type: string - operator: - description: |- - Represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: |- - An array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. If the operator is Gt or Lt, the values - array must have a single element, which will be interpreted as an integer. - This array is replaced during a strategic merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - type: object - x-kubernetes-map-type: atomic - weight: - description: Weight associated with matching the corresponding - nodeSelectorTerm, in the range 1-100. - format: int32 - type: integer - required: - - preference - - weight - type: object - type: array - x-kubernetes-list-type: atomic - requiredDuringSchedulingIgnoredDuringExecution: - description: |- - If the affinity requirements specified by this field are not met at - scheduling time, the pod will not be scheduled onto the node. - If the affinity requirements specified by this field cease to be met - at some point during pod execution (e.g. due to an update), the system - may or may not try to eventually evict the pod from its node. - properties: - nodeSelectorTerms: - description: Required. A list of node selector terms. - The terms are ORed. - items: - description: |- - A null or empty node selector term matches no objects. The requirements of - them are ANDed. - The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. - properties: - matchExpressions: - description: A list of node selector requirements - by node's labels. - items: - description: |- - A node selector requirement is a selector that contains values, a key, and an operator - that relates the key and values. - properties: - key: - description: The label key that the selector - applies to. - type: string - operator: - description: |- - Represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: |- - An array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. If the operator is Gt or Lt, the values - array must have a single element, which will be interpreted as an integer. - This array is replaced during a strategic merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchFields: - description: A list of node selector requirements - by node's fields. - items: - description: |- - A node selector requirement is a selector that contains values, a key, and an operator - that relates the key and values. - properties: - key: - description: The label key that the selector - applies to. - type: string - operator: - description: |- - Represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: |- - An array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. If the operator is Gt or Lt, the values - array must have a single element, which will be interpreted as an integer. - This array is replaced during a strategic merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - type: object - x-kubernetes-map-type: atomic - type: array - x-kubernetes-list-type: atomic - required: - - nodeSelectorTerms - type: object - x-kubernetes-map-type: atomic - type: object - nodeSelector: - additionalProperties: - type: string - description: |- - NodeSelector is map of key-value pairs used to define the nodes on which - the pods can run. - More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ - type: object - podAntiAffinityType: - description: |- - PodAntiAffinityType allows the user to decide whether pod anti-affinity between cluster instance has to be - considered a strong requirement during scheduling or not. Allowed values are: "preferred" (default if empty) or - "required". Setting it to "required", could lead to instances remaining pending until new kubernetes nodes are - added if all the existing nodes don't match the required pod anti-affinity rule. - More info: - https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity - type: string - tolerations: - description: |- - Tolerations is a list of Tolerations that should be set for all the pods, in order to allow them to run - on tainted nodes. - More info: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ - items: - description: |- - The pod this Toleration is attached to tolerates any taint that matches - the triple using the matching operator . - properties: - effect: - description: |- - Effect indicates the taint effect to match. Empty means match all taint effects. - When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. - type: string - key: - description: |- - Key is the taint key that the toleration applies to. Empty means match all taint keys. - If the key is empty, operator must be Exists; this combination means to match all values and all keys. - type: string - operator: - description: |- - Operator represents a key's relationship to the value. - Valid operators are Exists, Equal, Lt, and Gt. Defaults to Equal. - Exists is equivalent to wildcard for value, so that a pod can - tolerate all taints of a particular category. - Lt and Gt perform numeric comparisons (requires feature gate TaintTolerationComparisonOperators). - type: string - tolerationSeconds: - description: |- - TolerationSeconds represents the period of time the toleration (which must be - of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, - it is not set, which means tolerate the taint forever (do not evict). Zero and - negative values will be treated as 0 (evict immediately) by the system. - format: int64 - type: integer - value: - description: |- - Value is the taint value the toleration matches to. - If the operator is Exists, the value should be empty, otherwise just a regular string. - type: string - type: object - type: array - topologyKey: - description: |- - TopologyKey to use for anti-affinity configuration. See k8s documentation - for more info on that - type: string - type: object - backup: - description: The configuration to be used for backups - properties: - barmanObjectStore: - description: The configuration for the barman-cloud tool suite - properties: - azureCredentials: - description: The credentials to use to upload data to Azure - Blob Storage - properties: - connectionString: - description: The connection string to be used - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - inheritFromAzureAD: - description: Use the Azure AD based authentication without - providing explicitly the keys. - type: boolean - storageAccount: - description: The storage account where to upload data - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - storageKey: - description: |- - The storage account key to be used in conjunction - with the storage account name - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - storageSasToken: - description: |- - A shared-access-signature to be used in conjunction with - the storage account name - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - useDefaultAzureCredentials: - description: |- - Use the default Azure authentication flow, which includes DefaultAzureCredential. - This allows authentication using environment variables and managed identities. - type: boolean - type: object - data: - description: |- - The configuration to be used to backup the data files - When not defined, base backups files will be stored uncompressed and may - be unencrypted in the object store, according to the bucket default - policy. - properties: - additionalCommandArgs: - description: |- - AdditionalCommandArgs represents additional arguments that can be appended - to the 'barman-cloud-backup' command-line invocation. These arguments - provide flexibility to customize the backup process further according to - specific requirements or configurations. - - Example: - In a scenario where specialized backup options are required, such as setting - a specific timeout or defining custom behavior, users can use this field - to specify additional command arguments. - - Note: - It's essential to ensure that the provided arguments are valid and supported - by the 'barman-cloud-backup' command, to avoid potential errors or unintended - behavior during execution. - items: - type: string - type: array - compression: - description: |- - Compress a backup file (a tar file per tablespace) while streaming it - to the object store. Available options are empty string (no - compression, default), `gzip`, `bzip2`, `lz4`, and `snappy`. - enum: - - bzip2 - - gzip - - lz4 - - snappy - type: string - encryption: - description: |- - Whenever to force the encryption of files (if the bucket is - not already configured for that). - Allowed options are empty string (use the bucket policy, default), - `AES256` and `aws:kms` - enum: - - AES256 - - aws:kms - type: string - immediateCheckpoint: - description: |- - Control whether the I/O workload for the backup initial checkpoint will - be limited, according to the `checkpoint_completion_target` setting on - the PostgreSQL server. If set to true, an immediate checkpoint will be - used, meaning PostgreSQL will complete the checkpoint as soon as - possible. `false` by default. - type: boolean - jobs: - description: |- - The number of parallel jobs to be used to upload the backup, defaults - to 2 - format: int32 - minimum: 1 - type: integer - type: object - destinationPath: - description: |- - The path where to store the backup (i.e. s3://bucket/path/to/folder) - this path, with different destination folders, will be used for WALs - and for data - minLength: 1 - type: string - endpointCA: - description: |- - EndpointCA store the CA bundle of the barman endpoint. - Useful when using self-signed certificates to avoid - errors with certificate issuer and barman-cloud-wal-archive - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - endpointURL: - description: |- - Endpoint to be used to upload data to the cloud, - overriding the automatic endpoint discovery - type: string - googleCredentials: - description: The credentials to use to upload data to Google - Cloud Storage - properties: - applicationCredentials: - description: The secret containing the Google Cloud Storage - JSON file with the credentials - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - gkeEnvironment: - description: |- - If set to true, will presume that it's running inside a GKE environment, - default to false. - type: boolean - type: object - historyTags: - additionalProperties: - type: string - description: |- - HistoryTags is a list of key value pairs that will be passed to the - Barman --history-tags option. - type: object - s3Credentials: - description: The credentials to use to upload data to S3 - properties: - accessKeyId: - description: The reference to the access key id - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - inheritFromIAMRole: - description: Use the role based authentication without - providing explicitly the keys. - type: boolean - region: - description: The reference to the secret containing the - region name - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - secretAccessKey: - description: The reference to the secret access key - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - sessionToken: - description: The references to the session key - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - type: object - serverName: - description: |- - The server name on S3, the cluster name is used if this - parameter is omitted - type: string - tags: - additionalProperties: - type: string - description: |- - Tags is a list of key value pairs that will be passed to the - Barman --tags option. - type: object - wal: - description: |- - The configuration for the backup of the WAL stream. - When not defined, WAL files will be stored uncompressed and may be - unencrypted in the object store, according to the bucket default policy. - properties: - archiveAdditionalCommandArgs: - description: |- - Additional arguments that can be appended to the 'barman-cloud-wal-archive' - command-line invocation. These arguments provide flexibility to customize - the WAL archive process further, according to specific requirements or configurations. - - Example: - In a scenario where specialized backup options are required, such as setting - a specific timeout or defining custom behavior, users can use this field - to specify additional command arguments. - - Note: - It's essential to ensure that the provided arguments are valid and supported - by the 'barman-cloud-wal-archive' command, to avoid potential errors or unintended - behavior during execution. - items: - type: string - type: array - compression: - description: |- - Compress a WAL file before sending it to the object store. Available - options are empty string (no compression, default), `gzip`, `bzip2`, - `lz4`, `snappy`, `xz`, and `zstd`. - enum: - - bzip2 - - gzip - - lz4 - - snappy - - xz - - zstd - type: string - encryption: - description: |- - Whenever to force the encryption of files (if the bucket is - not already configured for that). - Allowed options are empty string (use the bucket policy, default), - `AES256` and `aws:kms` - enum: - - AES256 - - aws:kms - type: string - maxParallel: - description: |- - Number of WAL files to be either archived in parallel (when the - PostgreSQL instance is archiving to a backup object store) or - restored in parallel (when a PostgreSQL standby is fetching WAL - files from a recovery object store). If not specified, WAL files - will be processed one at a time. It accepts a positive integer as a - value - with 1 being the minimum accepted value. - minimum: 1 - type: integer - restoreAdditionalCommandArgs: - description: |- - Additional arguments that can be appended to the 'barman-cloud-wal-restore' - command-line invocation. These arguments provide flexibility to customize - the WAL restore process further, according to specific requirements or configurations. - - Example: - In a scenario where specialized backup options are required, such as setting - a specific timeout or defining custom behavior, users can use this field - to specify additional command arguments. - - Note: - It's essential to ensure that the provided arguments are valid and supported - by the 'barman-cloud-wal-restore' command, to avoid potential errors or unintended - behavior during execution. - items: - type: string - type: array - type: object - required: - - destinationPath - type: object - retentionPolicy: - description: |- - RetentionPolicy is the retention policy to be used for backups - and WALs (i.e. '60d'). The retention policy is expressed in the form - of `XXu` where `XX` is a positive integer and `u` is in `[dwm]` - - days, weeks, months. - It's currently only applicable when using the BarmanObjectStore method. - pattern: ^[1-9][0-9]*[dwm]$ - type: string - target: - default: prefer-standby - description: |- - The policy to decide which instance should perform backups. Available - options are empty string, which will default to `prefer-standby` policy, - `primary` to have backups run always on primary instances, `prefer-standby` - to have backups run preferably on the most updated standby, if available. - enum: - - primary - - prefer-standby - type: string - volumeSnapshot: - description: VolumeSnapshot provides the configuration for the - execution of volume snapshot backups. - properties: - annotations: - additionalProperties: - type: string - description: Annotations key-value pairs that will be added - to .metadata.annotations snapshot resources. - type: object - className: - description: |- - ClassName specifies the Snapshot Class to be used for PG_DATA PersistentVolumeClaim. - It is the default class for the other types if no specific class is present - type: string - labels: - additionalProperties: - type: string - description: Labels are key-value pairs that will be added - to .metadata.labels snapshot resources. - type: object - online: - default: true - description: |- - Whether the default type of backup with volume snapshots is - online/hot (`true`, default) or offline/cold (`false`) - type: boolean - onlineConfiguration: - default: - immediateCheckpoint: false - waitForArchive: true - description: Configuration parameters to control the online/hot - backup with volume snapshots - properties: - immediateCheckpoint: - description: |- - Control whether the I/O workload for the backup initial checkpoint will - be limited, according to the `checkpoint_completion_target` setting on - the PostgreSQL server. If set to true, an immediate checkpoint will be - used, meaning PostgreSQL will complete the checkpoint as soon as - possible. `false` by default. - type: boolean - waitForArchive: - default: true - description: |- - If false, the function will return immediately after the backup is completed, - without waiting for WAL to be archived. - This behavior is only useful with backup software that independently monitors WAL archiving. - Otherwise, WAL required to make the backup consistent might be missing and make the backup useless. - By default, or when this parameter is true, pg_backup_stop will wait for WAL to be archived when archiving is - enabled. - On a standby, this means that it will wait only when archive_mode = always. - If write activity on the primary is low, it may be useful to run pg_switch_wal on the primary in order to trigger - an immediate segment switch. - type: boolean - type: object - snapshotOwnerReference: - default: none - description: SnapshotOwnerReference indicates the type of - owner reference the snapshot should have - enum: - - none - - cluster - - backup - type: string - tablespaceClassName: - additionalProperties: - type: string - description: |- - TablespaceClassName specifies the Snapshot Class to be used for the tablespaces. - defaults to the PGDATA Snapshot Class, if set - type: object - walClassName: - description: WalClassName specifies the Snapshot Class to - be used for the PG_WAL PersistentVolumeClaim. - type: string - type: object - type: object - bootstrap: - description: Instructions to bootstrap this cluster - properties: - initdb: - description: Bootstrap the cluster via initdb - properties: - builtinLocale: - description: |- - Specifies the locale name when the builtin provider is used. - This option requires `localeProvider` to be set to `builtin`. - Available from PostgreSQL 17. - type: string - dataChecksums: - description: |- - Whether the `-k` option should be passed to initdb, - enabling checksums on data pages (default: `false`) - type: boolean - database: - description: 'Name of the database used by the application. - Default: `app`.' - type: string - encoding: - description: The value to be passed as option `--encoding` - for initdb (default:`UTF8`) - type: string - icuLocale: - description: |- - Specifies the ICU locale when the ICU provider is used. - This option requires `localeProvider` to be set to `icu`. - Available from PostgreSQL 15. - type: string - icuRules: - description: |- - Specifies additional collation rules to customize the behavior of the default collation. - This option requires `localeProvider` to be set to `icu`. - Available from PostgreSQL 16. - type: string - import: - description: |- - Bootstraps the new cluster by importing data from an existing PostgreSQL - instance using logical backup (`pg_dump` and `pg_restore`) - properties: - databases: - description: The databases to import - items: - type: string - type: array - pgDumpExtraOptions: - description: |- - List of custom options to pass to the `pg_dump` command. - - IMPORTANT: Use with caution. The operator does not validate these options, - and certain flags may interfere with its intended functionality or design. - You are responsible for ensuring that the provided options are compatible - with your environment and desired behavior. - items: - type: string - type: array - pgRestoreDataOptions: - description: |- - Custom options to pass to the `pg_restore` command during the `data` - section. This setting overrides the generic `pgRestoreExtraOptions` value. - - IMPORTANT: Use with caution. The operator does not validate these options, - and certain flags may interfere with its intended functionality or design. - You are responsible for ensuring that the provided options are compatible - with your environment and desired behavior. - items: - type: string - type: array - pgRestoreExtraOptions: - description: |- - List of custom options to pass to the `pg_restore` command. - - IMPORTANT: Use with caution. The operator does not validate these options, - and certain flags may interfere with its intended functionality or design. - You are responsible for ensuring that the provided options are compatible - with your environment and desired behavior. - items: - type: string - type: array - pgRestorePostdataOptions: - description: |- - Custom options to pass to the `pg_restore` command during the `post-data` - section. This setting overrides the generic `pgRestoreExtraOptions` value. - - IMPORTANT: Use with caution. The operator does not validate these options, - and certain flags may interfere with its intended functionality or design. - You are responsible for ensuring that the provided options are compatible - with your environment and desired behavior. - items: - type: string - type: array - pgRestorePredataOptions: - description: |- - Custom options to pass to the `pg_restore` command during the `pre-data` - section. This setting overrides the generic `pgRestoreExtraOptions` value. - - IMPORTANT: Use with caution. The operator does not validate these options, - and certain flags may interfere with its intended functionality or design. - You are responsible for ensuring that the provided options are compatible - with your environment and desired behavior. - items: - type: string - type: array - postImportApplicationSQL: - description: |- - List of SQL queries to be executed as a superuser in the application - database right after is imported - to be used with extreme care - (by default empty). Only available in microservice type. - items: - type: string - type: array - roles: - description: The roles to import - items: - type: string - type: array - schemaOnly: - description: |- - When set to true, only the `pre-data` and `post-data` sections of - `pg_restore` are invoked, avoiding data import. Default: `false`. - type: boolean - source: - description: The source of the import - properties: - externalCluster: - description: The name of the externalCluster used - for import - type: string - required: - - externalCluster - type: object - type: - description: The import type. Can be `microservice` or - `monolith`. - enum: - - microservice - - monolith - type: string - required: - - databases - - source - - type - type: object - locale: - description: Sets the default collation order and character - classification in the new database. - type: string - localeCType: - description: The value to be passed as option `--lc-ctype` - for initdb (default:`C`) - type: string - localeCollate: - description: The value to be passed as option `--lc-collate` - for initdb (default:`C`) - type: string - localeProvider: - description: |- - This option sets the locale provider for databases created in the new cluster. - Available from PostgreSQL 16. - type: string - options: - description: |- - The list of options that must be passed to initdb when creating the cluster. - - Deprecated: This could lead to inconsistent configurations, - please use the explicit provided parameters instead. - If defined, explicit values will be ignored. - items: - type: string - type: array - owner: - description: |- - Name of the owner of the database in the instance to be used - by applications. Defaults to the value of the `database` key. - type: string - postInitApplicationSQL: - description: |- - List of SQL queries to be executed as a superuser in the application - database right after the cluster has been created - to be used with extreme care - (by default empty) - items: - type: string - type: array - postInitApplicationSQLRefs: - description: |- - List of references to ConfigMaps or Secrets containing SQL files - to be executed as a superuser in the application database right after - the cluster has been created. The references are processed in a specific order: - first, all Secrets are processed, followed by all ConfigMaps. - Within each group, the processing order follows the sequence specified - in their respective arrays. - (by default empty) - properties: - configMapRefs: - description: ConfigMapRefs holds a list of references - to ConfigMaps - items: - description: |- - ConfigMapKeySelector contains enough information to let you locate - the key of a ConfigMap - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - type: array - secretRefs: - description: SecretRefs holds a list of references to - Secrets - items: - description: |- - SecretKeySelector contains enough information to let you locate - the key of a Secret - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - type: array - type: object - postInitSQL: - description: |- - List of SQL queries to be executed as a superuser in the `postgres` - database right after the cluster has been created - to be used with extreme care - (by default empty) - items: - type: string - type: array - postInitSQLRefs: - description: |- - List of references to ConfigMaps or Secrets containing SQL files - to be executed as a superuser in the `postgres` database right after - the cluster has been created. The references are processed in a specific order: - first, all Secrets are processed, followed by all ConfigMaps. - Within each group, the processing order follows the sequence specified - in their respective arrays. - (by default empty) - properties: - configMapRefs: - description: ConfigMapRefs holds a list of references - to ConfigMaps - items: - description: |- - ConfigMapKeySelector contains enough information to let you locate - the key of a ConfigMap - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - type: array - secretRefs: - description: SecretRefs holds a list of references to - Secrets - items: - description: |- - SecretKeySelector contains enough information to let you locate - the key of a Secret - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - type: array - type: object - postInitTemplateSQL: - description: |- - List of SQL queries to be executed as a superuser in the `template1` - database right after the cluster has been created - to be used with extreme care - (by default empty) - items: - type: string - type: array - postInitTemplateSQLRefs: - description: |- - List of references to ConfigMaps or Secrets containing SQL files - to be executed as a superuser in the `template1` database right after - the cluster has been created. The references are processed in a specific order: - first, all Secrets are processed, followed by all ConfigMaps. - Within each group, the processing order follows the sequence specified - in their respective arrays. - (by default empty) - properties: - configMapRefs: - description: ConfigMapRefs holds a list of references - to ConfigMaps - items: - description: |- - ConfigMapKeySelector contains enough information to let you locate - the key of a ConfigMap - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - type: array - secretRefs: - description: SecretRefs holds a list of references to - Secrets - items: - description: |- - SecretKeySelector contains enough information to let you locate - the key of a Secret - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - type: array - type: object - secret: - description: |- - Name of the secret containing the initial credentials for the - owner of the user database. If empty a new secret will be - created from scratch - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - walSegmentSize: - description: |- - The value in megabytes (1 to 1024) to be passed to the `--wal-segsize` - option for initdb (default: empty, resulting in PostgreSQL default: 16MB) - maximum: 1024 - minimum: 1 - type: integer - type: object - x-kubernetes-validations: - - message: builtinLocale is only available when localeProvider - is set to `builtin` - rule: '!has(self.builtinLocale) || self.localeProvider == ''builtin''' - - message: icuLocale is only available when localeProvider is - set to `icu` - rule: '!has(self.icuLocale) || self.localeProvider == ''icu''' - - message: icuRules is only available when localeProvider is set - to `icu` - rule: '!has(self.icuRules) || self.localeProvider == ''icu''' - pg_basebackup: - description: |- - Bootstrap the cluster taking a physical backup of another compatible - PostgreSQL instance - properties: - database: - description: 'Name of the database used by the application. - Default: `app`.' - type: string - owner: - description: |- - Name of the owner of the database in the instance to be used - by applications. Defaults to the value of the `database` key. - type: string - secret: - description: |- - Name of the secret containing the initial credentials for the - owner of the user database. If empty a new secret will be - created from scratch - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - source: - description: The name of the server of which we need to take - a physical backup - minLength: 1 - type: string - required: - - source - type: object - recovery: - description: Bootstrap the cluster from a backup - properties: - backup: - description: |- - The backup object containing the physical base backup from which to - initiate the recovery procedure. - Mutually exclusive with `source` and `volumeSnapshots`. - properties: - endpointCA: - description: |- - EndpointCA store the CA bundle of the barman endpoint. - Useful when using self-signed certificates to avoid - errors with certificate issuer and barman-cloud-wal-archive. - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - name: - description: Name of the referent. - type: string - required: - - name - type: object - database: - description: 'Name of the database used by the application. - Default: `app`.' - type: string - owner: - description: |- - Name of the owner of the database in the instance to be used - by applications. Defaults to the value of the `database` key. - type: string - recoveryTarget: - description: |- - By default, the recovery process applies all the available - WAL files in the archive (full recovery). However, you can also - end the recovery as soon as a consistent state is reached or - recover to a point-in-time (PITR) by specifying a `RecoveryTarget` object, - as expected by PostgreSQL (i.e., timestamp, transaction Id, LSN, ...). - More info: https://www.postgresql.org/docs/current/runtime-config-wal.html#RUNTIME-CONFIG-WAL-RECOVERY-TARGET - properties: - backupID: - description: |- - The ID of the backup from which to start the recovery process. - If empty (default) the operator will automatically detect the backup - based on targetTime or targetLSN if specified. Otherwise use the - latest available backup in chronological order. - type: string - exclusive: - description: |- - Set the target to be exclusive. If omitted, defaults to false, so that - in Postgres, `recovery_target_inclusive` will be true - type: boolean - targetImmediate: - description: End recovery as soon as a consistent state - is reached - type: boolean - targetLSN: - description: The target LSN (Log Sequence Number) - type: string - targetName: - description: |- - The target name (to be previously created - with `pg_create_restore_point`) - type: string - targetTLI: - description: The target timeline ("latest" or a positive - integer) - type: string - targetTime: - description: |- - The target time as a timestamp in RFC3339 format or PostgreSQL timestamp format. - Timestamps without an explicit timezone are interpreted as UTC. - type: string - targetXID: - description: The target transaction ID - type: string - type: object - secret: - description: |- - Name of the secret containing the initial credentials for the - owner of the user database. If empty a new secret will be - created from scratch - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - source: - description: |- - The external cluster whose backup we will restore. This is also - used as the name of the folder under which the backup is stored, - so it must be set to the name of the source cluster - Mutually exclusive with `backup`. - type: string - volumeSnapshots: - description: |- - The static PVC data source(s) from which to initiate the - recovery procedure. Currently supporting `VolumeSnapshot` - and `PersistentVolumeClaim` resources that map an existing - PVC group, compatible with CloudNativePG, and taken with - a cold backup copy on a fenced Postgres instance (limitation - which will be removed in the future when online backup - will be implemented). - Mutually exclusive with `backup`. - properties: - storage: - description: Configuration of the storage of the instances - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - kind: - description: Kind is the type of resource being referenced - type: string - name: - description: Name is the name of resource being referenced - type: string - required: - - kind - - name - type: object - x-kubernetes-map-type: atomic - tablespaceStorage: - additionalProperties: - description: |- - TypedLocalObjectReference contains enough information to let you locate the - typed referenced object inside the same namespace. - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - kind: - description: Kind is the type of resource being - referenced - type: string - name: - description: Name is the name of resource being - referenced - type: string - required: - - kind - - name - type: object - x-kubernetes-map-type: atomic - description: Configuration of the storage for PostgreSQL - tablespaces - type: object - walStorage: - description: Configuration of the storage for PostgreSQL - WAL (Write-Ahead Log) - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - kind: - description: Kind is the type of resource being referenced - type: string - name: - description: Name is the name of resource being referenced - type: string - required: - - kind - - name - type: object - x-kubernetes-map-type: atomic - required: - - storage - type: object - type: object - type: object - certificates: - description: The configuration for the CA and related certificates - properties: - clientCASecret: - description: |- - The secret containing the Client CA certificate. If not defined, a new secret will be created - with a self-signed CA and will be used to generate all the client certificates.
-
- Contains:
-
- - `ca.crt`: CA that should be used to validate the client certificates, - used as `ssl_ca_file` of all the instances.
- - `ca.key`: key used to generate client certificates, if ReplicationTLSSecret is provided, - this can be omitted.
- type: string - replicationTLSSecret: - description: |- - The secret of type kubernetes.io/tls containing the client certificate to authenticate as - the `streaming_replica` user. - If not defined, ClientCASecret must provide also `ca.key`, and a new secret will be - created using the provided CA. - type: string - serverAltDNSNames: - description: The list of the server alternative DNS names to be - added to the generated server TLS certificates, when required. - items: - type: string - type: array - serverCASecret: - description: |- - The secret containing the Server CA certificate. If not defined, a new secret will be created - with a self-signed CA and will be used to generate the TLS certificate ServerTLSSecret.
-
- Contains:
-
- - `ca.crt`: CA that should be used to validate the server certificate, - used as `sslrootcert` in client connection strings.
- - `ca.key`: key used to generate Server SSL certs, if ServerTLSSecret is provided, - this can be omitted.
- type: string - serverTLSSecret: - description: |- - The secret of type kubernetes.io/tls containing the server TLS certificate and key that will be set as - `ssl_cert_file` and `ssl_key_file` so that clients can connect to postgres securely. - If not defined, ServerCASecret must provide also `ca.key` and a new secret will be - created using the provided CA. - type: string - type: object - description: - description: Description of this PostgreSQL cluster - type: string - enablePDB: - default: true - description: |- - Manage the `PodDisruptionBudget` resources within the cluster. When - configured as `true` (default setting), the pod disruption budgets - will safeguard the primary node from being terminated. Conversely, - setting it to `false` will result in the absence of any - `PodDisruptionBudget` resource, permitting the shutdown of all nodes - hosting the PostgreSQL cluster. This latter configuration is - advisable for any PostgreSQL cluster employed for - development/staging purposes. - type: boolean - enableSuperuserAccess: - default: false - description: |- - When this option is enabled, the operator will use the `SuperuserSecret` - to update the `postgres` user password (if the secret is - not present, the operator will automatically create one). When this - option is disabled, the operator will ignore the `SuperuserSecret` content, delete - it when automatically created, and then blank the password of the `postgres` - user by setting it to `NULL`. Disabled by default. - type: boolean - env: - description: |- - Env follows the Env format to pass environment variables - to the pods created in the cluster - items: - description: EnvVar represents an environment variable present in - a Container. - properties: - name: - description: |- - Name of the environment variable. - May consist of any printable ASCII characters except '='. - type: string - value: - description: |- - Variable references $(VAR_NAME) are expanded - using the previously defined environment variables in the container and - any service environment variables. If a variable cannot be resolved, - the reference in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. - "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". - Escaped references will never be expanded, regardless of whether the variable - exists or not. - Defaults to "". - type: string - valueFrom: - description: Source for the environment variable's value. Cannot - be used if value is not empty. - properties: - configMapKeyRef: - description: Selects a key of a ConfigMap. - properties: - key: - description: The key to select. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the ConfigMap or its key - must be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - fieldRef: - description: |- - Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, - spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. - properties: - apiVersion: - description: Version of the schema the FieldPath is - written in terms of, defaults to "v1". - type: string - fieldPath: - description: Path of the field to select in the specified - API version. - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - fileKeyRef: - description: |- - FileKeyRef selects a key of the env file. - Requires the EnvFiles feature gate to be enabled. - properties: - key: - description: |- - The key within the env file. An invalid key will prevent the pod from starting. - The keys defined within a source may consist of any printable ASCII characters except '='. - During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters. - type: string - optional: - default: false - description: |- - Specify whether the file or its key must be defined. If the file or key - does not exist, then the env var is not published. - If optional is set to true and the specified key does not exist, - the environment variable will not be set in the Pod's containers. - - If optional is set to false and the specified key does not exist, - an error will be returned during Pod creation. - type: boolean - path: - description: |- - The path within the volume from which to select the file. - Must be relative and may not contain the '..' path or start with '..'. - type: string - volumeName: - description: The name of the volume mount containing - the env file. - type: string - required: - - key - - path - - volumeName - type: object - x-kubernetes-map-type: atomic - resourceFieldRef: - description: |- - Selects a resource of the container: only resources limits and requests - (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. - properties: - containerName: - description: 'Container name: required for volumes, - optional for env vars' - type: string - divisor: - anyOf: - - type: integer - - type: string - description: Specifies the output format of the exposed - resources, defaults to "1" - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - description: 'Required: resource to select' - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - secretKeyRef: - description: Selects a key of a secret in the pod's namespace - properties: - key: - description: The key of the secret to select from. Must - be a valid secret key. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the Secret or its key must - be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - type: object - required: - - name - type: object - type: array - envFrom: - description: |- - EnvFrom follows the EnvFrom format to pass environment variables - sources to the pods to be used by Env - items: - description: EnvFromSource represents the source of a set of ConfigMaps - or Secrets - properties: - configMapRef: - description: The ConfigMap to select from - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the ConfigMap must be defined - type: boolean - type: object - x-kubernetes-map-type: atomic - prefix: - description: |- - Optional text to prepend to the name of each environment variable. - May consist of any printable ASCII characters except '='. - type: string - secretRef: - description: The Secret to select from - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the Secret must be defined - type: boolean - type: object - x-kubernetes-map-type: atomic - type: object - type: array - ephemeralVolumeSource: - description: EphemeralVolumeSource allows the user to configure the - source of ephemeral volumes. - properties: - volumeClaimTemplate: - description: |- - Will be used to create a stand-alone PVC to provision the volume. - The pod in which this EphemeralVolumeSource is embedded will be the - owner of the PVC, i.e. the PVC will be deleted together with the - pod. The name of the PVC will be `-` where - `` is the name from the `PodSpec.Volumes` array - entry. Pod validation will reject the pod if the concatenated name - is not valid for a PVC (for example, too long). - - An existing PVC with that name that is not owned by the pod - will *not* be used for the pod to avoid using an unrelated - volume by mistake. Starting the pod is then blocked until - the unrelated PVC is removed. If such a pre-created PVC is - meant to be used by the pod, the PVC has to updated with an - owner reference to the pod once the pod exists. Normally - this should not be necessary, but it may be useful when - manually reconstructing a broken cluster. - - This field is read-only and no changes will be made by Kubernetes - to the PVC after it has been created. - - Required, must not be nil. - properties: - metadata: - description: |- - May contain labels and annotations that will be copied into the PVC - when creating it. No other fields are allowed and will be rejected during - validation. - type: object - spec: - description: |- - The specification for the PersistentVolumeClaim. The entire content is - copied unchanged into the PVC that gets created from this - template. The same fields as in a PersistentVolumeClaim - are also valid here. - properties: - accessModes: - description: |- - accessModes contains the desired access modes the volume should have. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 - items: - type: string - type: array - x-kubernetes-list-type: atomic - dataSource: - description: |- - dataSource field can be used to specify either: - * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) - * An existing PVC (PersistentVolumeClaim) - If the provisioner or an external controller can support the specified data source, - it will create a new volume based on the contents of the specified data source. - When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, - and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. - If the namespace is specified, then dataSourceRef will not be copied to dataSource. - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - kind: - description: Kind is the type of resource being referenced - type: string - name: - description: Name is the name of resource being referenced - type: string - required: - - kind - - name - type: object - x-kubernetes-map-type: atomic - dataSourceRef: - description: |- - dataSourceRef specifies the object from which to populate the volume with data, if a non-empty - volume is desired. This may be any object from a non-empty API group (non - core object) or a PersistentVolumeClaim object. - When this field is specified, volume binding will only succeed if the type of - the specified object matches some installed volume populator or dynamic - provisioner. - This field will replace the functionality of the dataSource field and as such - if both fields are non-empty, they must have the same value. For backwards - compatibility, when namespace isn't specified in dataSourceRef, - both fields (dataSource and dataSourceRef) will be set to the same - value automatically if one of them is empty and the other is non-empty. - When namespace is specified in dataSourceRef, - dataSource isn't set to the same value and must be empty. - There are three important differences between dataSource and dataSourceRef: - * While dataSource only allows two specific types of objects, dataSourceRef - allows any non-core object, as well as PersistentVolumeClaim objects. - * While dataSource ignores disallowed values (dropping them), dataSourceRef - preserves all values, and generates an error if a disallowed value is - specified. - * While dataSource only allows local objects, dataSourceRef allows objects - in any namespaces. - (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. - (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - kind: - description: Kind is the type of resource being referenced - type: string - name: - description: Name is the name of resource being referenced - type: string - namespace: - description: |- - Namespace is the namespace of resource being referenced - Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. - (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. - type: string - required: - - kind - - name - type: object - resources: - description: |- - resources represents the minimum resources the volume should have. - Users are allowed to specify resource requirements - that are lower than previous value but must still be higher than capacity recorded in the - status field of the claim. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Limits describes the maximum amount of compute resources allowed. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Requests describes the minimum amount of compute resources required. - If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. Requests cannot exceed Limits. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - type: object - selector: - description: selector is a label query over volumes to - consider for binding. - properties: - matchExpressions: - description: matchExpressions is a list of label selector - requirements. The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the selector - applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - storageClassName: - description: |- - storageClassName is the name of the StorageClass required by the claim. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 - type: string - volumeAttributesClassName: - description: |- - volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. - If specified, the CSI driver will create or update the volume with the attributes defined - in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, - it can be changed after the claim is created. An empty string or nil value indicates that no - VolumeAttributesClass will be applied to the claim. If the claim enters an Infeasible error state, - this field can be reset to its previous value (including nil) to cancel the modification. - If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be - set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource - exists. - More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ - type: string - volumeMode: - description: |- - volumeMode defines what type of volume is required by the claim. - Value of Filesystem is implied when not included in claim spec. - type: string - volumeName: - description: volumeName is the binding reference to the - PersistentVolume backing this claim. - type: string - type: object - required: - - spec - type: object - type: object - ephemeralVolumesSizeLimit: - description: |- - EphemeralVolumesSizeLimit allows the user to set the limits for the ephemeral - volumes - properties: - shm: - anyOf: - - type: integer - - type: string - description: Shm is the size limit of the shared memory volume - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - temporaryData: - anyOf: - - type: integer - - type: string - description: TemporaryData is the size limit of the temporary - data volume - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - externalClusters: - description: The list of external clusters which are used in the configuration - items: - description: |- - ExternalCluster represents the connection parameters to an - external cluster which is used in the other sections of the configuration - properties: - barmanObjectStore: - description: The configuration for the barman-cloud tool suite - properties: - azureCredentials: - description: The credentials to use to upload data to Azure - Blob Storage - properties: - connectionString: - description: The connection string to be used - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - inheritFromAzureAD: - description: Use the Azure AD based authentication without - providing explicitly the keys. - type: boolean - storageAccount: - description: The storage account where to upload data - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - storageKey: - description: |- - The storage account key to be used in conjunction - with the storage account name - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - storageSasToken: - description: |- - A shared-access-signature to be used in conjunction with - the storage account name - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - useDefaultAzureCredentials: - description: |- - Use the default Azure authentication flow, which includes DefaultAzureCredential. - This allows authentication using environment variables and managed identities. - type: boolean - type: object - data: - description: |- - The configuration to be used to backup the data files - When not defined, base backups files will be stored uncompressed and may - be unencrypted in the object store, according to the bucket default - policy. - properties: - additionalCommandArgs: - description: |- - AdditionalCommandArgs represents additional arguments that can be appended - to the 'barman-cloud-backup' command-line invocation. These arguments - provide flexibility to customize the backup process further according to - specific requirements or configurations. - - Example: - In a scenario where specialized backup options are required, such as setting - a specific timeout or defining custom behavior, users can use this field - to specify additional command arguments. - - Note: - It's essential to ensure that the provided arguments are valid and supported - by the 'barman-cloud-backup' command, to avoid potential errors or unintended - behavior during execution. - items: - type: string - type: array - compression: - description: |- - Compress a backup file (a tar file per tablespace) while streaming it - to the object store. Available options are empty string (no - compression, default), `gzip`, `bzip2`, `lz4`, and `snappy`. - enum: - - bzip2 - - gzip - - lz4 - - snappy - type: string - encryption: - description: |- - Whenever to force the encryption of files (if the bucket is - not already configured for that). - Allowed options are empty string (use the bucket policy, default), - `AES256` and `aws:kms` - enum: - - AES256 - - aws:kms - type: string - immediateCheckpoint: - description: |- - Control whether the I/O workload for the backup initial checkpoint will - be limited, according to the `checkpoint_completion_target` setting on - the PostgreSQL server. If set to true, an immediate checkpoint will be - used, meaning PostgreSQL will complete the checkpoint as soon as - possible. `false` by default. - type: boolean - jobs: - description: |- - The number of parallel jobs to be used to upload the backup, defaults - to 2 - format: int32 - minimum: 1 - type: integer - type: object - destinationPath: - description: |- - The path where to store the backup (i.e. s3://bucket/path/to/folder) - this path, with different destination folders, will be used for WALs - and for data - minLength: 1 - type: string - endpointCA: - description: |- - EndpointCA store the CA bundle of the barman endpoint. - Useful when using self-signed certificates to avoid - errors with certificate issuer and barman-cloud-wal-archive - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - endpointURL: - description: |- - Endpoint to be used to upload data to the cloud, - overriding the automatic endpoint discovery - type: string - googleCredentials: - description: The credentials to use to upload data to Google - Cloud Storage - properties: - applicationCredentials: - description: The secret containing the Google Cloud - Storage JSON file with the credentials - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - gkeEnvironment: - description: |- - If set to true, will presume that it's running inside a GKE environment, - default to false. - type: boolean - type: object - historyTags: - additionalProperties: - type: string - description: |- - HistoryTags is a list of key value pairs that will be passed to the - Barman --history-tags option. - type: object - s3Credentials: - description: The credentials to use to upload data to S3 - properties: - accessKeyId: - description: The reference to the access key id - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - inheritFromIAMRole: - description: Use the role based authentication without - providing explicitly the keys. - type: boolean - region: - description: The reference to the secret containing - the region name - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - secretAccessKey: - description: The reference to the secret access key - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - sessionToken: - description: The references to the session key - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - type: object - serverName: - description: |- - The server name on S3, the cluster name is used if this - parameter is omitted - type: string - tags: - additionalProperties: - type: string - description: |- - Tags is a list of key value pairs that will be passed to the - Barman --tags option. - type: object - wal: - description: |- - The configuration for the backup of the WAL stream. - When not defined, WAL files will be stored uncompressed and may be - unencrypted in the object store, according to the bucket default policy. - properties: - archiveAdditionalCommandArgs: - description: |- - Additional arguments that can be appended to the 'barman-cloud-wal-archive' - command-line invocation. These arguments provide flexibility to customize - the WAL archive process further, according to specific requirements or configurations. - - Example: - In a scenario where specialized backup options are required, such as setting - a specific timeout or defining custom behavior, users can use this field - to specify additional command arguments. - - Note: - It's essential to ensure that the provided arguments are valid and supported - by the 'barman-cloud-wal-archive' command, to avoid potential errors or unintended - behavior during execution. - items: - type: string - type: array - compression: - description: |- - Compress a WAL file before sending it to the object store. Available - options are empty string (no compression, default), `gzip`, `bzip2`, - `lz4`, `snappy`, `xz`, and `zstd`. - enum: - - bzip2 - - gzip - - lz4 - - snappy - - xz - - zstd - type: string - encryption: - description: |- - Whenever to force the encryption of files (if the bucket is - not already configured for that). - Allowed options are empty string (use the bucket policy, default), - `AES256` and `aws:kms` - enum: - - AES256 - - aws:kms - type: string - maxParallel: - description: |- - Number of WAL files to be either archived in parallel (when the - PostgreSQL instance is archiving to a backup object store) or - restored in parallel (when a PostgreSQL standby is fetching WAL - files from a recovery object store). If not specified, WAL files - will be processed one at a time. It accepts a positive integer as a - value - with 1 being the minimum accepted value. - minimum: 1 - type: integer - restoreAdditionalCommandArgs: - description: |- - Additional arguments that can be appended to the 'barman-cloud-wal-restore' - command-line invocation. These arguments provide flexibility to customize - the WAL restore process further, according to specific requirements or configurations. - - Example: - In a scenario where specialized backup options are required, such as setting - a specific timeout or defining custom behavior, users can use this field - to specify additional command arguments. - - Note: - It's essential to ensure that the provided arguments are valid and supported - by the 'barman-cloud-wal-restore' command, to avoid potential errors or unintended - behavior during execution. - items: - type: string - type: array - type: object - required: - - destinationPath - type: object - connectionParameters: - additionalProperties: - type: string - description: The list of connection parameters, such as dbname, - host, username, etc - type: object - name: - description: The server name, required - type: string - password: - description: |- - The reference to the password to be used to connect to the server. - If a password is provided, CloudNativePG creates a PostgreSQL - passfile at `/controller/external/NAME/pass` (where "NAME" is the - cluster's name). This passfile is automatically referenced in the - connection string when establishing a connection to the remote - PostgreSQL server from the current PostgreSQL `Cluster`. This ensures - secure and efficient password management for external clusters. - properties: - key: - description: The key of the secret to select from. Must - be a valid secret key. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the Secret or its key must - be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - plugin: - description: |- - The configuration of the plugin that is taking care - of WAL archiving and backups for this external cluster - properties: - enabled: - default: true - description: Enabled is true if this plugin will be used - type: boolean - isWALArchiver: - default: false - description: |- - Marks the plugin as the WAL archiver. At most one plugin can be - designated as a WAL archiver. This cannot be enabled if the - `.spec.backup.barmanObjectStore` configuration is present. - type: boolean - name: - description: Name is the plugin name - type: string - parameters: - additionalProperties: - type: string - description: Parameters is the configuration of the plugin - type: object - required: - - name - type: object - sslCert: - description: |- - The reference to an SSL certificate to be used to connect to this - instance - properties: - key: - description: The key of the secret to select from. Must - be a valid secret key. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the Secret or its key must - be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - sslKey: - description: |- - The reference to an SSL private key to be used to connect to this - instance - properties: - key: - description: The key of the secret to select from. Must - be a valid secret key. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the Secret or its key must - be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - sslRootCert: - description: |- - The reference to an SSL CA public key to be used to connect to this - instance - properties: - key: - description: The key of the secret to select from. Must - be a valid secret key. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the Secret or its key must - be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - required: - - name - type: object - type: array - failoverDelay: - default: 0 - description: |- - The amount of time (in seconds) to wait before triggering a failover - after the primary PostgreSQL instance in the cluster was detected - to be unhealthy - format: int32 - type: integer - imageCatalogRef: - description: Defines the major PostgreSQL version we want to use within - an ImageCatalog - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - kind: - description: Kind is the type of resource being referenced - type: string - major: - description: The major version of PostgreSQL we want to use from - the ImageCatalog - type: integer - name: - description: Name is the name of resource being referenced - type: string - required: - - kind - - major - - name - type: object - x-kubernetes-map-type: atomic - x-kubernetes-validations: - - message: Only image catalogs are supported - rule: self.kind == 'ImageCatalog' || self.kind == 'ClusterImageCatalog' - - message: Only image catalogs are supported - rule: self.apiGroup == 'postgresql.cnpg.io' - imageName: - description: |- - Name of the container image, supporting both tags (`:`) - and digests for deterministic and repeatable deployments - (`:@sha256:`) - type: string - imagePullPolicy: - description: |- - Image pull policy. - One of `Always`, `Never` or `IfNotPresent`. - If not defined, it defaults to `IfNotPresent`. - Cannot be updated. - More info: https://kubernetes.io/docs/concepts/containers/images#updating-images - type: string - imagePullSecrets: - description: The list of pull secrets to be used to pull the images - items: - description: |- - LocalObjectReference contains enough information to let you locate a - local object with a known type inside the same namespace - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - type: array - inheritedMetadata: - description: Metadata that will be inherited by all objects related - to the Cluster - properties: - annotations: - additionalProperties: - type: string - type: object - labels: - additionalProperties: - type: string - type: object - type: object - instances: - default: 1 - description: Number of instances required in the cluster - minimum: 1 - type: integer - livenessProbeTimeout: - description: |- - LivenessProbeTimeout is the time (in seconds) that is allowed for a PostgreSQL instance - to successfully respond to the liveness probe (default 30). - The Liveness probe failure threshold is derived from this value using the formula: - ceiling(livenessProbe / 10). - format: int32 - type: integer - logLevel: - default: info - description: 'The instances'' log level, one of the following values: - error, warning, info (default), debug, trace' - enum: - - error - - warning - - info - - debug - - trace - type: string - managed: - description: The configuration that is used by the portions of PostgreSQL - that are managed by the instance manager - properties: - roles: - description: Database roles managed by the `Cluster` - items: - description: |- - RoleConfiguration is the representation, in Kubernetes, of a PostgreSQL role - with the additional field Ensure specifying whether to ensure the presence or - absence of the role in the database - - The defaults of the CREATE ROLE command are applied - Reference: https://www.postgresql.org/docs/current/sql-createrole.html - properties: - bypassrls: - description: |- - Whether a role bypasses every row-level security (RLS) policy. - Default is `false`. - type: boolean - comment: - description: Description of the role - type: string - connectionLimit: - default: -1 - description: |- - If the role can log in, this specifies how many concurrent - connections the role can make. `-1` (the default) means no limit. - format: int64 - type: integer - createdb: - description: |- - When set to `true`, the role being defined will be allowed to create - new databases. Specifying `false` (default) will deny a role the - ability to create databases. - type: boolean - createrole: - description: |- - Whether the role will be permitted to create, alter, drop, comment - on, change the security label for, and grant or revoke membership in - other roles. Default is `false`. - type: boolean - disablePassword: - description: DisablePassword indicates that a role's password - should be set to NULL in Postgres - type: boolean - ensure: - default: present - description: Ensure the role is `present` or `absent` - - defaults to "present" - enum: - - present - - absent - type: string - inRoles: - description: |- - List of one or more existing roles to which this role will be - immediately added as a new member. Default empty. - Changes to the list are applied to an existing role through - `GRANT` and `REVOKE` statements, not only at role creation. - items: - type: string - type: array - inherit: - default: true - description: |- - Whether a role "inherits" the privileges of roles it is a member of. - Default is `true`. - type: boolean - login: - description: |- - Whether the role is allowed to log in. A role having the `login` - attribute can be thought of as a user. Roles without this attribute - are useful for managing database privileges, but are not users in - the usual sense of the word. Default is `false`. - type: boolean - name: - description: Name of the role - type: string - passwordSecret: - description: |- - Secret containing the password of the role (if present). - If null, the password will be ignored unless DisablePassword is set. - When set, the secret must follow the `kubernetes.io/basic-auth` format - and contain both a `username` and a `password` field. - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - replication: - description: |- - Whether a role is a replication role. A role must have this - attribute (or be a superuser) in order to be able to connect to the - server in replication mode (physical or logical replication) and in - order to be able to create or drop replication slots. A role having - the `replication` attribute is a very highly privileged role, and - should only be used on roles actually used for replication. Default - is `false`. - type: boolean - superuser: - description: |- - Whether the role is a `superuser` who can override all access - restrictions within the database - superuser status is dangerous and - should be used only when really needed. You must yourself be a - superuser to create a new superuser. Defaults is `false`. - type: boolean - validUntil: - description: |- - Date and time after which the role's password is no longer valid. - When omitted, the password will never expire (default). - format: date-time - type: string - required: - - name - type: object - type: array - services: - description: Services roles managed by the `Cluster` - properties: - additional: - description: Additional is a list of additional managed services - specified by the user. - items: - description: |- - ManagedService represents a specific service managed by the cluster. - It includes the type of service and its associated template specification. - properties: - selectorType: - description: |- - SelectorType specifies the type of selectors that the service will have. - Valid values are "rw", "r", and "ro", representing read-write, read, and read-only services. - enum: - - rw - - r - - ro - type: string - serviceTemplate: - description: ServiceTemplate is the template specification - for the service. - properties: - metadata: - description: |- - Standard object's metadata. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - properties: - annotations: - additionalProperties: - type: string - description: |- - Annotations is an unstructured key value map stored with a resource that may be - set by external tools to store and retrieve arbitrary metadata. They are not - queryable and should be preserved when modifying objects. - More info: http://kubernetes.io/docs/user-guide/annotations - type: object - labels: - additionalProperties: - type: string - description: |- - Map of string keys and values that can be used to organize and categorize - (scope and select) objects. May match selectors of replication controllers - and services. - More info: http://kubernetes.io/docs/user-guide/labels - type: object - name: - description: The name of the resource. Only - supported for certain types - type: string - type: object - spec: - description: |- - Specification of the desired behavior of the service. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - allocateLoadBalancerNodePorts: - description: |- - allocateLoadBalancerNodePorts defines if NodePorts will be automatically - allocated for services with type LoadBalancer. Default is "true". It - may be set to "false" if the cluster load-balancer does not rely on - NodePorts. If the caller requests specific NodePorts (by specifying a - value), those requests will be respected, regardless of this field. - This field may only be set for services with type LoadBalancer and will - be cleared if the type is changed to any other type. - type: boolean - clusterIP: - description: |- - clusterIP is the IP address of the service and is usually assigned - randomly. If an address is specified manually, is in-range (as per - system configuration), and is not in use, it will be allocated to the - service; otherwise creation of the service will fail. This field may not - be changed through updates unless the type field is also being changed - to ExternalName (which requires this field to be blank) or the type - field is being changed from ExternalName (in which case this field may - optionally be specified, as describe above). Valid values are "None", - empty string (""), or a valid IP address. Setting this to "None" makes a - "headless service" (no virtual IP), which is useful when direct endpoint - connections are preferred and proxying is not required. Only applies to - types ClusterIP, NodePort, and LoadBalancer. If this field is specified - when creating a Service of type ExternalName, creation will fail. This - field will be wiped when updating a Service to type ExternalName. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - type: string - clusterIPs: - description: |- - ClusterIPs is a list of IP addresses assigned to this service, and are - usually assigned randomly. If an address is specified manually, is - in-range (as per system configuration), and is not in use, it will be - allocated to the service; otherwise creation of the service will fail. - This field may not be changed through updates unless the type field is - also being changed to ExternalName (which requires this field to be - empty) or the type field is being changed from ExternalName (in which - case this field may optionally be specified, as describe above). Valid - values are "None", empty string (""), or a valid IP address. Setting - this to "None" makes a "headless service" (no virtual IP), which is - useful when direct endpoint connections are preferred and proxying is - not required. Only applies to types ClusterIP, NodePort, and - LoadBalancer. If this field is specified when creating a Service of type - ExternalName, creation will fail. This field will be wiped when updating - a Service to type ExternalName. If this field is not specified, it will - be initialized from the clusterIP field. If this field is specified, - clients must ensure that clusterIPs[0] and clusterIP have the same - value. - - This field may hold a maximum of two entries (dual-stack IPs, in either order). - These IPs must correspond to the values of the ipFamilies field. Both - clusterIPs and ipFamilies are governed by the ipFamilyPolicy field. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - items: - type: string - type: array - x-kubernetes-list-type: atomic - externalIPs: - description: |- - externalIPs is a list of IP addresses for which nodes in the cluster - will also accept traffic for this service. These IPs are not managed by - Kubernetes. The user is responsible for ensuring that traffic arrives - at a node with this IP. A common example is external load-balancers - that are not part of the Kubernetes system. - items: - type: string - type: array - x-kubernetes-list-type: atomic - externalName: - description: |- - externalName is the external reference that discovery mechanisms will - return as an alias for this service (e.g. a DNS CNAME record). No - proxying will be involved. Must be a lowercase RFC-1123 hostname - (https://tools.ietf.org/html/rfc1123) and requires `type` to be "ExternalName". - type: string - externalTrafficPolicy: - description: |- - externalTrafficPolicy describes how nodes distribute service traffic they - receive on one of the Service's "externally-facing" addresses (NodePorts, - ExternalIPs, and LoadBalancer IPs). If set to "Local", the proxy will configure - the service in a way that assumes that external load balancers will take care - of balancing the service traffic between nodes, and so each node will deliver - traffic only to the node-local endpoints of the service, without masquerading - the client source IP. (Traffic mistakenly sent to a node with no endpoints will - be dropped.) The default value, "Cluster", uses the standard behavior of - routing to all endpoints evenly (possibly modified by topology and other - features). Note that traffic sent to an External IP or LoadBalancer IP from - within the cluster will always get "Cluster" semantics, but clients sending to - a NodePort from within the cluster may need to take traffic policy into account - when picking a node. - type: string - healthCheckNodePort: - description: |- - healthCheckNodePort specifies the healthcheck nodePort for the service. - This only applies when type is set to LoadBalancer and - externalTrafficPolicy is set to Local. If a value is specified, is - in-range, and is not in use, it will be used. If not specified, a value - will be automatically allocated. External systems (e.g. load-balancers) - can use this port to determine if a given node holds endpoints for this - service or not. If this field is specified when creating a Service - which does not need it, creation will fail. This field will be wiped - when updating a Service to no longer need it (e.g. changing type). - This field cannot be updated once set. - format: int32 - type: integer - internalTrafficPolicy: - description: |- - InternalTrafficPolicy describes how nodes distribute service traffic they - receive on the ClusterIP. If set to "Local", the proxy will assume that pods - only want to talk to endpoints of the service on the same node as the pod, - dropping the traffic if there are no local endpoints. The default value, - "Cluster", uses the standard behavior of routing to all endpoints evenly - (possibly modified by topology and other features). - type: string - ipFamilies: - description: |- - IPFamilies is a list of IP families (e.g. IPv4, IPv6) assigned to this - service. This field is usually assigned automatically based on cluster - configuration and the ipFamilyPolicy field. If this field is specified - manually, the requested family is available in the cluster, - and ipFamilyPolicy allows it, it will be used; otherwise creation of - the service will fail. This field is conditionally mutable: it allows - for adding or removing a secondary IP family, but it does not allow - changing the primary IP family of the Service. Valid values are "IPv4" - and "IPv6". This field only applies to Services of types ClusterIP, - NodePort, and LoadBalancer, and does apply to "headless" services. - This field will be wiped when updating a Service to type ExternalName. - - This field may hold a maximum of two entries (dual-stack families, in - either order). These families must correspond to the values of the - clusterIPs field, if specified. Both clusterIPs and ipFamilies are - governed by the ipFamilyPolicy field. - items: - description: |- - IPFamily represents the IP Family (IPv4 or IPv6). This type is used - to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). - type: string - type: array - x-kubernetes-list-type: atomic - ipFamilyPolicy: - description: |- - IPFamilyPolicy represents the dual-stack-ness requested or required by - this Service. If there is no value provided, then this field will be set - to SingleStack. Services can be "SingleStack" (a single IP family), - "PreferDualStack" (two IP families on dual-stack configured clusters or - a single IP family on single-stack clusters), or "RequireDualStack" - (two IP families on dual-stack configured clusters, otherwise fail). The - ipFamilies and clusterIPs fields depend on the value of this field. This - field will be wiped when updating a service to type ExternalName. - type: string - loadBalancerClass: - description: |- - loadBalancerClass is the class of the load balancer implementation this Service belongs to. - If specified, the value of this field must be a label-style identifier, with an optional prefix, - e.g. "internal-vip" or "example.com/internal-vip". Unprefixed names are reserved for end-users. - This field can only be set when the Service type is 'LoadBalancer'. If not set, the default load - balancer implementation is used, today this is typically done through the cloud provider integration, - but should apply for any default implementation. If set, it is assumed that a load balancer - implementation is watching for Services with a matching class. Any default load balancer - implementation (e.g. cloud providers) should ignore Services that set this field. - This field can only be set when creating or updating a Service to type 'LoadBalancer'. - Once set, it can not be changed. This field will be wiped when a service is updated to a non 'LoadBalancer' type. - type: string - loadBalancerIP: - description: |- - Only applies to Service Type: LoadBalancer. - This feature depends on whether the underlying cloud-provider supports specifying - the loadBalancerIP when a load balancer is created. - This field will be ignored if the cloud-provider does not support the feature. - Deprecated: This field was under-specified and its meaning varies across implementations. - Using it is non-portable and it may not support dual-stack. - Users are encouraged to use implementation-specific annotations when available. - type: string - loadBalancerSourceRanges: - description: |- - If specified and supported by the platform, this will restrict traffic through the cloud-provider - load-balancer will be restricted to the specified client IPs. This field will be ignored if the - cloud-provider does not support the feature." - More info: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/ - items: - type: string - type: array - x-kubernetes-list-type: atomic - ports: - description: |- - The list of ports that are exposed by this service. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - items: - description: ServicePort contains information - on service's port. - properties: - appProtocol: - description: |- - The application protocol for this port. - This is used as a hint for implementations to offer richer behavior for protocols that they understand. - This field follows standard Kubernetes label syntax. - Valid values are either: - - * Un-prefixed protocol names - reserved for IANA standard service names (as per - RFC-6335 and https://www.iana.org/assignments/service-names). - - * Kubernetes-defined prefixed names: - * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- - * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 - * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - - * Other protocols should use implementation-defined prefixed names such as - mycompany.com/my-custom-protocol. - type: string - name: - description: |- - The name of this port within the service. This must be a DNS_LABEL. - All ports within a ServiceSpec must have unique names. When considering - the endpoints for a Service, this must match the 'name' field in the - EndpointPort. - Optional if only one ServicePort is defined on this service. - type: string - nodePort: - description: |- - The port on each node on which this service is exposed when type is - NodePort or LoadBalancer. Usually assigned by the system. If a value is - specified, in-range, and not in use it will be used, otherwise the - operation will fail. If not specified, a port will be allocated if this - Service requires one. If this field is specified when creating a - Service which does not need it, creation will fail. This field will be - wiped when updating a Service to no longer need it (e.g. changing type - from NodePort to ClusterIP). - More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport - format: int32 - type: integer - port: - description: The port that will be exposed - by this service. - format: int32 - type: integer - protocol: - default: TCP - description: |- - The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". - Default is TCP. - type: string - targetPort: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the pods targeted by the service. - Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. - If this is a string, it will be looked up as a named port in the - target Pod's container ports. If this is not specified, the value - of the 'port' field is used (an identity map). - This field is ignored for services with clusterIP=None, and should be - omitted or set equal to the 'port' field. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service - x-kubernetes-int-or-string: true - required: - - port - type: object - type: array - x-kubernetes-list-map-keys: - - port - - protocol - x-kubernetes-list-type: map - publishNotReadyAddresses: - description: |- - publishNotReadyAddresses indicates that any agent which deals with endpoints for this - Service should disregard any indications of ready/not-ready. - The primary use case for setting this field is for a StatefulSet's Headless Service to - propagate SRV DNS records for its Pods for the purpose of peer discovery. - The Kubernetes controllers that generate Endpoints and EndpointSlice resources for - Services interpret this to mean that all endpoints are considered "ready" even if the - Pods themselves are not. Agents which consume only Kubernetes generated endpoints - through the Endpoints or EndpointSlice resources can safely assume this behavior. - type: boolean - selector: - additionalProperties: - type: string - description: |- - Route service traffic to pods with label keys and values matching this - selector. If empty or not present, the service is assumed to have an - external process managing its endpoints, which Kubernetes will not - modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. - Ignored if type is ExternalName. - More info: https://kubernetes.io/docs/concepts/services-networking/service/ - type: object - x-kubernetes-map-type: atomic - sessionAffinity: - description: |- - Supports "ClientIP" and "None". Used to maintain session affinity. - Enable client IP based session affinity. - Must be ClientIP or None. - Defaults to None. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - type: string - sessionAffinityConfig: - description: sessionAffinityConfig contains - the configurations of session affinity. - properties: - clientIP: - description: clientIP contains the configurations - of Client IP based session affinity. - properties: - timeoutSeconds: - description: |- - timeoutSeconds specifies the seconds of ClientIP type session sticky time. - The value must be >0 && <=86400(for 1 day) if ServiceAffinity == "ClientIP". - Default value is 10800(for 3 hours). - format: int32 - type: integer - type: object - type: object - trafficDistribution: - description: |- - TrafficDistribution offers a way to express preferences for how traffic - is distributed to Service endpoints. Implementations can use this field - as a hint, but are not required to guarantee strict adherence. If the - field is not set, the implementation will apply its default routing - strategy. If set to "PreferClose", implementations should prioritize - endpoints that are in the same zone. - type: string - type: - description: |- - type determines how the Service is exposed. Defaults to ClusterIP. Valid - options are ExternalName, ClusterIP, NodePort, and LoadBalancer. - "ClusterIP" allocates a cluster-internal IP address for load-balancing - to endpoints. Endpoints are determined by the selector or if that is not - specified, by manual construction of an Endpoints object or - EndpointSlice objects. If clusterIP is "None", no virtual IP is - allocated and the endpoints are published as a set of endpoints rather - than a virtual IP. - "NodePort" builds on ClusterIP and allocates a port on every node which - routes to the same endpoints as the clusterIP. - "LoadBalancer" builds on NodePort and creates an external load-balancer - (if supported in the current cloud) which routes to the same endpoints - as the clusterIP. - "ExternalName" aliases this service to the specified externalName. - Several other fields do not apply to ExternalName services. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types - type: string - type: object - type: object - updateStrategy: - default: patch - description: UpdateStrategy describes how the service - differences should be reconciled - enum: - - patch - - replace - type: string - required: - - selectorType - - serviceTemplate - type: object - type: array - disabledDefaultServices: - description: |- - DisabledDefaultServices is a list of service types that are disabled by default. - Valid values are "r", and "ro", representing read, and read-only services. - items: - description: |- - ServiceSelectorType describes a valid value for generating the service selectors. - It indicates which type of service the selector applies to, such as read-write, read, or read-only - enum: - - rw - - r - - ro - type: string - type: array - type: object - type: object - maxSyncReplicas: - default: 0 - description: |- - The target value for the synchronous replication quorum, that can be - decreased if the number of ready standbys is lower than this. - Undefined or 0 disable synchronous replication. - minimum: 0 - type: integer - minSyncReplicas: - default: 0 - description: |- - Minimum number of instances required in synchronous replication with the - primary. Undefined or 0 allow writes to complete when no standby is - available. - minimum: 0 - type: integer - monitoring: - description: The configuration of the monitoring infrastructure of - this cluster - properties: - customQueriesConfigMap: - description: The list of config maps containing the custom queries - items: - description: |- - ConfigMapKeySelector contains enough information to let you locate - the key of a ConfigMap - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - type: array - customQueriesSecret: - description: The list of secrets containing the custom queries - items: - description: |- - SecretKeySelector contains enough information to let you locate - the key of a Secret - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - type: array - disableDefaultQueries: - default: false - description: |- - Whether the default queries should be injected. - Set it to `true` if you don't want to inject default queries into the cluster. - Default: false. - type: boolean - enablePodMonitor: - default: false - description: |- - Enable or disable the `PodMonitor` - - Deprecated: This feature will be removed in an upcoming release. If - you need this functionality, you can create a PodMonitor manually. - type: boolean - metricsQueriesTTL: - description: |- - The interval during which metrics computed from queries are considered current. - Once it is exceeded, a new scrape will trigger a rerun - of the queries. - If not set, defaults to 30 seconds, in line with Prometheus scraping defaults. - Setting this to zero disables the caching mechanism and can cause heavy load on the PostgreSQL server. - type: string - podMonitorMetricRelabelings: - description: |- - The list of metric relabelings for the `PodMonitor`. Applied to samples before ingestion. - - Deprecated: This feature will be removed in an upcoming release. If - you need this functionality, you can create a PodMonitor manually. - items: - description: |- - RelabelConfig allows dynamic rewriting of the label set for targets, alerts, - scraped samples and remote write samples. - - More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config - properties: - action: - default: replace - description: |- - action to perform based on the regex matching. - - `Uppercase` and `Lowercase` actions require Prometheus >= v2.36.0. - `DropEqual` and `KeepEqual` actions require Prometheus >= v2.41.0. - - Default: "Replace" - enum: - - replace - - Replace - - keep - - Keep - - drop - - Drop - - hashmod - - HashMod - - labelmap - - LabelMap - - labeldrop - - LabelDrop - - labelkeep - - LabelKeep - - lowercase - - Lowercase - - uppercase - - Uppercase - - keepequal - - KeepEqual - - dropequal - - DropEqual - type: string - modulus: - description: |- - modulus to take of the hash of the source label values. - - Only applicable when the action is `HashMod`. - format: int64 - type: integer - regex: - description: regex defines the regular expression against - which the extracted value is matched. - type: string - replacement: - description: |- - replacement value against which a Replace action is performed if the - regular expression matches. - - Regex capture groups are available. - type: string - separator: - description: separator defines the string between concatenated - SourceLabels. - type: string - sourceLabels: - description: |- - sourceLabels defines the source labels select values from existing labels. Their content is - concatenated using the configured Separator and matched against the - configured regular expression. - items: - description: |- - LabelName is a valid Prometheus label name. - For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. - For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. - type: string - type: array - targetLabel: - description: |- - targetLabel defines the label to which the resulting string is written in a replacement. - - It is mandatory for `Replace`, `HashMod`, `Lowercase`, `Uppercase`, - `KeepEqual` and `DropEqual` actions. - - Regex capture groups are available. - type: string - type: object - type: array - podMonitorRelabelings: - description: |- - The list of relabelings for the `PodMonitor`. Applied to samples before scraping. - - Deprecated: This feature will be removed in an upcoming release. If - you need this functionality, you can create a PodMonitor manually. - items: - description: |- - RelabelConfig allows dynamic rewriting of the label set for targets, alerts, - scraped samples and remote write samples. - - More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config - properties: - action: - default: replace - description: |- - action to perform based on the regex matching. - - `Uppercase` and `Lowercase` actions require Prometheus >= v2.36.0. - `DropEqual` and `KeepEqual` actions require Prometheus >= v2.41.0. - - Default: "Replace" - enum: - - replace - - Replace - - keep - - Keep - - drop - - Drop - - hashmod - - HashMod - - labelmap - - LabelMap - - labeldrop - - LabelDrop - - labelkeep - - LabelKeep - - lowercase - - Lowercase - - uppercase - - Uppercase - - keepequal - - KeepEqual - - dropequal - - DropEqual - type: string - modulus: - description: |- - modulus to take of the hash of the source label values. - - Only applicable when the action is `HashMod`. - format: int64 - type: integer - regex: - description: regex defines the regular expression against - which the extracted value is matched. - type: string - replacement: - description: |- - replacement value against which a Replace action is performed if the - regular expression matches. - - Regex capture groups are available. - type: string - separator: - description: separator defines the string between concatenated - SourceLabels. - type: string - sourceLabels: - description: |- - sourceLabels defines the source labels select values from existing labels. Their content is - concatenated using the configured Separator and matched against the - configured regular expression. - items: - description: |- - LabelName is a valid Prometheus label name. - For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. - For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. - type: string - type: array - targetLabel: - description: |- - targetLabel defines the label to which the resulting string is written in a replacement. - - It is mandatory for `Replace`, `HashMod`, `Lowercase`, `Uppercase`, - `KeepEqual` and `DropEqual` actions. - - Regex capture groups are available. - type: string - type: object - type: array - tls: - description: |- - Configure TLS communication for the metrics endpoint. - Changing tls.enabled option will force a rollout of all instances. - properties: - enabled: - default: false - description: |- - Enable TLS for the monitoring endpoint. - Changing this option will force a rollout of all instances. - type: boolean - type: object - type: object - nodeMaintenanceWindow: - description: Define a maintenance window for the Kubernetes nodes - properties: - inProgress: - default: false - description: Is there a node maintenance activity in progress? - type: boolean - reusePVC: - default: true - description: |- - Reuse the existing PVC (wait for the node to come - up again) or not (recreate it elsewhere - when `instances` >1) - type: boolean - type: object - plugins: - description: |- - The plugins configuration, containing - any plugin to be loaded with the corresponding configuration - items: - description: |- - PluginConfiguration specifies a plugin that need to be loaded for this - cluster to be reconciled - properties: - enabled: - default: true - description: Enabled is true if this plugin will be used - type: boolean - isWALArchiver: - default: false - description: |- - Marks the plugin as the WAL archiver. At most one plugin can be - designated as a WAL archiver. This cannot be enabled if the - `.spec.backup.barmanObjectStore` configuration is present. - type: boolean - name: - description: Name is the plugin name - type: string - parameters: - additionalProperties: - type: string - description: Parameters is the configuration of the plugin - type: object - required: - - name - type: object - type: array - podSecurityContext: - description: |- - Override the PodSecurityContext applied to every Pod of the cluster. - When set, this overrides the operator's default PodSecurityContext for the cluster. - If omitted, the operator defaults are used. - This field doesn't have any effect if SecurityContextConstraints are present. - properties: - appArmorProfile: - description: |- - appArmorProfile is the AppArmor options to use by the containers in this pod. - Note that this field cannot be set when spec.os.name is windows. - properties: - localhostProfile: - description: |- - localhostProfile indicates a profile loaded on the node that should be used. - The profile must be preconfigured on the node to work. - Must match the loaded name of the profile. - Must be set if and only if type is "Localhost". - type: string - type: - description: |- - type indicates which kind of AppArmor profile will be applied. - Valid options are: - Localhost - a profile pre-loaded on the node. - RuntimeDefault - the container runtime's default profile. - Unconfined - no AppArmor enforcement. - type: string - required: - - type - type: object - fsGroup: - description: |- - A special supplemental group that applies to all containers in a pod. - Some volume types allow the Kubelet to change the ownership of that volume - to be owned by the pod: - - 1. The owning GID will be the FSGroup - 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) - 3. The permission bits are OR'd with rw-rw---- - - If unset, the Kubelet will not modify the ownership and permissions of any volume. - Note that this field cannot be set when spec.os.name is windows. - format: int64 - type: integer - fsGroupChangePolicy: - description: |- - fsGroupChangePolicy defines behavior of changing ownership and permission of the volume - before being exposed inside Pod. This field will only apply to - volume types which support fsGroup based ownership(and permissions). - It will have no effect on ephemeral volume types such as: secret, configmaps - and emptydir. - Valid values are "OnRootMismatch" and "Always". If not specified, "Always" is used. - Note that this field cannot be set when spec.os.name is windows. - type: string - runAsGroup: - description: |- - The GID to run the entrypoint of the container process. - Uses runtime default if unset. - May also be set in SecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence - for that container. - Note that this field cannot be set when spec.os.name is windows. - format: int64 - type: integer - runAsNonRoot: - description: |- - Indicates that the container must run as a non-root user. - If true, the Kubelet will validate the image at runtime to ensure that it - does not run as UID 0 (root) and fail to start the container if it does. - If unset or false, no such validation will be performed. - May also be set in SecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - type: boolean - runAsUser: - description: |- - The UID to run the entrypoint of the container process. - Defaults to user specified in image metadata if unspecified. - May also be set in SecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence - for that container. - Note that this field cannot be set when spec.os.name is windows. - format: int64 - type: integer - seLinuxChangePolicy: - description: |- - seLinuxChangePolicy defines how the container's SELinux label is applied to all volumes used by the Pod. - It has no effect on nodes that do not support SELinux or to volumes does not support SELinux. - Valid values are "MountOption" and "Recursive". - - "Recursive" means relabeling of all files on all Pod volumes by the container runtime. - This may be slow for large volumes, but allows mixing privileged and unprivileged Pods sharing the same volume on the same node. - - "MountOption" mounts all eligible Pod volumes with `-o context` mount option. - This requires all Pods that share the same volume to use the same SELinux label. - It is not possible to share the same volume among privileged and unprivileged Pods. - Eligible volumes are in-tree FibreChannel and iSCSI volumes, and all CSI volumes - whose CSI driver announces SELinux support by setting spec.seLinuxMount: true in their - CSIDriver instance. Other volumes are always re-labelled recursively. - "MountOption" value is allowed only when SELinuxMount feature gate is enabled. - - If not specified and SELinuxMount feature gate is enabled, "MountOption" is used. - If not specified and SELinuxMount feature gate is disabled, "MountOption" is used for ReadWriteOncePod volumes - and "Recursive" for all other volumes. - - This field affects only Pods that have SELinux label set, either in PodSecurityContext or in SecurityContext of all containers. - - All Pods that use the same volume should use the same seLinuxChangePolicy, otherwise some pods can get stuck in ContainerCreating state. - Note that this field cannot be set when spec.os.name is windows. - type: string - seLinuxOptions: - description: |- - The SELinux context to be applied to all containers. - If unspecified, the container runtime will allocate a random SELinux context for each - container. May also be set in SecurityContext. If set in - both SecurityContext and PodSecurityContext, the value specified in SecurityContext - takes precedence for that container. - Note that this field cannot be set when spec.os.name is windows. - properties: - level: - description: Level is SELinux level label that applies to - the container. - type: string - role: - description: Role is a SELinux role label that applies to - the container. - type: string - type: - description: Type is a SELinux type label that applies to - the container. - type: string - user: - description: User is a SELinux user label that applies to - the container. - type: string - type: object - seccompProfile: - description: |- - The seccomp options to use by the containers in this pod. - Note that this field cannot be set when spec.os.name is windows. - properties: - localhostProfile: - description: |- - localhostProfile indicates a profile defined in a file on the node should be used. - The profile must be preconfigured on the node to work. - Must be a descending path, relative to the kubelet's configured seccomp profile location. - Must be set if type is "Localhost". Must NOT be set for any other type. - type: string - type: - description: |- - type indicates which kind of seccomp profile will be applied. - Valid options are: - - Localhost - a profile defined in a file on the node should be used. - RuntimeDefault - the container runtime default profile should be used. - Unconfined - no profile should be applied. - type: string - required: - - type - type: object - supplementalGroups: - description: |- - A list of groups applied to the first process run in each container, in - addition to the container's primary GID and fsGroup (if specified). If - the SupplementalGroupsPolicy feature is enabled, the - supplementalGroupsPolicy field determines whether these are in addition - to or instead of any group memberships defined in the container image. - If unspecified, no additional groups are added, though group memberships - defined in the container image may still be used, depending on the - supplementalGroupsPolicy field. - Note that this field cannot be set when spec.os.name is windows. - items: - format: int64 - type: integer - type: array - x-kubernetes-list-type: atomic - supplementalGroupsPolicy: - description: |- - Defines how supplemental groups of the first container processes are calculated. - Valid values are "Merge" and "Strict". If not specified, "Merge" is used. - (Alpha) Using the field requires the SupplementalGroupsPolicy feature gate to be enabled - and the container runtime must implement support for this feature. - Note that this field cannot be set when spec.os.name is windows. - type: string - sysctls: - description: |- - Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported - sysctls (by the container runtime) might fail to launch. - Note that this field cannot be set when spec.os.name is windows. - items: - description: Sysctl defines a kernel parameter to be set - properties: - name: - description: Name of a property to set - type: string - value: - description: Value of a property to set - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - windowsOptions: - description: |- - The Windows specific settings applied to all containers. - If unspecified, the options within a container's SecurityContext will be used. - If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is linux. - properties: - gmsaCredentialSpec: - description: |- - GMSACredentialSpec is where the GMSA admission webhook - (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the - GMSA credential spec named by the GMSACredentialSpecName field. - type: string - gmsaCredentialSpecName: - description: GMSACredentialSpecName is the name of the GMSA - credential spec to use. - type: string - hostProcess: - description: |- - HostProcess determines if a container should be run as a 'Host Process' container. - All of a Pod's containers must have the same effective HostProcess value - (it is not allowed to have a mix of HostProcess containers and non-HostProcess containers). - In addition, if HostProcess is true then HostNetwork must also be set to true. - type: boolean - runAsUserName: - description: |- - The UserName in Windows to run the entrypoint of the container process. - Defaults to the user specified in image metadata if unspecified. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - type: string - type: object - type: object - podSelectorRefs: - description: |- - PodSelectorRefs defines named pod label selectors that can be referenced - in pg_hba rules using the ${podselector:NAME} syntax in the address field. - The operator resolves matching pod IPs and the instance manager expands - pg_hba lines accordingly. Only pods in the Cluster's own namespace are considered. - items: - description: |- - PodSelectorRef defines a named pod label selector for use in pg_hba rules. - Pods matching the selector in the Cluster's namespace will have their IPs - resolved and made available for pg_hba address expansion via the - `${podselector:NAME}` syntax. - properties: - name: - description: |- - Name is the identifier used to reference this selector in pg_hba rules - via the ${podselector:NAME} syntax in the address field. - minLength: 1 - pattern: ^[a-z]([a-z0-9_-]*[a-z0-9])?$ - type: string - selector: - description: |- - Selector is a label selector that identifies the pods whose IPs - should be resolved. Only pods in the Cluster's namespace are considered. - properties: - matchExpressions: - description: matchExpressions is a list of label selector - requirements. The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the selector - applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - required: - - name - - selector - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - postgresGID: - default: 26 - description: The GID of the `postgres` user inside the image, defaults - to `26` - format: int64 - type: integer - postgresUID: - default: 26 - description: The UID of the `postgres` user inside the image, defaults - to `26` - format: int64 - type: integer - postgresql: - description: Configuration of the PostgreSQL server - properties: - enableAlterSystem: - description: |- - If this parameter is true, the user will be able to invoke `ALTER SYSTEM` - on this CloudNativePG Cluster. - This should only be used for debugging and troubleshooting. - Defaults to false. - type: boolean - extensions: - description: The configuration of the extensions to be added - items: - description: |- - ExtensionConfiguration is the configuration used to add - PostgreSQL extensions to the Cluster. - properties: - bin_path: - description: |- - A list of directories within the image to be appended to the - PostgreSQL process's `PATH` environment variable. - items: - type: string - type: array - dynamic_library_path: - description: |- - The list of directories inside the image which should be added to dynamic_library_path. - If not defined, defaults to "/lib". - items: - type: string - type: array - env: - description: |- - Env is a list of custom environment variables to be set in the - PostgreSQL process for this extension. It is the responsibility of the - cluster administrator to ensure the variables are correct for the - specific extension. Note that changes to these variables require - a manual cluster restart to take effect. - items: - description: |- - ExtensionEnvVar defines an environment variable for a specific extension - image volume. - properties: - name: - description: |- - Name of the environment variable to be injected into the - PostgreSQL process. - minLength: 1 - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ - type: string - value: - description: |- - Value of the environment variable. CloudNativePG performs a direct - replacement of this value, with support for placeholder expansion. - The ${`image_root`} placeholder resolves to the absolute mount path - of the extension's volume (e.g., `/extensions/my-extension`). This - is particularly useful for allowing applications or libraries to - locate specific directories within the mounted image. - Unrecognized placeholders are rejected. To include a literal ${...} - in the value, escape it as $${...}. - minLength: 1 - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - extension_control_path: - description: |- - The list of directories inside the image which should be added to extension_control_path. - If not defined, defaults to "/share". - items: - type: string - type: array - image: - description: The image containing the extension. - properties: - pullPolicy: - description: |- - Policy for pulling OCI objects. Possible values are: - Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. - Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. - type: string - reference: - description: |- - Required: Image or artifact reference to be used. - Behaves in the same way as pod.spec.containers[*].image. - Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. - More info: https://kubernetes.io/docs/concepts/containers/images - This field is optional to allow higher level config management to default or override - container images in workload controllers like Deployments and StatefulSets. - type: string - type: object - ld_library_path: - description: The list of directories inside the image which - should be added to ld_library_path. - items: - type: string - type: array - name: - description: |- - The name of the extension, required. The limit of 59 characters - leaves room for the prefix the operator adds when deriving the - extension's Kubernetes Volume name (capped at 63 characters). - maxLength: 59 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9_]*[a-z0-9])?$ - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - ldap: - description: Options to specify LDAP configuration - properties: - bindAsAuth: - description: Bind as authentication configuration - properties: - prefix: - description: Prefix for the bind authentication option - type: string - suffix: - description: Suffix for the bind authentication option - type: string - type: object - bindSearchAuth: - description: Bind+Search authentication configuration - properties: - baseDN: - description: Root DN to begin the user search - type: string - bindDN: - description: DN of the user to bind to the directory - type: string - bindPassword: - description: Secret with the password for the user to - bind to the directory - properties: - key: - description: The key of the secret to select from. Must - be a valid secret key. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the Secret or its key - must be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - searchAttribute: - description: Attribute to match against the username - type: string - searchFilter: - description: Search filter to use when doing the search+bind - authentication - type: string - type: object - port: - description: LDAP server port - type: integer - scheme: - description: LDAP schema to be used, possible options are - `ldap` and `ldaps` - enum: - - ldap - - ldaps - type: string - server: - description: LDAP hostname or IP address - type: string - tls: - description: Set to 'true' to enable LDAP over TLS. 'false' - is default - type: boolean - type: object - parameters: - additionalProperties: - type: string - description: PostgreSQL configuration options (postgresql.conf) - type: object - pg_hba: - description: |- - PostgreSQL Host Based Authentication rules (lines to be appended - to the pg_hba.conf file). - Use the ${podselector:NAME} syntax to reference a pod selector; - the rule will be expanded for each Pod IP matching that selector. - items: - type: string - type: array - pg_ident: - description: |- - PostgreSQL User Name Maps rules (lines to be appended - to the pg_ident.conf file) - items: - type: string - type: array - promotionTimeout: - description: |- - Specifies the maximum number of seconds to wait when promoting an instance to primary. - Default value is 40000000, greater than one year in seconds, - big enough to simulate an infinite timeout - format: int32 - type: integer - shared_preload_libraries: - description: Lists of shared preload libraries to add to the default - ones - items: - type: string - type: array - syncReplicaElectionConstraint: - description: |- - Requirements to be met by sync replicas. This will affect how the "synchronous_standby_names" parameter will be - set up. - properties: - enabled: - description: This flag enables the constraints for sync replicas - type: boolean - nodeLabelsAntiAffinity: - description: A list of node labels values to extract and compare - to evaluate if the pods reside in the same topology or not - items: - type: string - type: array - required: - - enabled - type: object - synchronous: - description: Configuration of the PostgreSQL synchronous replication - feature - properties: - dataDurability: - description: |- - If set to "required", data durability is strictly enforced. Write operations - with synchronous commit settings (`on`, `remote_write`, or `remote_apply`) will - block if there are insufficient healthy replicas, ensuring data persistence. - If set to "preferred", data durability is maintained when healthy replicas - are available, but the required number of instances will adjust dynamically - if replicas become unavailable. This setting relaxes strict durability enforcement - to allow for operational continuity. This setting is only applicable if both - `standbyNamesPre` and `standbyNamesPost` are unset (empty). - enum: - - required - - preferred - type: string - failoverQuorum: - description: |- - FailoverQuorum enables a quorum-based check before failover, improving - data durability and safety during failover events in CloudNativePG-managed - PostgreSQL clusters. - type: boolean - maxStandbyNamesFromCluster: - description: |- - Specifies the maximum number of local cluster pods that can be - automatically included in the `synchronous_standby_names` option in - PostgreSQL. - type: integer - method: - description: |- - Method to select synchronous replication standbys from the listed - servers, accepting 'any' (quorum-based synchronous replication) or - 'first' (priority-based synchronous replication) as values. - enum: - - any - - first - type: string - number: - description: |- - Specifies the number of synchronous standby servers that - transactions must wait for responses from. - type: integer - x-kubernetes-validations: - - message: The number of synchronous replicas should be greater - than zero - rule: self > 0 - standbyNamesPost: - description: |- - A user-defined list of application names to be added to - `synchronous_standby_names` after local cluster pods (the order is - only useful for priority-based synchronous replication). - items: - type: string - type: array - standbyNamesPre: - description: |- - A user-defined list of application names to be added to - `synchronous_standby_names` before local cluster pods (the order is - only useful for priority-based synchronous replication). - items: - type: string - type: array - required: - - method - - number - type: object - x-kubernetes-validations: - - message: dataDurability set to 'preferred' requires empty 'standbyNamesPre' - and empty 'standbyNamesPost' - rule: self.dataDurability!='preferred' || ((!has(self.standbyNamesPre) - || self.standbyNamesPre.size()==0) && (!has(self.standbyNamesPost) - || self.standbyNamesPost.size()==0)) - type: object - primaryLease: - description: |- - Configuration of the Kubernetes `Lease` used to coordinate safe primary - election within the cluster. When omitted, the operator applies built-in - defaults; tune these values only if you understand the consequences for - failover timing. - properties: - leaseDurationSeconds: - default: 15 - description: |- - How long, in seconds, the primary lease is considered valid before it - expires and another instance may acquire it. It must be greater than - `renewDeadlineSeconds`. - Defaults to 15. - format: int32 - minimum: 1 - type: integer - releasedLeaseDurationSeconds: - default: 1 - description: |- - The TTL, in seconds, written when the primary explicitly releases the - lease on a clean shutdown, allowing a replica to promote without waiting - for the full lease duration to expire. - Defaults to 1. - format: int32 - minimum: 1 - type: integer - renewDeadlineSeconds: - default: 10 - description: |- - How long, in seconds, the current primary keeps retrying to renew the - lease before giving up and stopping. It must be smaller than - `leaseDurationSeconds`. - Defaults to 10. - format: int32 - minimum: 1 - type: integer - retryPeriodSeconds: - default: 2 - description: |- - How frequently, in seconds, a non-holder instance retries acquiring or - renewing the lease. - Defaults to 2. - format: int32 - minimum: 1 - type: integer - type: object - primaryUpdateMethod: - default: restart - description: |- - Method to follow to upgrade the primary server during a rolling - update procedure, after all replicas have been successfully updated: - it can be with a switchover (`switchover`) or in-place (`restart` - default). - Note: when using `switchover`, the operator will reject updates that change both - the image name and PostgreSQL configuration parameters simultaneously to avoid - configuration mismatches during the switchover process. - enum: - - switchover - - restart - type: string - primaryUpdateStrategy: - default: unsupervised - description: |- - Deployment strategy to follow to upgrade the primary server during a rolling - update procedure, after all replicas have been successfully updated: - it can be automated (`unsupervised` - default) or manual (`supervised`) - enum: - - unsupervised - - supervised - type: string - priorityClassName: - description: |- - Name of the priority class which will be used in every generated Pod, if the PriorityClass - specified does not exist, the pod will not be able to schedule. Please refer to - https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass - for more information - type: string - probes: - description: |- - The configuration of the probes to be injected - in the PostgreSQL Pods. - properties: - liveness: - description: The liveness probe configuration - properties: - failureThreshold: - description: |- - Minimum consecutive failures for the probe to be considered failed after having succeeded. - Defaults to 3. Minimum value is 1. - format: int32 - type: integer - initialDelaySeconds: - description: |- - Number of seconds after the container has started before liveness probes are initiated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - isolationCheck: - description: |- - Configure the feature that extends the liveness probe for a primary - instance. In addition to the basic checks, this verifies whether the - primary is isolated from the Kubernetes API server and from its - replicas, ensuring that it can be safely shut down if network - partition or API unavailability is detected. Enabled by default. - properties: - connectionTimeout: - default: 1000 - description: Timeout in milliseconds for connections during - the primary isolation check - type: integer - enabled: - default: true - description: Whether primary isolation checking is enabled - for the liveness probe - type: boolean - requestTimeout: - default: 1000 - description: Timeout in milliseconds for requests during - the primary isolation check - type: integer - type: object - periodSeconds: - description: |- - How often (in seconds) to perform the probe. - Default to 10 seconds. Minimum value is 1. - format: int32 - type: integer - successThreshold: - description: |- - Minimum consecutive successes for the probe to be considered successful after having failed. - Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. - format: int32 - type: integer - terminationGracePeriodSeconds: - description: |- - Optional duration in seconds the pod needs to terminate gracefully upon probe failure. - The grace period is the duration in seconds after the processes running in the pod are sent - a termination signal and the time when the processes are forcibly halted with a kill signal. - Set this value longer than the expected cleanup time for your process. - If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this - value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates stop immediately via - the kill signal (no opportunity to shut down). - This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. - format: int64 - type: integer - timeoutSeconds: - description: |- - Number of seconds after which the probe times out. - Defaults to 1 second. Minimum value is 1. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - type: object - readiness: - description: The readiness probe configuration - properties: - failureThreshold: - description: |- - Minimum consecutive failures for the probe to be considered failed after having succeeded. - Defaults to 3. Minimum value is 1. - format: int32 - type: integer - initialDelaySeconds: - description: |- - Number of seconds after the container has started before liveness probes are initiated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - maximumLag: - anyOf: - - type: integer - - type: string - description: Lag limit. Used only for `streaming` strategy - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - periodSeconds: - description: |- - How often (in seconds) to perform the probe. - Default to 10 seconds. Minimum value is 1. - format: int32 - type: integer - successThreshold: - description: |- - Minimum consecutive successes for the probe to be considered successful after having failed. - Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. - format: int32 - type: integer - terminationGracePeriodSeconds: - description: |- - Optional duration in seconds the pod needs to terminate gracefully upon probe failure. - The grace period is the duration in seconds after the processes running in the pod are sent - a termination signal and the time when the processes are forcibly halted with a kill signal. - Set this value longer than the expected cleanup time for your process. - If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this - value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates stop immediately via - the kill signal (no opportunity to shut down). - This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. - format: int64 - type: integer - timeoutSeconds: - description: |- - Number of seconds after which the probe times out. - Defaults to 1 second. Minimum value is 1. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - type: - description: The probe strategy - enum: - - pg_isready - - streaming - - query - type: string - type: object - startup: - description: The startup probe configuration - properties: - failureThreshold: - description: |- - Minimum consecutive failures for the probe to be considered failed after having succeeded. - Defaults to 3. Minimum value is 1. - format: int32 - type: integer - initialDelaySeconds: - description: |- - Number of seconds after the container has started before liveness probes are initiated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - maximumLag: - anyOf: - - type: integer - - type: string - description: Lag limit. Used only for `streaming` strategy - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - periodSeconds: - description: |- - How often (in seconds) to perform the probe. - Default to 10 seconds. Minimum value is 1. - format: int32 - type: integer - successThreshold: - description: |- - Minimum consecutive successes for the probe to be considered successful after having failed. - Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. - format: int32 - type: integer - terminationGracePeriodSeconds: - description: |- - Optional duration in seconds the pod needs to terminate gracefully upon probe failure. - The grace period is the duration in seconds after the processes running in the pod are sent - a termination signal and the time when the processes are forcibly halted with a kill signal. - Set this value longer than the expected cleanup time for your process. - If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this - value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates stop immediately via - the kill signal (no opportunity to shut down). - This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. - format: int64 - type: integer - timeoutSeconds: - description: |- - Number of seconds after which the probe times out. - Defaults to 1 second. Minimum value is 1. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - type: - description: The probe strategy - enum: - - pg_isready - - streaming - - query - type: string - type: object - type: object - projectedVolumeTemplate: - description: |- - Template to be used to define projected volumes, projected volumes will be mounted - under `/projected` base folder - properties: - defaultMode: - description: |- - defaultMode are the mode bits used to set permissions on created files by default. - Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. - YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. - Directories within the path are not affected by this setting. - This might be in conflict with other options that affect the file - mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - sources: - description: |- - sources is the list of volume projections. Each entry in this list - handles one source. - items: - description: |- - Projection that may be projected along with other supported volume types. - Exactly one of these fields must be set. - properties: - clusterTrustBundle: - description: |- - ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field - of ClusterTrustBundle objects in an auto-updating file. - - Alpha, gated by the ClusterTrustBundleProjection feature gate. - - ClusterTrustBundle objects can either be selected by name, or by the - combination of signer name and a label selector. - - Kubelet performs aggressive normalization of the PEM contents written - into the pod filesystem. Esoteric PEM features such as inter-block - comments and block headers are stripped. Certificates are deduplicated. - The ordering of certificates within the file is arbitrary, and Kubelet - may change the order over time. - properties: - labelSelector: - description: |- - Select all ClusterTrustBundles that match this label selector. Only has - effect if signerName is set. Mutually-exclusive with name. If unset, - interpreted as "match nothing". If set but empty, interpreted as "match - everything". - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the - selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - name: - description: |- - Select a single ClusterTrustBundle by object name. Mutually-exclusive - with signerName and labelSelector. - type: string - optional: - description: |- - If true, don't block pod startup if the referenced ClusterTrustBundle(s) - aren't available. If using name, then the named ClusterTrustBundle is - allowed not to exist. If using signerName, then the combination of - signerName and labelSelector is allowed to match zero - ClusterTrustBundles. - type: boolean - path: - description: Relative path from the volume root to write - the bundle. - type: string - signerName: - description: |- - Select all ClusterTrustBundles that match this signer name. - Mutually-exclusive with name. The contents of all selected - ClusterTrustBundles will be unified and deduplicated. - type: string - required: - - path - type: object - configMap: - description: configMap information about the configMap data - to project - properties: - items: - description: |- - items if unspecified, each key-value pair in the Data field of the referenced - ConfigMap will be projected into the volume as a file whose name is the - key and content is the value. If specified, the listed keys will be - projected into the specified paths, and unlisted keys will not be - present. If a key is specified which is not present in the ConfigMap, - the volume setup will error unless it is marked optional. Paths must be - relative and may not contain the '..' path or start with '..'. - items: - description: Maps a string key to a path within a - volume. - properties: - key: - description: key is the key to project. - type: string - mode: - description: |- - mode is Optional: mode bits used to set permissions on this file. - Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. - YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. - If not specified, the volume defaultMode will be used. - This might be in conflict with other options that affect the file - mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - path: - description: |- - path is the relative path of the file to map the key to. - May not be an absolute path. - May not contain the path element '..'. - May not start with the string '..'. - type: string - required: - - key - - path - type: object - type: array - x-kubernetes-list-type: atomic - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: optional specify whether the ConfigMap - or its keys must be defined - type: boolean - type: object - x-kubernetes-map-type: atomic - downwardAPI: - description: downwardAPI information about the downwardAPI - data to project - properties: - items: - description: Items is a list of DownwardAPIVolume file - items: - description: DownwardAPIVolumeFile represents information - to create the file containing the pod field - properties: - fieldRef: - description: 'Required: Selects a field of the - pod: only annotations, labels, name, namespace - and uid are supported.' - properties: - apiVersion: - description: Version of the schema the FieldPath - is written in terms of, defaults to "v1". - type: string - fieldPath: - description: Path of the field to select in - the specified API version. - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - mode: - description: |- - Optional: mode bits used to set permissions on this file, must be an octal value - between 0000 and 0777 or a decimal value between 0 and 511. - YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. - If not specified, the volume defaultMode will be used. - This might be in conflict with other options that affect the file - mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - path: - description: 'Required: Path is the relative - path name of the file to be created. Must not - be absolute or contain the ''..'' path. Must - be utf-8 encoded. The first item of the relative - path must not start with ''..''' - type: string - resourceFieldRef: - description: |- - Selects a resource of the container: only resources limits and requests - (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. - properties: - containerName: - description: 'Container name: required for - volumes, optional for env vars' - type: string - divisor: - anyOf: - - type: integer - - type: string - description: Specifies the output format of - the exposed resources, defaults to "1" - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - description: 'Required: resource to select' - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - required: - - path - type: object - type: array - x-kubernetes-list-type: atomic - type: object - podCertificate: - description: |- - Projects an auto-rotating credential bundle (private key and certificate - chain) that the pod can use either as a TLS client or server. - - Kubelet generates a private key and uses it to send a - PodCertificateRequest to the named signer. Once the signer approves the - request and issues a certificate chain, Kubelet writes the key and - certificate chain to the pod filesystem. The pod does not start until - certificates have been issued for each podCertificate projected volume - source in its spec. - - Kubelet will begin trying to rotate the certificate at the time indicated - by the signer using the PodCertificateRequest.Status.BeginRefreshAt - timestamp. - - Kubelet can write a single file, indicated by the credentialBundlePath - field, or separate files, indicated by the keyPath and - certificateChainPath fields. - - The credential bundle is a single file in PEM format. The first PEM - entry is the private key (in PKCS#8 format), and the remaining PEM - entries are the certificate chain issued by the signer (typically, - signers will return their certificate chain in leaf-to-root order). - - Prefer using the credential bundle format, since your application code - can read it atomically. If you use keyPath and certificateChainPath, - your application must make two separate file reads. If these coincide - with a certificate rotation, it is possible that the private key and leaf - certificate you read may not correspond to each other. Your application - will need to check for this condition, and re-read until they are - consistent. - - The named signer controls chooses the format of the certificate it - issues; consult the signer implementation's documentation to learn how to - use the certificates it issues. - properties: - certificateChainPath: - description: |- - Write the certificate chain at this path in the projected volume. - - Most applications should use credentialBundlePath. When using keyPath - and certificateChainPath, your application needs to check that the key - and leaf certificate are consistent, because it is possible to read the - files mid-rotation. - type: string - credentialBundlePath: - description: |- - Write the credential bundle at this path in the projected volume. - - The credential bundle is a single file that contains multiple PEM blocks. - The first PEM block is a PRIVATE KEY block, containing a PKCS#8 private - key. - - The remaining blocks are CERTIFICATE blocks, containing the issued - certificate chain from the signer (leaf and any intermediates). - - Using credentialBundlePath lets your Pod's application code make a single - atomic read that retrieves a consistent key and certificate chain. If you - project them to separate files, your application code will need to - additionally check that the leaf certificate was issued to the key. - type: string - keyPath: - description: |- - Write the key at this path in the projected volume. - - Most applications should use credentialBundlePath. When using keyPath - and certificateChainPath, your application needs to check that the key - and leaf certificate are consistent, because it is possible to read the - files mid-rotation. - type: string - keyType: - description: |- - The type of keypair Kubelet will generate for the pod. - - Valid values are "RSA3072", "RSA4096", "ECDSAP256", "ECDSAP384", - "ECDSAP521", and "ED25519". - type: string - maxExpirationSeconds: - description: |- - maxExpirationSeconds is the maximum lifetime permitted for the - certificate. - - Kubelet copies this value verbatim into the PodCertificateRequests it - generates for this projection. - - If omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver - will reject values shorter than 3600 (1 hour). The maximum allowable - value is 7862400 (91 days). - - The signer implementation is then free to issue a certificate with any - lifetime *shorter* than MaxExpirationSeconds, but no shorter than 3600 - seconds (1 hour). This constraint is enforced by kube-apiserver. - `kubernetes.io` signers will never issue certificates with a lifetime - longer than 24 hours. - format: int32 - type: integer - signerName: - description: Kubelet's generated CSRs will be addressed - to this signer. - type: string - userAnnotations: - additionalProperties: - type: string - description: |- - userAnnotations allow pod authors to pass additional information to - the signer implementation. Kubernetes does not restrict or validate this - metadata in any way. - - These values are copied verbatim into the `spec.unverifiedUserAnnotations` field of - the PodCertificateRequest objects that Kubelet creates. - - Entries are subject to the same validation as object metadata annotations, - with the addition that all keys must be domain-prefixed. No restrictions - are placed on values, except an overall size limitation on the entire field. - - Signers should document the keys and values they support. Signers should - deny requests that contain keys they do not recognize. - type: object - required: - - keyType - - signerName - type: object - secret: - description: secret information about the secret data to - project - properties: - items: - description: |- - items if unspecified, each key-value pair in the Data field of the referenced - Secret will be projected into the volume as a file whose name is the - key and content is the value. If specified, the listed keys will be - projected into the specified paths, and unlisted keys will not be - present. If a key is specified which is not present in the Secret, - the volume setup will error unless it is marked optional. Paths must be - relative and may not contain the '..' path or start with '..'. - items: - description: Maps a string key to a path within a - volume. - properties: - key: - description: key is the key to project. - type: string - mode: - description: |- - mode is Optional: mode bits used to set permissions on this file. - Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. - YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. - If not specified, the volume defaultMode will be used. - This might be in conflict with other options that affect the file - mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - path: - description: |- - path is the relative path of the file to map the key to. - May not be an absolute path. - May not contain the path element '..'. - May not start with the string '..'. - type: string - required: - - key - - path - type: object - type: array - x-kubernetes-list-type: atomic - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: optional field specify whether the Secret - or its key must be defined - type: boolean - type: object - x-kubernetes-map-type: atomic - serviceAccountToken: - description: serviceAccountToken is information about the - serviceAccountToken data to project - properties: - audience: - description: |- - audience is the intended audience of the token. A recipient of a token - must identify itself with an identifier specified in the audience of the - token, and otherwise should reject the token. The audience defaults to the - identifier of the apiserver. - type: string - expirationSeconds: - description: |- - expirationSeconds is the requested duration of validity of the service - account token. As the token approaches expiration, the kubelet volume - plugin will proactively rotate the service account token. The kubelet will - start trying to rotate the token if the token is older than 80 percent of - its time to live or if the token is older than 24 hours.Defaults to 1 hour - and must be at least 10 minutes. - format: int64 - type: integer - path: - description: |- - path is the path relative to the mount point of the file to project the - token into. - type: string - required: - - path - type: object - type: object - type: array - x-kubernetes-list-type: atomic - type: object - replica: - description: Replica cluster configuration - properties: - enabled: - description: |- - If replica mode is enabled, this cluster will be a replica of an - existing cluster. Replica cluster can be created from a recovery - object store or via streaming through pg_basebackup. - Refer to the Replica clusters page of the documentation for more information. - type: boolean - minApplyDelay: - description: |- - When replica mode is enabled, this parameter allows you to replay - transactions only when the system time is at least the configured - time past the commit time. This provides an opportunity to correct - data loss errors. Note that when this parameter is set, a promotion - token cannot be used. - type: string - primary: - description: |- - Primary defines which Cluster is defined to be the primary in the distributed PostgreSQL cluster, based on the - topology specified in externalClusters - type: string - promotionToken: - description: |- - A demotion token generated by an external cluster used to - check if the promotion requirements are met. - type: string - self: - description: |- - Self defines the name of this cluster. It is used to determine if this is a primary - or a replica cluster, comparing it with `primary` - type: string - source: - description: The name of the external cluster which is the replication - origin - minLength: 1 - type: string - required: - - source - type: object - replicationSlots: - default: - highAvailability: - enabled: true - description: Replication slots management configuration - properties: - highAvailability: - default: - enabled: true - description: Replication slots for high availability configuration - properties: - enabled: - default: true - description: |- - If enabled (default), the operator will automatically manage replication slots - on the primary instance and use them in streaming replication - connections with all the standby instances that are part of the HA - cluster. If disabled, the operator will not take advantage - of replication slots in streaming connections with the replicas. - This feature also controls replication slots in replica cluster, - from the designated primary to its cascading replicas. - type: boolean - slotPrefix: - default: _cnpg_ - description: |- - Prefix for replication slots managed by the operator for HA. - It may only contain lower case letters, numbers, and the underscore character. - This can only be set at creation time. By default set to `_cnpg_`. - pattern: ^[0-9a-z_]*$ - type: string - synchronizeLogicalDecoding: - description: |- - When enabled, the operator automatically manages synchronization of logical - decoding (replication) slots across high-availability clusters. - - Requires one of the following conditions: - - PostgreSQL version 17 or later - - PostgreSQL version < 17 with pg_failover_slots extension enabled - type: boolean - type: object - synchronizeReplicas: - description: Configures the synchronization of the user defined - physical replication slots - properties: - enabled: - default: true - description: When set to true, every replication slot that - is on the primary is synchronized on each standby - type: boolean - excludePatterns: - description: List of regular expression patterns to match - the names of replication slots to be excluded (by default - empty) - items: - type: string - type: array - required: - - enabled - type: object - updateInterval: - default: 30 - description: |- - Standby will update the status of the local replication slots - every `updateInterval` seconds (default 30). - minimum: 1 - type: integer - type: object - resources: - description: |- - Resources requirements of every generated Pod. Please refer to - https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - for more information. - properties: - claims: - description: |- - Claims lists the names of resources, defined in spec.resourceClaims, - that are used by this container. - - This field depends on the - DynamicResourceAllocation feature gate. - - This field is immutable. It can only be set for containers. - items: - description: ResourceClaim references one entry in PodSpec.ResourceClaims. - properties: - name: - description: |- - Name must match the name of one entry in pod.spec.resourceClaims of - the Pod where this field is used. It makes that resource available - inside a container. - type: string - request: - description: |- - Request is the name chosen for a request in the referenced claim. - If empty, everything from the claim is made available, otherwise - only the result of this request. - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Limits describes the maximum amount of compute resources allowed. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Requests describes the minimum amount of compute resources required. - If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. Requests cannot exceed Limits. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - type: object - schedulerName: - description: |- - If specified, the pod will be dispatched by specified Kubernetes - scheduler. If not specified, the pod will be dispatched by the default - scheduler. More info: - https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/ - type: string - seccompProfile: - description: |- - The SeccompProfile applied to every Pod and Container. - Defaults to: `RuntimeDefault` - properties: - localhostProfile: - description: |- - localhostProfile indicates a profile defined in a file on the node should be used. - The profile must be preconfigured on the node to work. - Must be a descending path, relative to the kubelet's configured seccomp profile location. - Must be set if type is "Localhost". Must NOT be set for any other type. - type: string - type: - description: |- - type indicates which kind of seccomp profile will be applied. - Valid options are: - - Localhost - a profile defined in a file on the node should be used. - RuntimeDefault - the container runtime default profile should be used. - Unconfined - no profile should be applied. - type: string - required: - - type - type: object - securityContext: - description: |- - Override the SecurityContext applied to every Container in the Pod of the cluster. - When set, this overrides the operator's default Container SecurityContext. - If omitted, the operator defaults are used. - properties: - allowPrivilegeEscalation: - description: |- - AllowPrivilegeEscalation controls whether a process can gain more - privileges than its parent process. This bool directly controls if - the no_new_privs flag will be set on the container process. - AllowPrivilegeEscalation is true always when the container is: - 1) run as Privileged - 2) has CAP_SYS_ADMIN - Note that this field cannot be set when spec.os.name is windows. - type: boolean - appArmorProfile: - description: |- - appArmorProfile is the AppArmor options to use by this container. If set, this profile - overrides the pod's appArmorProfile. - Note that this field cannot be set when spec.os.name is windows. - properties: - localhostProfile: - description: |- - localhostProfile indicates a profile loaded on the node that should be used. - The profile must be preconfigured on the node to work. - Must match the loaded name of the profile. - Must be set if and only if type is "Localhost". - type: string - type: - description: |- - type indicates which kind of AppArmor profile will be applied. - Valid options are: - Localhost - a profile pre-loaded on the node. - RuntimeDefault - the container runtime's default profile. - Unconfined - no AppArmor enforcement. - type: string - required: - - type - type: object - capabilities: - description: |- - The capabilities to add/drop when running containers. - Defaults to the default set of capabilities granted by the container runtime. - Note that this field cannot be set when spec.os.name is windows. - properties: - add: - description: Added capabilities - items: - description: Capability represent POSIX capabilities type - type: string - type: array - x-kubernetes-list-type: atomic - drop: - description: Removed capabilities - items: - description: Capability represent POSIX capabilities type - type: string - type: array - x-kubernetes-list-type: atomic - type: object - privileged: - description: |- - Run container in privileged mode. - Processes in privileged containers are essentially equivalent to root on the host. - Defaults to false. - Note that this field cannot be set when spec.os.name is windows. - type: boolean - procMount: - description: |- - procMount denotes the type of proc mount to use for the containers. - The default value is Default which uses the container runtime defaults for - readonly paths and masked paths. - Note that this field cannot be set when spec.os.name is windows. - type: string - readOnlyRootFilesystem: - description: |- - Whether this container has a read-only root filesystem. - Default is false. - Note that this field cannot be set when spec.os.name is windows. - type: boolean - runAsGroup: - description: |- - The GID to run the entrypoint of the container process. - Uses runtime default if unset. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is windows. - format: int64 - type: integer - runAsNonRoot: - description: |- - Indicates that the container must run as a non-root user. - If true, the Kubelet will validate the image at runtime to ensure that it - does not run as UID 0 (root) and fail to start the container if it does. - If unset or false, no such validation will be performed. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - type: boolean - runAsUser: - description: |- - The UID to run the entrypoint of the container process. - Defaults to user specified in image metadata if unspecified. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is windows. - format: int64 - type: integer - seLinuxOptions: - description: |- - The SELinux context to be applied to the container. - If unspecified, the container runtime will allocate a random SELinux context for each - container. May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is windows. - properties: - level: - description: Level is SELinux level label that applies to - the container. - type: string - role: - description: Role is a SELinux role label that applies to - the container. - type: string - type: - description: Type is a SELinux type label that applies to - the container. - type: string - user: - description: User is a SELinux user label that applies to - the container. - type: string - type: object - seccompProfile: - description: |- - The seccomp options to use by this container. If seccomp options are - provided at both the pod & container level, the container options - override the pod options. - Note that this field cannot be set when spec.os.name is windows. - properties: - localhostProfile: - description: |- - localhostProfile indicates a profile defined in a file on the node should be used. - The profile must be preconfigured on the node to work. - Must be a descending path, relative to the kubelet's configured seccomp profile location. - Must be set if type is "Localhost". Must NOT be set for any other type. - type: string - type: - description: |- - type indicates which kind of seccomp profile will be applied. - Valid options are: - - Localhost - a profile defined in a file on the node should be used. - RuntimeDefault - the container runtime default profile should be used. - Unconfined - no profile should be applied. - type: string - required: - - type - type: object - windowsOptions: - description: |- - The Windows specific settings applied to all containers. - If unspecified, the options from the PodSecurityContext will be used. - If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is linux. - properties: - gmsaCredentialSpec: - description: |- - GMSACredentialSpec is where the GMSA admission webhook - (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the - GMSA credential spec named by the GMSACredentialSpecName field. - type: string - gmsaCredentialSpecName: - description: GMSACredentialSpecName is the name of the GMSA - credential spec to use. - type: string - hostProcess: - description: |- - HostProcess determines if a container should be run as a 'Host Process' container. - All of a Pod's containers must have the same effective HostProcess value - (it is not allowed to have a mix of HostProcess containers and non-HostProcess containers). - In addition, if HostProcess is true then HostNetwork must also be set to true. - type: boolean - runAsUserName: - description: |- - The UserName in Windows to run the entrypoint of the container process. - Defaults to the user specified in image metadata if unspecified. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - type: string - type: object - type: object - serviceAccountName: - description: |- - Name of an existing ServiceAccount in the same namespace to use for the cluster. - When specified, the operator will not create a new ServiceAccount - but will use the provided one. This is useful for sharing a single - ServiceAccount across multiple clusters (e.g., for cloud IAM configurations). - If not specified, a ServiceAccount will be created with the cluster name. - Mutually exclusive with ServiceAccountTemplate. - maxLength: 253 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - x-kubernetes-validations: - - message: serviceAccountName is immutable - rule: self == oldSelf - serviceAccountTemplate: - description: Configure the generation of the service account - properties: - metadata: - description: |- - Metadata are the metadata to be used for the generated - service account - properties: - annotations: - additionalProperties: - type: string - description: |- - Annotations is an unstructured key value map stored with a resource that may be - set by external tools to store and retrieve arbitrary metadata. They are not - queryable and should be preserved when modifying objects. - More info: http://kubernetes.io/docs/user-guide/annotations - type: object - labels: - additionalProperties: - type: string - description: |- - Map of string keys and values that can be used to organize and categorize - (scope and select) objects. May match selectors of replication controllers - and services. - More info: http://kubernetes.io/docs/user-guide/labels - type: object - name: - description: The name of the resource. Only supported for - certain types - type: string - type: object - required: - - metadata - type: object - smartShutdownTimeout: - default: 180 - description: |- - The time in seconds that controls the window of time reserved for the smart shutdown of Postgres to complete. - Make sure you reserve enough time for the operator to request a fast shutdown of Postgres - (that is: `stopDelay` - `smartShutdownTimeout`). Default is 180 seconds. - format: int32 - type: integer - startDelay: - default: 3600 - description: |- - The time in seconds that is allowed for a PostgreSQL instance to - successfully start up (default 3600). - The startup probe failure threshold is derived from this value using the formula: - ceiling(startDelay / 10). - format: int32 - type: integer - stopDelay: - default: 1800 - description: |- - The time in seconds that is allowed for a PostgreSQL instance to - gracefully shutdown (default 1800) - format: int32 - type: integer - storage: - description: Configuration of the storage of the instances - properties: - pvcTemplate: - description: Template to be used to generate the Persistent Volume - Claim - properties: - accessModes: - description: |- - accessModes contains the desired access modes the volume should have. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 - items: - type: string - type: array - x-kubernetes-list-type: atomic - dataSource: - description: |- - dataSource field can be used to specify either: - * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) - * An existing PVC (PersistentVolumeClaim) - If the provisioner or an external controller can support the specified data source, - it will create a new volume based on the contents of the specified data source. - When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, - and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. - If the namespace is specified, then dataSourceRef will not be copied to dataSource. - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - kind: - description: Kind is the type of resource being referenced - type: string - name: - description: Name is the name of resource being referenced - type: string - required: - - kind - - name - type: object - x-kubernetes-map-type: atomic - dataSourceRef: - description: |- - dataSourceRef specifies the object from which to populate the volume with data, if a non-empty - volume is desired. This may be any object from a non-empty API group (non - core object) or a PersistentVolumeClaim object. - When this field is specified, volume binding will only succeed if the type of - the specified object matches some installed volume populator or dynamic - provisioner. - This field will replace the functionality of the dataSource field and as such - if both fields are non-empty, they must have the same value. For backwards - compatibility, when namespace isn't specified in dataSourceRef, - both fields (dataSource and dataSourceRef) will be set to the same - value automatically if one of them is empty and the other is non-empty. - When namespace is specified in dataSourceRef, - dataSource isn't set to the same value and must be empty. - There are three important differences between dataSource and dataSourceRef: - * While dataSource only allows two specific types of objects, dataSourceRef - allows any non-core object, as well as PersistentVolumeClaim objects. - * While dataSource ignores disallowed values (dropping them), dataSourceRef - preserves all values, and generates an error if a disallowed value is - specified. - * While dataSource only allows local objects, dataSourceRef allows objects - in any namespaces. - (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. - (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - kind: - description: Kind is the type of resource being referenced - type: string - name: - description: Name is the name of resource being referenced - type: string - namespace: - description: |- - Namespace is the namespace of resource being referenced - Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. - (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. - type: string - required: - - kind - - name - type: object - resources: - description: |- - resources represents the minimum resources the volume should have. - Users are allowed to specify resource requirements - that are lower than previous value but must still be higher than capacity recorded in the - status field of the claim. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Limits describes the maximum amount of compute resources allowed. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Requests describes the minimum amount of compute resources required. - If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. Requests cannot exceed Limits. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - type: object - selector: - description: selector is a label query over volumes to consider - for binding. - properties: - matchExpressions: - description: matchExpressions is a list of label selector - requirements. The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the selector - applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - storageClassName: - description: |- - storageClassName is the name of the StorageClass required by the claim. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 - type: string - volumeAttributesClassName: - description: |- - volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. - If specified, the CSI driver will create or update the volume with the attributes defined - in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, - it can be changed after the claim is created. An empty string or nil value indicates that no - VolumeAttributesClass will be applied to the claim. If the claim enters an Infeasible error state, - this field can be reset to its previous value (including nil) to cancel the modification. - If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be - set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource - exists. - More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ - type: string - volumeMode: - description: |- - volumeMode defines what type of volume is required by the claim. - Value of Filesystem is implied when not included in claim spec. - type: string - volumeName: - description: volumeName is the binding reference to the PersistentVolume - backing this claim. - type: string - type: object - resizeInUseVolumes: - default: true - description: Resize existent PVCs, defaults to true - type: boolean - size: - description: |- - Size of the storage. Required if not already specified in the PVC template. - Changes to this field are automatically reapplied to the created PVCs. - Size cannot be decreased. - type: string - storageClass: - description: |- - StorageClass to use for PVCs. Applied after - evaluating the PVC template, if available. - If not specified, the generated PVCs will use the - default storage class - type: string - type: object - superuserSecret: - description: |- - The secret containing the superuser password. If not defined a new - secret will be created with a randomly generated password - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - switchoverDelay: - default: 3600 - description: |- - The time in seconds that is allowed for a primary PostgreSQL instance - to gracefully shutdown during a switchover. - Default value is 3600 seconds (1 hour). - format: int32 - type: integer - tablespaces: - description: The tablespaces configuration - items: - description: |- - TablespaceConfiguration is the configuration of a tablespace, and includes - the storage specification for the tablespace - properties: - name: - description: The name of the tablespace - type: string - owner: - description: Owner is the PostgreSQL user owning the tablespace - properties: - name: - type: string - type: object - storage: - description: The storage configuration for the tablespace - properties: - pvcTemplate: - description: Template to be used to generate the Persistent - Volume Claim - properties: - accessModes: - description: |- - accessModes contains the desired access modes the volume should have. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 - items: - type: string - type: array - x-kubernetes-list-type: atomic - dataSource: - description: |- - dataSource field can be used to specify either: - * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) - * An existing PVC (PersistentVolumeClaim) - If the provisioner or an external controller can support the specified data source, - it will create a new volume based on the contents of the specified data source. - When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, - and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. - If the namespace is specified, then dataSourceRef will not be copied to dataSource. - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - kind: - description: Kind is the type of resource being - referenced - type: string - name: - description: Name is the name of resource being - referenced - type: string - required: - - kind - - name - type: object - x-kubernetes-map-type: atomic - dataSourceRef: - description: |- - dataSourceRef specifies the object from which to populate the volume with data, if a non-empty - volume is desired. This may be any object from a non-empty API group (non - core object) or a PersistentVolumeClaim object. - When this field is specified, volume binding will only succeed if the type of - the specified object matches some installed volume populator or dynamic - provisioner. - This field will replace the functionality of the dataSource field and as such - if both fields are non-empty, they must have the same value. For backwards - compatibility, when namespace isn't specified in dataSourceRef, - both fields (dataSource and dataSourceRef) will be set to the same - value automatically if one of them is empty and the other is non-empty. - When namespace is specified in dataSourceRef, - dataSource isn't set to the same value and must be empty. - There are three important differences between dataSource and dataSourceRef: - * While dataSource only allows two specific types of objects, dataSourceRef - allows any non-core object, as well as PersistentVolumeClaim objects. - * While dataSource ignores disallowed values (dropping them), dataSourceRef - preserves all values, and generates an error if a disallowed value is - specified. - * While dataSource only allows local objects, dataSourceRef allows objects - in any namespaces. - (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. - (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - kind: - description: Kind is the type of resource being - referenced - type: string - name: - description: Name is the name of resource being - referenced - type: string - namespace: - description: |- - Namespace is the namespace of resource being referenced - Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. - (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. - type: string - required: - - kind - - name - type: object - resources: - description: |- - resources represents the minimum resources the volume should have. - Users are allowed to specify resource requirements - that are lower than previous value but must still be higher than capacity recorded in the - status field of the claim. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Limits describes the maximum amount of compute resources allowed. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Requests describes the minimum amount of compute resources required. - If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. Requests cannot exceed Limits. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - type: object - selector: - description: selector is a label query over volumes - to consider for binding. - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the - selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - storageClassName: - description: |- - storageClassName is the name of the StorageClass required by the claim. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 - type: string - volumeAttributesClassName: - description: |- - volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. - If specified, the CSI driver will create or update the volume with the attributes defined - in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, - it can be changed after the claim is created. An empty string or nil value indicates that no - VolumeAttributesClass will be applied to the claim. If the claim enters an Infeasible error state, - this field can be reset to its previous value (including nil) to cancel the modification. - If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be - set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource - exists. - More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ - type: string - volumeMode: - description: |- - volumeMode defines what type of volume is required by the claim. - Value of Filesystem is implied when not included in claim spec. - type: string - volumeName: - description: volumeName is the binding reference to - the PersistentVolume backing this claim. - type: string - type: object - resizeInUseVolumes: - default: true - description: Resize existent PVCs, defaults to true - type: boolean - size: - description: |- - Size of the storage. Required if not already specified in the PVC template. - Changes to this field are automatically reapplied to the created PVCs. - Size cannot be decreased. - type: string - storageClass: - description: |- - StorageClass to use for PVCs. Applied after - evaluating the PVC template, if available. - If not specified, the generated PVCs will use the - default storage class - type: string - type: object - temporary: - default: false - description: |- - When set to true, the tablespace will be added as a `temp_tablespaces` - entry in PostgreSQL, and will be available to automatically house temp - database objects, or other temporary files. Please refer to PostgreSQL - documentation for more information on the `temp_tablespaces` GUC. - type: boolean - required: - - name - - storage - type: object - type: array - topologySpreadConstraints: - description: |- - TopologySpreadConstraints specifies how to spread matching pods among the given topology. - More info: - https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/ - items: - description: TopologySpreadConstraint specifies how to spread matching - pods among the given topology. - properties: - labelSelector: - description: |- - LabelSelector is used to find matching pods. - Pods that match this label selector are counted to determine the number of pods - in their corresponding topology domain. - properties: - matchExpressions: - description: matchExpressions is a list of label selector - requirements. The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the selector - applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - matchLabelKeys: - description: |- - MatchLabelKeys is a set of pod label keys to select the pods over which - spreading will be calculated. The keys are used to lookup values from the - incoming pod labels, those key-value labels are ANDed with labelSelector - to select the group of existing pods over which spreading will be calculated - for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. - MatchLabelKeys cannot be set when LabelSelector isn't set. - Keys that don't exist in the incoming pod labels will - be ignored. A null or empty list means only match against labelSelector. - - This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default). - items: - type: string - type: array - x-kubernetes-list-type: atomic - maxSkew: - description: |- - MaxSkew describes the degree to which pods may be unevenly distributed. - When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference - between the number of matching pods in the target topology and the global minimum. - The global minimum is the minimum number of matching pods in an eligible domain - or zero if the number of eligible domains is less than MinDomains. - For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same - labelSelector spread as 2/2/1: - In this case, the global minimum is 1. - | zone1 | zone2 | zone3 | - | P P | P P | P | - - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; - scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) - violate MaxSkew(1). - - if MaxSkew is 2, incoming pod can be scheduled onto any zone. - When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence - to topologies that satisfy it. - It's a required field. Default value is 1 and 0 is not allowed. - format: int32 - type: integer - minDomains: - description: |- - MinDomains indicates a minimum number of eligible domains. - When the number of eligible domains with matching topology keys is less than minDomains, - Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed. - And when the number of eligible domains with matching topology keys equals or greater than minDomains, - this value has no effect on scheduling. - As a result, when the number of eligible domains is less than minDomains, - scheduler won't schedule more than maxSkew Pods to those domains. - If value is nil, the constraint behaves as if MinDomains is equal to 1. - Valid values are integers greater than 0. - When value is not nil, WhenUnsatisfiable must be DoNotSchedule. - - For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same - labelSelector spread as 2/2/2: - | zone1 | zone2 | zone3 | - | P P | P P | P P | - The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0. - In this situation, new pod with the same labelSelector cannot be scheduled, - because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, - it will violate MaxSkew. - format: int32 - type: integer - nodeAffinityPolicy: - description: |- - NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector - when calculating pod topology spread skew. Options are: - - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. - - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. - - If this value is nil, the behavior is equivalent to the Honor policy. - type: string - nodeTaintsPolicy: - description: |- - NodeTaintsPolicy indicates how we will treat node taints when calculating - pod topology spread skew. Options are: - - Honor: nodes without taints, along with tainted nodes for which the incoming pod - has a toleration, are included. - - Ignore: node taints are ignored. All nodes are included. - - If this value is nil, the behavior is equivalent to the Ignore policy. - type: string - topologyKey: - description: |- - TopologyKey is the key of node labels. Nodes that have a label with this key - and identical values are considered to be in the same topology. - We consider each as a "bucket", and try to put balanced number - of pods into each bucket. - We define a domain as a particular instance of a topology. - Also, we define an eligible domain as a domain whose nodes meet the requirements of - nodeAffinityPolicy and nodeTaintsPolicy. - e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology. - And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology. - It's a required field. - type: string - whenUnsatisfiable: - description: |- - WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy - the spread constraint. - - DoNotSchedule (default) tells the scheduler not to schedule it. - - ScheduleAnyway tells the scheduler to schedule the pod in any location, - but giving higher precedence to topologies that would help reduce the - skew. - A constraint is considered "Unsatisfiable" for an incoming pod - if and only if every possible node assignment for that pod would violate - "MaxSkew" on some topology. - For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same - labelSelector spread as 3/1/1: - | zone1 | zone2 | zone3 | - | P P P | P | P | - If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled - to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies - MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler - won't make it *more* imbalanced. - It's a required field. - type: string - required: - - maxSkew - - topologyKey - - whenUnsatisfiable - type: object - type: array - walStorage: - description: Configuration of the storage for PostgreSQL WAL (Write-Ahead - Log) - properties: - pvcTemplate: - description: Template to be used to generate the Persistent Volume - Claim - properties: - accessModes: - description: |- - accessModes contains the desired access modes the volume should have. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 - items: - type: string - type: array - x-kubernetes-list-type: atomic - dataSource: - description: |- - dataSource field can be used to specify either: - * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) - * An existing PVC (PersistentVolumeClaim) - If the provisioner or an external controller can support the specified data source, - it will create a new volume based on the contents of the specified data source. - When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, - and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. - If the namespace is specified, then dataSourceRef will not be copied to dataSource. - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - kind: - description: Kind is the type of resource being referenced - type: string - name: - description: Name is the name of resource being referenced - type: string - required: - - kind - - name - type: object - x-kubernetes-map-type: atomic - dataSourceRef: - description: |- - dataSourceRef specifies the object from which to populate the volume with data, if a non-empty - volume is desired. This may be any object from a non-empty API group (non - core object) or a PersistentVolumeClaim object. - When this field is specified, volume binding will only succeed if the type of - the specified object matches some installed volume populator or dynamic - provisioner. - This field will replace the functionality of the dataSource field and as such - if both fields are non-empty, they must have the same value. For backwards - compatibility, when namespace isn't specified in dataSourceRef, - both fields (dataSource and dataSourceRef) will be set to the same - value automatically if one of them is empty and the other is non-empty. - When namespace is specified in dataSourceRef, - dataSource isn't set to the same value and must be empty. - There are three important differences between dataSource and dataSourceRef: - * While dataSource only allows two specific types of objects, dataSourceRef - allows any non-core object, as well as PersistentVolumeClaim objects. - * While dataSource ignores disallowed values (dropping them), dataSourceRef - preserves all values, and generates an error if a disallowed value is - specified. - * While dataSource only allows local objects, dataSourceRef allows objects - in any namespaces. - (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. - (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - kind: - description: Kind is the type of resource being referenced - type: string - name: - description: Name is the name of resource being referenced - type: string - namespace: - description: |- - Namespace is the namespace of resource being referenced - Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. - (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. - type: string - required: - - kind - - name - type: object - resources: - description: |- - resources represents the minimum resources the volume should have. - Users are allowed to specify resource requirements - that are lower than previous value but must still be higher than capacity recorded in the - status field of the claim. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Limits describes the maximum amount of compute resources allowed. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Requests describes the minimum amount of compute resources required. - If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. Requests cannot exceed Limits. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - type: object - selector: - description: selector is a label query over volumes to consider - for binding. - properties: - matchExpressions: - description: matchExpressions is a list of label selector - requirements. The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the selector - applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - storageClassName: - description: |- - storageClassName is the name of the StorageClass required by the claim. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 - type: string - volumeAttributesClassName: - description: |- - volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. - If specified, the CSI driver will create or update the volume with the attributes defined - in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, - it can be changed after the claim is created. An empty string or nil value indicates that no - VolumeAttributesClass will be applied to the claim. If the claim enters an Infeasible error state, - this field can be reset to its previous value (including nil) to cancel the modification. - If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be - set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource - exists. - More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ - type: string - volumeMode: - description: |- - volumeMode defines what type of volume is required by the claim. - Value of Filesystem is implied when not included in claim spec. - type: string - volumeName: - description: volumeName is the binding reference to the PersistentVolume - backing this claim. - type: string - type: object - resizeInUseVolumes: - default: true - description: Resize existent PVCs, defaults to true - type: boolean - size: - description: |- - Size of the storage. Required if not already specified in the PVC template. - Changes to this field are automatically reapplied to the created PVCs. - Size cannot be decreased. - type: string - storageClass: - description: |- - StorageClass to use for PVCs. Applied after - evaluating the PVC template, if available. - If not specified, the generated PVCs will use the - default storage class - type: string - type: object - required: - - instances - type: object - x-kubernetes-validations: - - message: imageName and imageCatalogRef are mutually exclusive - rule: '!(has(self.imageCatalogRef) && has(self.imageName))' - status: - description: |- - Most recently observed status of the cluster. This data may not be up - to date. Populated by the system. Read-only. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - availableArchitectures: - description: AvailableArchitectures reports the available architectures - of a cluster - items: - description: AvailableArchitecture represents the state of a cluster's - architecture - properties: - goArch: - description: GoArch is the name of the executable architecture - type: string - hash: - description: Hash is the hash of the executable - type: string - required: - - goArch - - hash - type: object - type: array - certificates: - description: The configuration for the CA and related certificates, - initialized with defaults. - properties: - clientCASecret: - description: |- - The secret containing the Client CA certificate. If not defined, a new secret will be created - with a self-signed CA and will be used to generate all the client certificates.
-
- Contains:
-
- - `ca.crt`: CA that should be used to validate the client certificates, - used as `ssl_ca_file` of all the instances.
- - `ca.key`: key used to generate client certificates, if ReplicationTLSSecret is provided, - this can be omitted.
- type: string - expirations: - additionalProperties: - type: string - description: Expiration dates for all certificates. - type: object - replicationTLSSecret: - description: |- - The secret of type kubernetes.io/tls containing the client certificate to authenticate as - the `streaming_replica` user. - If not defined, ClientCASecret must provide also `ca.key`, and a new secret will be - created using the provided CA. - type: string - serverAltDNSNames: - description: The list of the server alternative DNS names to be - added to the generated server TLS certificates, when required. - items: - type: string - type: array - serverCASecret: - description: |- - The secret containing the Server CA certificate. If not defined, a new secret will be created - with a self-signed CA and will be used to generate the TLS certificate ServerTLSSecret.
-
- Contains:
-
- - `ca.crt`: CA that should be used to validate the server certificate, - used as `sslrootcert` in client connection strings.
- - `ca.key`: key used to generate Server SSL certs, if ServerTLSSecret is provided, - this can be omitted.
- type: string - serverTLSSecret: - description: |- - The secret of type kubernetes.io/tls containing the server TLS certificate and key that will be set as - `ssl_cert_file` and `ssl_key_file` so that clients can connect to postgres securely. - If not defined, ServerCASecret must provide also `ca.key` and a new secret will be - created using the provided CA. - type: string - type: object - cloudNativePGCommitHash: - description: The commit hash number of which this operator running - type: string - cloudNativePGOperatorHash: - description: The hash of the binary of the operator - type: string - conditions: - description: Conditions for cluster object - items: - description: Condition contains details for one aspect of the current - state of this API Resource. - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - configMapResourceVersion: - description: |- - The list of resource versions of the configmaps, - managed by the operator. Every change here is done in the - interest of the instance manager, which will refresh the - configmap data - properties: - metrics: - additionalProperties: - type: string - description: |- - A map with the versions of all the config maps used to pass metrics. - Map keys are the config map names, map values are the versions - type: object - type: object - currentPrimary: - description: Current primary instance - type: string - currentPrimaryFailingSinceTimestamp: - description: |- - The timestamp when the primary was detected to be unhealthy - This field is reported when `.spec.failoverDelay` is populated or during online upgrades - type: string - currentPrimaryTimestamp: - description: The timestamp when the last actual promotion to primary - has occurred - type: string - danglingPVC: - description: |- - List of all the PVCs created by this cluster and still available - which are not attached to a Pod - items: - type: string - type: array - demotionToken: - description: |- - DemotionToken is a JSON token containing the information - from pg_controldata such as Database system identifier, Latest checkpoint's - TimeLineID, Latest checkpoint's REDO location, Latest checkpoint's REDO - WAL file, and Time of latest checkpoint - type: string - firstRecoverabilityPoint: - description: |- - The first recoverability point, stored as a date in RFC3339 format. - This field is calculated from the content of FirstRecoverabilityPointByMethod. - - Deprecated: the field is not set for backup plugins. - type: string - firstRecoverabilityPointByMethod: - additionalProperties: - format: date-time - type: string - description: |- - The first recoverability point, stored as a date in RFC3339 format, per backup method type. - - Deprecated: the field is not set for backup plugins. - type: object - healthyPVC: - description: List of all the PVCs not dangling nor initializing - items: - type: string - type: array - image: - description: Image contains the image name used by the pods - type: string - initializingPVC: - description: List of all the PVCs that are being initialized by this - cluster - items: - type: string - type: array - instanceNames: - description: List of instance names in the cluster - items: - type: string - type: array - instances: - description: The total number of PVC Groups detected in the cluster. - It may differ from the number of existing instance pods. - type: integer - instancesReportedState: - additionalProperties: - description: InstanceReportedState describes the last reported state - of an instance during a reconciliation loop - properties: - ip: - description: IP address of the instance - type: string - isPrimary: - description: indicates if an instance is the primary one - type: boolean - timeLineID: - description: indicates on which TimelineId the instance is - type: integer - required: - - isPrimary - type: object - description: The reported state of the instances during the last reconciliation - loop - type: object - instancesStatus: - additionalProperties: - items: - type: string - type: array - description: InstancesStatus indicates in which status the instances - are - type: object - jobCount: - description: How many Jobs have been created by this cluster - format: int32 - type: integer - lastFailedBackup: - description: |- - Last failed backup, stored as a date in RFC3339 format. - - Deprecated: the field is not set for backup plugins. - type: string - lastPromotionToken: - description: |- - LastPromotionToken is the last verified promotion token that - was used to promote a replica cluster - type: string - lastSuccessfulBackup: - description: |- - Last successful backup, stored as a date in RFC3339 format. - This field is calculated from the content of LastSuccessfulBackupByMethod. - - Deprecated: the field is not set for backup plugins. - type: string - lastSuccessfulBackupByMethod: - additionalProperties: - format: date-time - type: string - description: |- - Last successful backup, stored as a date in RFC3339 format, per backup method type. - - Deprecated: the field is not set for backup plugins. - type: object - latestGeneratedNode: - description: |- - ID of the latest generated node (used to avoid node name clashing) - - Deprecated: this field is not set anymore - type: integer - managedRolesStatus: - description: ManagedRolesStatus reports the state of the managed roles - in the cluster - properties: - byStatus: - additionalProperties: - items: - type: string - type: array - description: ByStatus gives the list of roles in each state - type: object - cannotReconcile: - additionalProperties: - items: - type: string - type: array - description: |- - CannotReconcile lists roles that cannot be reconciled, with an - explanation of the cause. Failures may originate in PostgreSQL - (e.g. dropping a role that owns objects) or in Kubernetes (e.g. - the referenced password Secret cannot be fetched). - type: object - passwordStatus: - additionalProperties: - description: PasswordState represents the state of the password - of a managed RoleConfiguration - properties: - resourceVersion: - description: the resource version of the password secret - type: string - transactionID: - description: the last transaction ID to affect the role - definition in PostgreSQL - format: int64 - type: integer - type: object - description: PasswordStatus gives the last transaction id and - password secret version for each managed role - type: object - type: object - onlineUpdateEnabled: - description: OnlineUpdateEnabled shows if the online upgrade is enabled - inside the cluster - type: boolean - operatorCertificateFingerprint: - description: |- - OperatorCertificateFingerprint is the SHA256 fingerprint of the operator's - in-memory client certificate public key. The instance manager pins this - fingerprint to authenticate requests from the operator. - type: string - pgDataImageInfo: - description: PGDataImageInfo contains the details of the latest image - that has run on the current data directory. - properties: - extensions: - description: Extensions contains the container image extensions - available for the current Image - items: - description: |- - ExtensionConfiguration is the configuration used to add - PostgreSQL extensions to the Cluster. - properties: - bin_path: - description: |- - A list of directories within the image to be appended to the - PostgreSQL process's `PATH` environment variable. - items: - type: string - type: array - dynamic_library_path: - description: |- - The list of directories inside the image which should be added to dynamic_library_path. - If not defined, defaults to "/lib". - items: - type: string - type: array - env: - description: |- - Env is a list of custom environment variables to be set in the - PostgreSQL process for this extension. It is the responsibility of the - cluster administrator to ensure the variables are correct for the - specific extension. Note that changes to these variables require - a manual cluster restart to take effect. - items: - description: |- - ExtensionEnvVar defines an environment variable for a specific extension - image volume. - properties: - name: - description: |- - Name of the environment variable to be injected into the - PostgreSQL process. - minLength: 1 - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ - type: string - value: - description: |- - Value of the environment variable. CloudNativePG performs a direct - replacement of this value, with support for placeholder expansion. - The ${`image_root`} placeholder resolves to the absolute mount path - of the extension's volume (e.g., `/extensions/my-extension`). This - is particularly useful for allowing applications or libraries to - locate specific directories within the mounted image. - Unrecognized placeholders are rejected. To include a literal ${...} - in the value, escape it as $${...}. - minLength: 1 - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - extension_control_path: - description: |- - The list of directories inside the image which should be added to extension_control_path. - If not defined, defaults to "/share". - items: - type: string - type: array - image: - description: The image containing the extension. - properties: - pullPolicy: - description: |- - Policy for pulling OCI objects. Possible values are: - Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. - Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. - type: string - reference: - description: |- - Required: Image or artifact reference to be used. - Behaves in the same way as pod.spec.containers[*].image. - Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. - More info: https://kubernetes.io/docs/concepts/containers/images - This field is optional to allow higher level config management to default or override - container images in workload controllers like Deployments and StatefulSets. - type: string - type: object - ld_library_path: - description: The list of directories inside the image which - should be added to ld_library_path. - items: - type: string - type: array - name: - description: |- - The name of the extension, required. The limit of 59 characters - leaves room for the prefix the operator adds when deriving the - extension's Kubernetes Volume name (capped at 63 characters). - maxLength: 59 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9_]*[a-z0-9])?$ - type: string - required: - - name - type: object - type: array - image: - description: Image is the image name - type: string - majorVersion: - description: MajorVersion is the major version of the image - type: integer - required: - - image - - majorVersion - type: object - phase: - description: Current phase of the cluster - type: string - phaseReason: - description: Reason for the current phase - type: string - pluginStatus: - description: PluginStatus is the status of the loaded plugins - items: - description: PluginStatus is the status of a loaded plugin - properties: - backupCapabilities: - description: |- - BackupCapabilities are the list of capabilities of the - plugin regarding the Backup management - items: - type: string - type: array - capabilities: - description: |- - Capabilities are the list of capabilities of the - plugin - items: - type: string - type: array - name: - description: Name is the name of the plugin - type: string - operatorCapabilities: - description: |- - OperatorCapabilities are the list of capabilities of the - plugin regarding the reconciler - items: - type: string - type: array - restoreJobHookCapabilities: - description: |- - RestoreJobHookCapabilities are the list of capabilities of the - plugin regarding the RestoreJobHook management - items: - type: string - type: array - status: - description: Status contain the status reported by the plugin - through the SetStatusInCluster interface - type: string - version: - description: |- - Version is the version of the plugin loaded by the - latest reconciliation loop - type: string - walCapabilities: - description: |- - WALCapabilities are the list of capabilities of the - plugin regarding the WAL management - items: - type: string - type: array - required: - - name - - version - type: object - type: array - podSelectorRefs: - description: |- - PodSelectorRefs contains the resolved pod IPs for each named selector - defined in spec.podSelectorRefs. - items: - description: PodSelectorRefStatus contains the resolved pod IPs - for a named selector. - properties: - ips: - description: |- - IPs is the list of pod IPs matching the selector. - Each IP is a single address (no CIDR notation). - items: - type: string - type: array - name: - description: Name corresponds to the name in the spec's PodSelectorRef. - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - poolerIntegrations: - description: The integration needed by poolers referencing the cluster - properties: - pgBouncerIntegration: - description: PgBouncerIntegrationStatus encapsulates the needed - integration for the pgbouncer poolers referencing the cluster - properties: - secrets: - items: - type: string - type: array - type: object - type: object - pvcCount: - description: How many PVCs have been created by this cluster - format: int32 - type: integer - readService: - description: Current list of read pods - type: string - readyInstances: - description: The total number of ready instances in the cluster. It - is equal to the number of ready instance pods. - type: integer - resizingPVC: - description: List of all the PVCs that have ResizingPVC condition. - items: - type: string - type: array - secretsResourceVersion: - description: |- - The list of resource versions of the secrets - managed by the operator. Every change here is done in the - interest of the instance manager, which will refresh the - secret data - properties: - applicationSecretVersion: - description: The resource version of the "app" user secret - type: string - barmanEndpointCA: - description: The resource version of the Barman Endpoint CA if - provided - type: string - caSecretVersion: - description: Unused. Retained for compatibility with old versions. - type: string - clientCaSecretVersion: - description: The resource version of the PostgreSQL client-side - CA secret version - type: string - externalClusterSecretVersion: - additionalProperties: - type: string - description: The resource versions of the external cluster secrets - type: object - managedRoleSecretVersion: - additionalProperties: - type: string - description: The resource versions of the managed roles secrets - type: object - metrics: - additionalProperties: - type: string - description: |- - A map with the versions of all the secrets used to pass metrics. - Map keys are the secret names, map values are the versions - type: object - replicationSecretVersion: - description: The resource version of the "streaming_replica" user - secret - type: string - serverCaSecretVersion: - description: The resource version of the PostgreSQL server-side - CA secret version - type: string - serverSecretVersion: - description: The resource version of the PostgreSQL server-side - secret version - type: string - superuserSecretVersion: - description: The resource version of the "postgres" user secret - type: string - type: object - selector: - description: |- - Selector is the serialized form of the label selector that identifies - the pods managed by this cluster. Populated by the operator and exposed - through the scale sub-resource so an autoscaler (such as HPA or VPA) - can discover the managed instance pods. - type: string - switchReplicaClusterStatus: - description: SwitchReplicaClusterStatus is the status of the switch - to replica cluster - properties: - inProgress: - description: InProgress indicates if there is an ongoing procedure - of switching a cluster to a replica cluster. - type: boolean - type: object - systemID: - description: SystemID is the latest detected PostgreSQL SystemID - type: string - tablespacesStatus: - description: TablespacesStatus reports the state of the declarative - tablespaces in the cluster - items: - description: TablespaceState represents the state of a tablespace - in a cluster - properties: - error: - description: Error is the reconciliation error, if any - type: string - name: - description: Name is the name of the tablespace - type: string - owner: - description: Owner is the PostgreSQL user owning the tablespace - type: string - state: - description: State is the latest reconciliation state - type: string - required: - - name - - state - type: object - type: array - targetPgDataImageInfo: - description: |- - TargetPGDataImageInfo contains the details of the target image for an - in-progress major upgrade. It is set before the upgrade Job is created, - and cleared on successful completion or when the upgrade is rolled back. - properties: - extensions: - description: Extensions contains the container image extensions - available for the current Image - items: - description: |- - ExtensionConfiguration is the configuration used to add - PostgreSQL extensions to the Cluster. - properties: - bin_path: - description: |- - A list of directories within the image to be appended to the - PostgreSQL process's `PATH` environment variable. - items: - type: string - type: array - dynamic_library_path: - description: |- - The list of directories inside the image which should be added to dynamic_library_path. - If not defined, defaults to "/lib". - items: - type: string - type: array - env: - description: |- - Env is a list of custom environment variables to be set in the - PostgreSQL process for this extension. It is the responsibility of the - cluster administrator to ensure the variables are correct for the - specific extension. Note that changes to these variables require - a manual cluster restart to take effect. - items: - description: |- - ExtensionEnvVar defines an environment variable for a specific extension - image volume. - properties: - name: - description: |- - Name of the environment variable to be injected into the - PostgreSQL process. - minLength: 1 - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ - type: string - value: - description: |- - Value of the environment variable. CloudNativePG performs a direct - replacement of this value, with support for placeholder expansion. - The ${`image_root`} placeholder resolves to the absolute mount path - of the extension's volume (e.g., `/extensions/my-extension`). This - is particularly useful for allowing applications or libraries to - locate specific directories within the mounted image. - Unrecognized placeholders are rejected. To include a literal ${...} - in the value, escape it as $${...}. - minLength: 1 - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - extension_control_path: - description: |- - The list of directories inside the image which should be added to extension_control_path. - If not defined, defaults to "/share". - items: - type: string - type: array - image: - description: The image containing the extension. - properties: - pullPolicy: - description: |- - Policy for pulling OCI objects. Possible values are: - Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. - Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. - type: string - reference: - description: |- - Required: Image or artifact reference to be used. - Behaves in the same way as pod.spec.containers[*].image. - Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. - More info: https://kubernetes.io/docs/concepts/containers/images - This field is optional to allow higher level config management to default or override - container images in workload controllers like Deployments and StatefulSets. - type: string - type: object - ld_library_path: - description: The list of directories inside the image which - should be added to ld_library_path. - items: - type: string - type: array - name: - description: |- - The name of the extension, required. The limit of 59 characters - leaves room for the prefix the operator adds when deriving the - extension's Kubernetes Volume name (capped at 63 characters). - maxLength: 59 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9_]*[a-z0-9])?$ - type: string - required: - - name - type: object - type: array - image: - description: Image is the image name - type: string - majorVersion: - description: MajorVersion is the major version of the image - type: integer - required: - - image - - majorVersion - type: object - targetPrimary: - description: |- - Target primary instance, this is different from the previous one - during a switchover or a failover - type: string - targetPrimaryTimestamp: - description: The timestamp when the last request for a new primary - has occurred - type: string - timelineID: - description: The timeline of the Postgres cluster - type: integer - topology: - description: Instances topology. - properties: - instances: - additionalProperties: - additionalProperties: - type: string - description: PodTopologyLabels represent the topology of a Pod. - map[labelName]labelValue - type: object - description: Instances contains the pod topology of the instances - type: object - nodesUsed: - description: |- - NodesUsed represents the count of distinct nodes accommodating the instances. - A value of '1' suggests that all instances are hosted on a single node, - implying the absence of High Availability (HA). Ideally, this value should - be the same as the number of instances in the Postgres HA cluster, implying - shared nothing architecture on the compute side. - format: int32 - type: integer - successfullyExtracted: - description: |- - SuccessfullyExtracted indicates if the topology data was extract. It is useful to enact fallback behaviors - in synchronous replica election in case of failures - type: boolean - type: object - unusablePVC: - description: List of all the PVCs that are unusable because another - PVC is missing - items: - type: string - type: array - writeService: - description: Current write pod - type: string - type: object - required: - - metadata - - spec - type: object - served: true - storage: true - subresources: - scale: - labelSelectorPath: .status.selector - specReplicasPath: .spec.instances - statusReplicasPath: .status.instances - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.21.0 - name: databaseroles.postgresql.cnpg.io -spec: - group: postgresql.cnpg.io - names: - kind: DatabaseRole - listKind: DatabaseRoleList - plural: databaseroles - singular: databaserole - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - jsonPath: .spec.cluster.name - name: Cluster - type: string - - jsonPath: .spec.name - name: PG Name - type: string - - jsonPath: .status.applied - name: Applied - type: boolean - - description: Latest reconciliation message - jsonPath: .status.message - name: Message - type: string - name: v1 - schema: - openAPIV3Schema: - description: DatabaseRole is the Schema for the databaseroles API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: |- - Specification of the desired DatabaseRole. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - bypassrls: - description: |- - Whether a role bypasses every row-level security (RLS) policy. - Default is `false`. - type: boolean - clientCertificate: - description: |- - ClientCertificate configures the operator to generate and renew a TLS client - certificate for this role, signed by the cluster's client CA. The certificate - is stored in a Secret named `-client-cert`. - Requires login to be true. - properties: - enabled: - default: true - description: |- - Enabled turns on client certificate issuance for this role. When true, - the role must have login enabled. Defaults to true when the block is present. - type: boolean - type: object - cluster: - description: The corresponding cluster - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - type: object - x-kubernetes-map-type: atomic - x-kubernetes-validations: - - message: cluster reference is immutable after creation - rule: self == oldSelf - comment: - description: Description of the role - type: string - connectionLimit: - default: -1 - description: |- - If the role can log in, this specifies how many concurrent - connections the role can make. `-1` (the default) means no limit. - format: int64 - type: integer - createdb: - description: |- - When set to `true`, the role being defined will be allowed to create - new databases. Specifying `false` (default) will deny a role the - ability to create databases. - type: boolean - createrole: - description: |- - Whether the role will be permitted to create, alter, drop, comment - on, change the security label for, and grant or revoke membership in - other roles. Default is `false`. - type: boolean - databaseRoleReclaimPolicy: - default: retain - description: The policy for end-of-life maintenance of this role - enum: - - delete - - retain - type: string - disablePassword: - description: DisablePassword indicates that a role's password should - be set to NULL in Postgres - type: boolean - ensure: - default: present - description: Ensure the role is `present` or `absent` - defaults to - "present" - enum: - - present - - absent - type: string - inRoles: - description: |- - List of one or more existing roles to which this role will be - immediately added as a new member. Default empty. - Changes to the list are applied to an existing role through - `GRANT` and `REVOKE` statements, not only at role creation. - items: - type: string - type: array - inherit: - default: true - description: |- - Whether a role "inherits" the privileges of roles it is a member of. - Default is `true`. - type: boolean - login: - description: |- - Whether the role is allowed to log in. A role having the `login` - attribute can be thought of as a user. Roles without this attribute - are useful for managing database privileges, but are not users in - the usual sense of the word. Default is `false`. - type: boolean - name: - description: Name of the role - type: string - passwordSecret: - description: |- - Secret containing the password of the role (if present). - If null, the password will be ignored unless DisablePassword is set. - When set, the secret must follow the `kubernetes.io/basic-auth` format - and contain both a `username` and a `password` field. - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - replication: - description: |- - Whether a role is a replication role. A role must have this - attribute (or be a superuser) in order to be able to connect to the - server in replication mode (physical or logical replication) and in - order to be able to create or drop replication slots. A role having - the `replication` attribute is a very highly privileged role, and - should only be used on roles actually used for replication. Default - is `false`. - type: boolean - superuser: - description: |- - Whether the role is a `superuser` who can override all access - restrictions within the database - superuser status is dangerous and - should be used only when really needed. You must yourself be a - superuser to create a new superuser. Defaults is `false`. - type: boolean - validUntil: - description: |- - Date and time after which the role's password is no longer valid. - When omitted, the password will never expire (default). - format: date-time - type: string - required: - - cluster - - name - type: object - x-kubernetes-validations: - - message: name is immutable - rule: self.name == oldSelf.name - - message: 'ensure: absent is not supported for DatabaseRole; delete the - resource with databaseRoleReclaimPolicy: delete instead' - rule: '!has(self.ensure) || self.ensure != ''absent''' - - message: the role name postgres is reserved - rule: self.name != 'postgres' - - message: the role name streaming_replica is reserved - rule: self.name != 'streaming_replica' - - message: role names starting with pg_ are reserved by PostgreSQL - rule: '!self.name.startsWith(''pg_'')' - - message: role names starting with cnpg_ are reserved by the operator - rule: '!self.name.startsWith(''cnpg_'')' - - message: role name must not be empty - rule: self.name.size() != 0 - - message: passwordSecret and disablePassword are mutually exclusive - rule: '!has(self.passwordSecret) || !has(self.disablePassword) || !self.disablePassword' - - message: clientCertificate requires the role to have login enabled - rule: '!has(self.clientCertificate) || !self.clientCertificate.enabled - || self.login' - status: - description: |- - Most recently observed status of the DatabaseRole. This data may not be up - to date. Populated by the system. Read-only. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - applied: - description: Applied is true if the role was reconciled correctly - type: boolean - clientCertificate: - description: |- - ClientCertificate holds the observed state of the generated TLS client - certificate, when client certificate issuance is enabled. - properties: - expiration: - description: Expiration is the expiration time of the generated - client certificate, in RFC3339 format. - type: string - message: - description: |- - Message contains a human-readable explanation of the current certificate status, - such as why issuance was skipped or why an existing Secret was left untouched. - type: string - type: object - conditions: - description: Conditions for the DatabaseRole object - items: - description: Condition contains details for one aspect of the current - state of this API Resource. - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - message: - description: Message is the reconciliation error message - type: string - observedGeneration: - description: |- - A sequence number representing the latest - desired state that was synchronized - format: int64 - type: integer - secretResourceVersion: - description: |- - SecretResourceVersion is the resource version of the password secret - last applied to the role; a change to it triggers reconciliation. - type: string - type: object - required: - - metadata - - spec - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.21.0 - name: databases.postgresql.cnpg.io -spec: - group: postgresql.cnpg.io - names: - kind: Database - listKind: DatabaseList - plural: databases - singular: database - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - jsonPath: .spec.cluster.name - name: Cluster - type: string - - jsonPath: .spec.name - name: PG Name - type: string - - jsonPath: .status.applied - name: Applied - type: boolean - - description: Latest reconciliation message - jsonPath: .status.message - name: Message - type: string - name: v1 - schema: - openAPIV3Schema: - description: Database is the Schema for the databases API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: |- - Specification of the desired Database. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - allowConnections: - description: |- - Maps to the `ALLOW_CONNECTIONS` parameter of `CREATE DATABASE` and - `ALTER DATABASE`. If false then no one can connect to this database. - type: boolean - builtinLocale: - description: |- - Maps to the `BUILTIN_LOCALE` parameter of `CREATE DATABASE`. This - setting cannot be changed. Specifies the locale name when the - builtin provider is used. This option requires `localeProvider` to - be set to `builtin`. Available from PostgreSQL 17. - type: string - x-kubernetes-validations: - - message: builtinLocale is immutable - rule: self == oldSelf - cluster: - description: The name of the PostgreSQL cluster hosting the database. - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - type: object - x-kubernetes-map-type: atomic - x-kubernetes-validations: - - message: cluster reference is immutable after creation - rule: self == oldSelf - collationVersion: - description: |- - Maps to the `COLLATION_VERSION` parameter of `CREATE DATABASE`. This - setting cannot be changed. - type: string - x-kubernetes-validations: - - message: collationVersion is immutable - rule: self == oldSelf - connectionLimit: - description: |- - Maps to the `CONNECTION LIMIT` clause of `CREATE DATABASE` and - `ALTER DATABASE`. How many concurrent connections can be made to - this database. -1 (the default) means no limit. - type: integer - databaseReclaimPolicy: - default: retain - description: The policy for end-of-life maintenance of this database. - enum: - - delete - - retain - type: string - encoding: - description: |- - Maps to the `ENCODING` parameter of `CREATE DATABASE`. This setting - cannot be changed. Character set encoding to use in the database. - type: string - x-kubernetes-validations: - - message: encoding is immutable - rule: self == oldSelf - ensure: - default: present - description: Ensure the PostgreSQL database is `present` or `absent` - - defaults to "present". - enum: - - present - - absent - type: string - extensions: - description: The list of extensions to be managed in the database - items: - description: ExtensionSpec configures an extension in a database - properties: - ensure: - default: present - description: |- - Specifies whether an object (e.g schema) should be present or absent - in the database. If set to `present`, the object will be created if - it does not exist. If set to `absent`, the extension/schema will be - removed if it exists. - enum: - - present - - absent - type: string - name: - description: Name of the object (extension, schema, FDW, server) - type: string - schema: - description: |- - The name of the schema in which to install the extension's objects, - in case the extension allows its contents to be relocated. If not - specified (default), and the extension's control file does not - specify a schema either, the current default object creation schema - is used. - type: string - version: - description: |- - The version of the extension to install. If empty, the operator will - install the default version (whatever is specified in the - extension's control file) - type: string - required: - - name - type: object - type: array - fdws: - description: The list of foreign data wrappers to be managed in the - database - items: - description: FDWSpec configures an Foreign Data Wrapper in a database - properties: - ensure: - default: present - description: |- - Specifies whether an object (e.g schema) should be present or absent - in the database. If set to `present`, the object will be created if - it does not exist. If set to `absent`, the extension/schema will be - removed if it exists. - enum: - - present - - absent - type: string - handler: - description: |- - Name of the handler function (e.g., "postgres_fdw_handler"). - This will be empty if no handler is specified. In that case, - the default handler is registered when the FDW extension is created. - type: string - name: - description: Name of the object (extension, schema, FDW, server) - type: string - options: - description: Options specifies the configuration options for - the FDW. - items: - description: OptionSpec holds the name, value and the ensure - field for an option - properties: - ensure: - default: present - description: |- - Specifies whether an option should be present or absent in - the database. If set to `present`, the option will be - created if it does not exist. If set to `absent`, the - option will be removed if it exists. - enum: - - present - - absent - type: string - name: - description: Name of the option - type: string - value: - description: Value of the option - type: string - required: - - name - - value - type: object - type: array - owner: - description: |- - Owner specifies the database role that will own the Foreign Data Wrapper. - The role must have superuser privileges in the target database. - type: string - usage: - description: List of roles for which `USAGE` privileges on the - FDW are granted or revoked. - items: - description: UsageSpec configures a usage for a foreign data - wrapper - properties: - name: - description: Name of the usage - type: string - x-kubernetes-validations: - - message: name is required - rule: self != '' - type: - default: grant - description: The type of usage - enum: - - grant - - revoke - type: string - required: - - name - type: object - type: array - validator: - description: |- - Name of the validator function (e.g., "postgres_fdw_validator"). - This will be empty if no validator is specified. In that case, - the default validator is registered when the FDW extension is created. - type: string - required: - - name - type: object - type: array - icuLocale: - description: |- - Maps to the `ICU_LOCALE` parameter of `CREATE DATABASE`. This - setting cannot be changed. Specifies the ICU locale when the ICU - provider is used. This option requires `localeProvider` to be set to - `icu`. Available from PostgreSQL 15. - type: string - x-kubernetes-validations: - - message: icuLocale is immutable - rule: self == oldSelf - icuRules: - description: |- - Maps to the `ICU_RULES` parameter of `CREATE DATABASE`. This setting - cannot be changed. Specifies additional collation rules to customize - the behavior of the default collation. This option requires - `localeProvider` to be set to `icu`. Available from PostgreSQL 16. - type: string - x-kubernetes-validations: - - message: icuRules is immutable - rule: self == oldSelf - isTemplate: - description: |- - Maps to the `IS_TEMPLATE` parameter of `CREATE DATABASE` and `ALTER - DATABASE`. If true, this database is considered a template and can - be cloned by any user with `CREATEDB` privileges. - type: boolean - locale: - description: |- - Maps to the `LOCALE` parameter of `CREATE DATABASE`. This setting - cannot be changed. Sets the default collation order and character - classification in the new database. - type: string - x-kubernetes-validations: - - message: locale is immutable - rule: self == oldSelf - localeCType: - description: |- - Maps to the `LC_CTYPE` parameter of `CREATE DATABASE`. This setting - cannot be changed. - type: string - x-kubernetes-validations: - - message: localeCType is immutable - rule: self == oldSelf - localeCollate: - description: |- - Maps to the `LC_COLLATE` parameter of `CREATE DATABASE`. This - setting cannot be changed. - type: string - x-kubernetes-validations: - - message: localeCollate is immutable - rule: self == oldSelf - localeProvider: - description: |- - Maps to the `LOCALE_PROVIDER` parameter of `CREATE DATABASE`. This - setting cannot be changed. This option sets the locale provider for - databases created in the new cluster. Available from PostgreSQL 16. - type: string - x-kubernetes-validations: - - message: localeProvider is immutable - rule: self == oldSelf - name: - description: The name of the database to create inside PostgreSQL. - This setting cannot be changed. - type: string - x-kubernetes-validations: - - message: name is immutable - rule: self == oldSelf - - message: the name postgres is reserved - rule: self != 'postgres' - - message: the name template0 is reserved - rule: self != 'template0' - - message: the name template1 is reserved - rule: self != 'template1' - owner: - description: |- - Maps to the `OWNER` parameter of `CREATE DATABASE`. - Maps to the `OWNER TO` command of `ALTER DATABASE`. - The role name of the user who owns the database inside PostgreSQL. - type: string - schemas: - description: The list of schemas to be managed in the database - items: - description: SchemaSpec configures a schema in a database - properties: - ensure: - default: present - description: |- - Specifies whether an object (e.g schema) should be present or absent - in the database. If set to `present`, the object will be created if - it does not exist. If set to `absent`, the extension/schema will be - removed if it exists. - enum: - - present - - absent - type: string - name: - description: Name of the object (extension, schema, FDW, server) - type: string - owner: - description: |- - The role name of the user who owns the schema inside PostgreSQL. - It maps to the `AUTHORIZATION` parameter of `CREATE SCHEMA` and the - `OWNER TO` command of `ALTER SCHEMA`. - type: string - required: - - name - type: object - type: array - servers: - description: The list of foreign servers to be managed in the database - items: - description: ServerSpec configures a server of a foreign data wrapper - properties: - ensure: - default: present - description: |- - Specifies whether an object (e.g schema) should be present or absent - in the database. If set to `present`, the object will be created if - it does not exist. If set to `absent`, the extension/schema will be - removed if it exists. - enum: - - present - - absent - type: string - fdw: - description: The name of the Foreign Data Wrapper (FDW) - type: string - x-kubernetes-validations: - - message: fdw is required - rule: self != '' - name: - description: Name of the object (extension, schema, FDW, server) - type: string - options: - description: |- - Options specifies the configuration options for the server - (key is the option name, value is the option value). - items: - description: OptionSpec holds the name, value and the ensure - field for an option - properties: - ensure: - default: present - description: |- - Specifies whether an option should be present or absent in - the database. If set to `present`, the option will be - created if it does not exist. If set to `absent`, the - option will be removed if it exists. - enum: - - present - - absent - type: string - name: - description: Name of the option - type: string - value: - description: Value of the option - type: string - required: - - name - - value - type: object - type: array - usage: - description: List of roles for which `USAGE` privileges on the - server are granted or revoked. - items: - description: UsageSpec configures a usage for a foreign data - wrapper - properties: - name: - description: Name of the usage - type: string - x-kubernetes-validations: - - message: name is required - rule: self != '' - type: - default: grant - description: The type of usage - enum: - - grant - - revoke - type: string - required: - - name - type: object - type: array - required: - - fdw - - name - type: object - type: array - tablespace: - description: |- - Maps to the `TABLESPACE` parameter of `CREATE DATABASE`. - Maps to the `SET TABLESPACE` command of `ALTER DATABASE`. - The name of the tablespace (in PostgreSQL) that will be associated - with the new database. This tablespace will be the default - tablespace used for objects created in this database. - type: string - template: - description: |- - Maps to the `TEMPLATE` parameter of `CREATE DATABASE`. This setting - cannot be changed. The name of the template from which to create - this database. - type: string - x-kubernetes-validations: - - message: template is immutable - rule: self == oldSelf - required: - - cluster - - name - - owner - type: object - x-kubernetes-validations: - - message: builtinLocale is only available when localeProvider is set - to `builtin` - rule: '!has(self.builtinLocale) || self.localeProvider == ''builtin''' - - message: icuLocale is only available when localeProvider is set to `icu` - rule: '!has(self.icuLocale) || self.localeProvider == ''icu''' - - message: icuRules is only available when localeProvider is set to `icu` - rule: '!has(self.icuRules) || self.localeProvider == ''icu''' - status: - description: |- - Most recently observed status of the Database. This data may not be up to - date. Populated by the system. Read-only. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - applied: - description: Applied is true if the database was reconciled correctly - type: boolean - extensions: - description: Extensions is the status of the managed extensions - items: - description: DatabaseObjectStatus is the status of the managed database - objects - properties: - applied: - description: |- - True of the object has been installed successfully in - the database - type: boolean - message: - description: Message is the object reconciliation message - type: string - name: - description: The name of the object - type: string - required: - - applied - - name - type: object - type: array - fdws: - description: FDWs is the status of the managed FDWs - items: - description: DatabaseObjectStatus is the status of the managed database - objects - properties: - applied: - description: |- - True of the object has been installed successfully in - the database - type: boolean - message: - description: Message is the object reconciliation message - type: string - name: - description: The name of the object - type: string - required: - - applied - - name - type: object - type: array - message: - description: Message is the reconciliation output message - type: string - observedGeneration: - description: |- - A sequence number representing the latest - desired state that was synchronized - format: int64 - type: integer - schemas: - description: Schemas is the status of the managed schemas - items: - description: DatabaseObjectStatus is the status of the managed database - objects - properties: - applied: - description: |- - True of the object has been installed successfully in - the database - type: boolean - message: - description: Message is the object reconciliation message - type: string - name: - description: The name of the object - type: string - required: - - applied - - name - type: object - type: array - servers: - description: Servers is the status of the managed servers - items: - description: DatabaseObjectStatus is the status of the managed database - objects - properties: - applied: - description: |- - True of the object has been installed successfully in - the database - type: boolean - message: - description: Message is the object reconciliation message - type: string - name: - description: The name of the object - type: string - required: - - applied - - name - type: object - type: array - type: object - required: - - metadata - - spec - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.21.0 - name: failoverquorums.postgresql.cnpg.io -spec: - group: postgresql.cnpg.io - names: - kind: FailoverQuorum - listKind: FailoverQuorumList - plural: failoverquorums - singular: failoverquorum - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1 - schema: - openAPIV3Schema: - description: |- - FailoverQuorum contains the information about the current failover - quorum status of a PG cluster. It is updated by the instance manager - of the primary node and reset to zero by the operator to trigger - an update. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - status: - description: Most recently observed status of the failover quorum. - properties: - method: - description: Contains the latest reported Method value. - type: string - primary: - description: |- - Primary is the name of the primary instance that updated - this object the latest time. - type: string - standbyNames: - description: |- - StandbyNames is the list of potentially synchronous - instance names. - items: - type: string - type: array - standbyNumber: - description: |- - StandbyNumber is the number of synchronous standbys that transactions - need to wait for replies from. - type: integer - type: object - required: - - metadata - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.21.0 - name: imagecatalogs.postgresql.cnpg.io -spec: - group: postgresql.cnpg.io - names: - kind: ImageCatalog - listKind: ImageCatalogList - plural: imagecatalogs - singular: imagecatalog - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1 - schema: - openAPIV3Schema: - description: ImageCatalog is the Schema for the imagecatalogs API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: |- - Specification of the desired behavior of the ImageCatalog. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - componentImages: - description: |- - ComponentImages is a list of named images for components other than PostgreSQL - (e.g. pgbouncer). Keys must be unique within a catalog. - items: - description: CatalogComponentImage is a named image entry for a - non-PostgreSQL component. - properties: - image: - description: Image is the container image reference. - type: string - key: - description: Key is the unique identifier for this image within - the catalog. - maxLength: 63 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - required: - - image - - key - type: object - maxItems: 32 - type: array - x-kubernetes-list-map-keys: - - key - x-kubernetes-list-type: map - x-kubernetes-validations: - - message: Component image keys must be unique - rule: self.all(e, self.filter(f, f.key==e.key).size() == 1) - images: - description: List of CatalogImages available in the catalog - items: - description: CatalogImage defines the image and major version - properties: - extensions: - description: The configuration of the extensions to be added - items: - description: |- - ExtensionConfiguration is the configuration used to add - PostgreSQL extensions to the Cluster. - properties: - bin_path: - description: |- - A list of directories within the image to be appended to the - PostgreSQL process's `PATH` environment variable. - items: - type: string - type: array - dynamic_library_path: - description: |- - The list of directories inside the image which should be added to dynamic_library_path. - If not defined, defaults to "/lib". - items: - type: string - type: array - env: - description: |- - Env is a list of custom environment variables to be set in the - PostgreSQL process for this extension. It is the responsibility of the - cluster administrator to ensure the variables are correct for the - specific extension. Note that changes to these variables require - a manual cluster restart to take effect. - items: - description: |- - ExtensionEnvVar defines an environment variable for a specific extension - image volume. - properties: - name: - description: |- - Name of the environment variable to be injected into the - PostgreSQL process. - minLength: 1 - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ - type: string - value: - description: |- - Value of the environment variable. CloudNativePG performs a direct - replacement of this value, with support for placeholder expansion. - The ${`image_root`} placeholder resolves to the absolute mount path - of the extension's volume (e.g., `/extensions/my-extension`). This - is particularly useful for allowing applications or libraries to - locate specific directories within the mounted image. - Unrecognized placeholders are rejected. To include a literal ${...} - in the value, escape it as $${...}. - minLength: 1 - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - extension_control_path: - description: |- - The list of directories inside the image which should be added to extension_control_path. - If not defined, defaults to "/share". - items: - type: string - type: array - image: - description: The image containing the extension. - properties: - pullPolicy: - description: |- - Policy for pulling OCI objects. Possible values are: - Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. - Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. - type: string - reference: - description: |- - Required: Image or artifact reference to be used. - Behaves in the same way as pod.spec.containers[*].image. - Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. - More info: https://kubernetes.io/docs/concepts/containers/images - This field is optional to allow higher level config management to default or override - container images in workload controllers like Deployments and StatefulSets. - type: string - type: object - ld_library_path: - description: The list of directories inside the image - which should be added to ld_library_path. - items: - type: string - type: array - name: - description: |- - The name of the extension, required. The limit of 59 characters - leaves room for the prefix the operator adds when deriving the - extension's Kubernetes Volume name (capped at 63 characters). - maxLength: 59 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9_]*[a-z0-9])?$ - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - image: - description: The image reference - type: string - major: - description: The PostgreSQL major version of the image. Must - be unique within the catalog. - minimum: 10 - type: integer - required: - - image - - major - type: object - maxItems: 8 - minItems: 1 - type: array - x-kubernetes-validations: - - message: Images must have unique major versions - rule: self.all(e, self.filter(f, f.major==e.major).size() == 1) - required: - - images - type: object - required: - - metadata - - spec - type: object - served: true - storage: true - subresources: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.21.0 - name: poolers.postgresql.cnpg.io -spec: - group: postgresql.cnpg.io - names: - kind: Pooler - listKind: PoolerList - plural: poolers - singular: pooler - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - jsonPath: .spec.cluster.name - name: Cluster - type: string - - jsonPath: .spec.type - name: Type - type: string - - jsonPath: .status.phase - name: Phase - type: string - name: v1 - schema: - openAPIV3Schema: - description: Pooler is the Schema for the poolers API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: |- - Specification of the desired behavior of the Pooler. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - cluster: - description: |- - This is the cluster reference on which the Pooler will work. - Pooler name should never match with any cluster name within the same namespace. - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - x-kubernetes-validations: - - message: cluster reference is immutable after creation - rule: self == oldSelf - deploymentStrategy: - description: The deployment strategy to use for pgbouncer to replace - existing pods with new ones - properties: - rollingUpdate: - description: |- - Rolling update config params. Present only if DeploymentStrategyType = - RollingUpdate. - properties: - maxSurge: - anyOf: - - type: integer - - type: string - description: |- - The maximum number of pods that can be scheduled above the desired number of - pods. - Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). - This can not be 0 if MaxUnavailable is 0. - Absolute number is calculated from percentage by rounding up. - Defaults to 25%. - Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when - the rolling update starts, such that the total number of old and new pods do not exceed - 130% of desired pods. Once old pods have been killed, - new ReplicaSet can be scaled up further, ensuring that total number of pods running - at any time during the update is at most 130% of desired pods. - x-kubernetes-int-or-string: true - maxUnavailable: - anyOf: - - type: integer - - type: string - description: |- - The maximum number of pods that can be unavailable during the update. - Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). - Absolute number is calculated from percentage by rounding down. - This can not be 0 if MaxSurge is 0. - Defaults to 25%. - Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods - immediately when the rolling update starts. Once new pods are ready, old ReplicaSet - can be scaled down further, followed by scaling up the new ReplicaSet, ensuring - that the total number of pods available at all times during the update is at - least 70% of desired pods. - x-kubernetes-int-or-string: true - type: object - type: - description: Type of deployment. Can be "Recreate" or "RollingUpdate". - Default is RollingUpdate. - type: string - type: object - instances: - default: 1 - description: 'The number of replicas we want. Default: 1.' - format: int32 - type: integer - monitoring: - description: The configuration of the monitoring infrastructure of - this pooler. - properties: - enablePodMonitor: - default: false - description: |- - Enable or disable the `PodMonitor` - - Deprecated: This feature will be removed in an upcoming release. If - you need this functionality, you can create a PodMonitor manually. - type: boolean - podMonitorMetricRelabelings: - description: |- - The list of metric relabelings for the `PodMonitor`. Applied to samples before ingestion. - - Deprecated: This feature will be removed in an upcoming release. If - you need this functionality, you can create a PodMonitor manually. - items: - description: |- - RelabelConfig allows dynamic rewriting of the label set for targets, alerts, - scraped samples and remote write samples. - - More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config - properties: - action: - default: replace - description: |- - action to perform based on the regex matching. - - `Uppercase` and `Lowercase` actions require Prometheus >= v2.36.0. - `DropEqual` and `KeepEqual` actions require Prometheus >= v2.41.0. - - Default: "Replace" - enum: - - replace - - Replace - - keep - - Keep - - drop - - Drop - - hashmod - - HashMod - - labelmap - - LabelMap - - labeldrop - - LabelDrop - - labelkeep - - LabelKeep - - lowercase - - Lowercase - - uppercase - - Uppercase - - keepequal - - KeepEqual - - dropequal - - DropEqual - type: string - modulus: - description: |- - modulus to take of the hash of the source label values. - - Only applicable when the action is `HashMod`. - format: int64 - type: integer - regex: - description: regex defines the regular expression against - which the extracted value is matched. - type: string - replacement: - description: |- - replacement value against which a Replace action is performed if the - regular expression matches. - - Regex capture groups are available. - type: string - separator: - description: separator defines the string between concatenated - SourceLabels. - type: string - sourceLabels: - description: |- - sourceLabels defines the source labels select values from existing labels. Their content is - concatenated using the configured Separator and matched against the - configured regular expression. - items: - description: |- - LabelName is a valid Prometheus label name. - For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. - For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. - type: string - type: array - targetLabel: - description: |- - targetLabel defines the label to which the resulting string is written in a replacement. - - It is mandatory for `Replace`, `HashMod`, `Lowercase`, `Uppercase`, - `KeepEqual` and `DropEqual` actions. - - Regex capture groups are available. - type: string - type: object - type: array - podMonitorRelabelings: - description: |- - The list of relabelings for the `PodMonitor`. Applied to samples before scraping. - - Deprecated: This feature will be removed in an upcoming release. If - you need this functionality, you can create a PodMonitor manually. - items: - description: |- - RelabelConfig allows dynamic rewriting of the label set for targets, alerts, - scraped samples and remote write samples. - - More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config - properties: - action: - default: replace - description: |- - action to perform based on the regex matching. - - `Uppercase` and `Lowercase` actions require Prometheus >= v2.36.0. - `DropEqual` and `KeepEqual` actions require Prometheus >= v2.41.0. - - Default: "Replace" - enum: - - replace - - Replace - - keep - - Keep - - drop - - Drop - - hashmod - - HashMod - - labelmap - - LabelMap - - labeldrop - - LabelDrop - - labelkeep - - LabelKeep - - lowercase - - Lowercase - - uppercase - - Uppercase - - keepequal - - KeepEqual - - dropequal - - DropEqual - type: string - modulus: - description: |- - modulus to take of the hash of the source label values. - - Only applicable when the action is `HashMod`. - format: int64 - type: integer - regex: - description: regex defines the regular expression against - which the extracted value is matched. - type: string - replacement: - description: |- - replacement value against which a Replace action is performed if the - regular expression matches. - - Regex capture groups are available. - type: string - separator: - description: separator defines the string between concatenated - SourceLabels. - type: string - sourceLabels: - description: |- - sourceLabels defines the source labels select values from existing labels. Their content is - concatenated using the configured Separator and matched against the - configured regular expression. - items: - description: |- - LabelName is a valid Prometheus label name. - For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. - For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. - type: string - type: array - targetLabel: - description: |- - targetLabel defines the label to which the resulting string is written in a replacement. - - It is mandatory for `Replace`, `HashMod`, `Lowercase`, `Uppercase`, - `KeepEqual` and `DropEqual` actions. - - Regex capture groups are available. - type: string - type: object - type: array - tls: - description: |- - Configure TLS communication for the metrics endpoint. - Changing tls.enabled option will force a rollout of all instances. - properties: - enabled: - default: false - description: |- - Enable TLS for the monitoring endpoint. - Changing this option will force a rollout of all instances. - type: boolean - type: object - type: object - pgbouncer: - description: The PgBouncer configuration - properties: - authQuery: - description: |- - The query that will be used to download the hash of the password - of a certain user. Default: "SELECT usename, passwd FROM public.user_search($1)". - In case it is specified, also an AuthQuerySecret has to be specified and - no automatic CNPG Cluster integration will be triggered. - type: string - authQuerySecret: - description: |- - The credentials of the user that need to be used for the authentication - query. In case it is specified, also an AuthQuery - (e.g. "SELECT usename, passwd FROM pg_catalog.pg_shadow WHERE usename=$1") - has to be specified and no automatic CNPG Cluster integration will be triggered. - - Deprecated. - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - clientCASecret: - description: |- - ClientCASecret provides PgBouncer’s client_tls_ca_file, the root - CA for validating client certificates - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - clientTLSSecret: - description: |- - ClientTLSSecret provides PgBouncer’s client_tls_key_file (private key) - and client_tls_cert_file (certificate) used to accept client connections - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - image: - description: |- - Image is the pgbouncer container image to use. When set, it takes - precedence over ImageCatalogRef and the operator default, but is - overridden by an explicit image set in the pod template. - type: string - imageCatalogRef: - description: |- - ImageCatalogRef points to an entry in an ImageCatalog or ClusterImageCatalog. - Mutually exclusive with Image. - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - key: - description: Key identifies the entry within the catalog's - componentImages list. - maxLength: 63 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - kind: - description: Kind is the type of resource being referenced - type: string - name: - description: Name is the name of resource being referenced - type: string - required: - - key - - kind - - name - type: object - x-kubernetes-map-type: atomic - x-kubernetes-validations: - - message: Only ImageCatalog and ClusterImageCatalog are supported - rule: self.kind == 'ImageCatalog' || self.kind == 'ClusterImageCatalog' - - message: apiGroup must be postgresql.cnpg.io - rule: self.apiGroup == 'postgresql.cnpg.io' - parameters: - additionalProperties: - type: string - description: |- - Additional parameters to be passed to PgBouncer - please check - the CNPG documentation for a list of options you can configure - type: object - paused: - default: false - description: |- - When set to `true`, PgBouncer will disconnect from the PostgreSQL - server, first waiting for all queries to complete, and pause all new - client connections until this value is set to `false` (default). Internally, - the operator calls PgBouncer's `PAUSE` and `RESUME` commands. - type: boolean - pg_hba: - description: |- - PostgreSQL Host Based Authentication rules (lines to be appended - to the pg_hba.conf file) - items: - type: string - type: array - poolMode: - default: session - description: 'The pool mode. Default: `session`.' - enum: - - session - - transaction - type: string - serverCASecret: - description: |- - ServerCASecret provides PgBouncer’s server_tls_ca_file, the root - CA for validating PostgreSQL certificates - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - serverTLSSecret: - description: |- - ServerTLSSecret, when pointing to a TLS secret, provides pgbouncer's - `server_tls_key_file` and `server_tls_cert_file`, used when - authenticating against PostgreSQL. - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - type: object - x-kubernetes-validations: - - message: image and imageCatalogRef are mutually exclusive - rule: '!(has(self.image) && has(self.imageCatalogRef))' - serviceAccountName: - description: |- - Name of an existing ServiceAccount in the same namespace to use for the pooler. - When specified, the operator will not create a new ServiceAccount - but will use the provided one. This is useful for sharing a single - ServiceAccount across multiple poolers (e.g., for cloud IAM configurations). - If not specified, a ServiceAccount will be created with the pooler name. - maxLength: 253 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - type: string - x-kubernetes-validations: - - message: serviceAccountName is immutable - rule: self == oldSelf - serviceTemplate: - description: Template for the Service to be created - properties: - metadata: - description: |- - Standard object's metadata. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - properties: - annotations: - additionalProperties: - type: string - description: |- - Annotations is an unstructured key value map stored with a resource that may be - set by external tools to store and retrieve arbitrary metadata. They are not - queryable and should be preserved when modifying objects. - More info: http://kubernetes.io/docs/user-guide/annotations - type: object - labels: - additionalProperties: - type: string - description: |- - Map of string keys and values that can be used to organize and categorize - (scope and select) objects. May match selectors of replication controllers - and services. - More info: http://kubernetes.io/docs/user-guide/labels - type: object - name: - description: The name of the resource. Only supported for - certain types - type: string - type: object - spec: - description: |- - Specification of the desired behavior of the service. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - allocateLoadBalancerNodePorts: - description: |- - allocateLoadBalancerNodePorts defines if NodePorts will be automatically - allocated for services with type LoadBalancer. Default is "true". It - may be set to "false" if the cluster load-balancer does not rely on - NodePorts. If the caller requests specific NodePorts (by specifying a - value), those requests will be respected, regardless of this field. - This field may only be set for services with type LoadBalancer and will - be cleared if the type is changed to any other type. - type: boolean - clusterIP: - description: |- - clusterIP is the IP address of the service and is usually assigned - randomly. If an address is specified manually, is in-range (as per - system configuration), and is not in use, it will be allocated to the - service; otherwise creation of the service will fail. This field may not - be changed through updates unless the type field is also being changed - to ExternalName (which requires this field to be blank) or the type - field is being changed from ExternalName (in which case this field may - optionally be specified, as describe above). Valid values are "None", - empty string (""), or a valid IP address. Setting this to "None" makes a - "headless service" (no virtual IP), which is useful when direct endpoint - connections are preferred and proxying is not required. Only applies to - types ClusterIP, NodePort, and LoadBalancer. If this field is specified - when creating a Service of type ExternalName, creation will fail. This - field will be wiped when updating a Service to type ExternalName. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - type: string - clusterIPs: - description: |- - ClusterIPs is a list of IP addresses assigned to this service, and are - usually assigned randomly. If an address is specified manually, is - in-range (as per system configuration), and is not in use, it will be - allocated to the service; otherwise creation of the service will fail. - This field may not be changed through updates unless the type field is - also being changed to ExternalName (which requires this field to be - empty) or the type field is being changed from ExternalName (in which - case this field may optionally be specified, as describe above). Valid - values are "None", empty string (""), or a valid IP address. Setting - this to "None" makes a "headless service" (no virtual IP), which is - useful when direct endpoint connections are preferred and proxying is - not required. Only applies to types ClusterIP, NodePort, and - LoadBalancer. If this field is specified when creating a Service of type - ExternalName, creation will fail. This field will be wiped when updating - a Service to type ExternalName. If this field is not specified, it will - be initialized from the clusterIP field. If this field is specified, - clients must ensure that clusterIPs[0] and clusterIP have the same - value. - - This field may hold a maximum of two entries (dual-stack IPs, in either order). - These IPs must correspond to the values of the ipFamilies field. Both - clusterIPs and ipFamilies are governed by the ipFamilyPolicy field. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - items: - type: string - type: array - x-kubernetes-list-type: atomic - externalIPs: - description: |- - externalIPs is a list of IP addresses for which nodes in the cluster - will also accept traffic for this service. These IPs are not managed by - Kubernetes. The user is responsible for ensuring that traffic arrives - at a node with this IP. A common example is external load-balancers - that are not part of the Kubernetes system. - items: - type: string - type: array - x-kubernetes-list-type: atomic - externalName: - description: |- - externalName is the external reference that discovery mechanisms will - return as an alias for this service (e.g. a DNS CNAME record). No - proxying will be involved. Must be a lowercase RFC-1123 hostname - (https://tools.ietf.org/html/rfc1123) and requires `type` to be "ExternalName". - type: string - externalTrafficPolicy: - description: |- - externalTrafficPolicy describes how nodes distribute service traffic they - receive on one of the Service's "externally-facing" addresses (NodePorts, - ExternalIPs, and LoadBalancer IPs). If set to "Local", the proxy will configure - the service in a way that assumes that external load balancers will take care - of balancing the service traffic between nodes, and so each node will deliver - traffic only to the node-local endpoints of the service, without masquerading - the client source IP. (Traffic mistakenly sent to a node with no endpoints will - be dropped.) The default value, "Cluster", uses the standard behavior of - routing to all endpoints evenly (possibly modified by topology and other - features). Note that traffic sent to an External IP or LoadBalancer IP from - within the cluster will always get "Cluster" semantics, but clients sending to - a NodePort from within the cluster may need to take traffic policy into account - when picking a node. - type: string - healthCheckNodePort: - description: |- - healthCheckNodePort specifies the healthcheck nodePort for the service. - This only applies when type is set to LoadBalancer and - externalTrafficPolicy is set to Local. If a value is specified, is - in-range, and is not in use, it will be used. If not specified, a value - will be automatically allocated. External systems (e.g. load-balancers) - can use this port to determine if a given node holds endpoints for this - service or not. If this field is specified when creating a Service - which does not need it, creation will fail. This field will be wiped - when updating a Service to no longer need it (e.g. changing type). - This field cannot be updated once set. - format: int32 - type: integer - internalTrafficPolicy: - description: |- - InternalTrafficPolicy describes how nodes distribute service traffic they - receive on the ClusterIP. If set to "Local", the proxy will assume that pods - only want to talk to endpoints of the service on the same node as the pod, - dropping the traffic if there are no local endpoints. The default value, - "Cluster", uses the standard behavior of routing to all endpoints evenly - (possibly modified by topology and other features). - type: string - ipFamilies: - description: |- - IPFamilies is a list of IP families (e.g. IPv4, IPv6) assigned to this - service. This field is usually assigned automatically based on cluster - configuration and the ipFamilyPolicy field. If this field is specified - manually, the requested family is available in the cluster, - and ipFamilyPolicy allows it, it will be used; otherwise creation of - the service will fail. This field is conditionally mutable: it allows - for adding or removing a secondary IP family, but it does not allow - changing the primary IP family of the Service. Valid values are "IPv4" - and "IPv6". This field only applies to Services of types ClusterIP, - NodePort, and LoadBalancer, and does apply to "headless" services. - This field will be wiped when updating a Service to type ExternalName. - - This field may hold a maximum of two entries (dual-stack families, in - either order). These families must correspond to the values of the - clusterIPs field, if specified. Both clusterIPs and ipFamilies are - governed by the ipFamilyPolicy field. - items: - description: |- - IPFamily represents the IP Family (IPv4 or IPv6). This type is used - to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). - type: string - type: array - x-kubernetes-list-type: atomic - ipFamilyPolicy: - description: |- - IPFamilyPolicy represents the dual-stack-ness requested or required by - this Service. If there is no value provided, then this field will be set - to SingleStack. Services can be "SingleStack" (a single IP family), - "PreferDualStack" (two IP families on dual-stack configured clusters or - a single IP family on single-stack clusters), or "RequireDualStack" - (two IP families on dual-stack configured clusters, otherwise fail). The - ipFamilies and clusterIPs fields depend on the value of this field. This - field will be wiped when updating a service to type ExternalName. - type: string - loadBalancerClass: - description: |- - loadBalancerClass is the class of the load balancer implementation this Service belongs to. - If specified, the value of this field must be a label-style identifier, with an optional prefix, - e.g. "internal-vip" or "example.com/internal-vip". Unprefixed names are reserved for end-users. - This field can only be set when the Service type is 'LoadBalancer'. If not set, the default load - balancer implementation is used, today this is typically done through the cloud provider integration, - but should apply for any default implementation. If set, it is assumed that a load balancer - implementation is watching for Services with a matching class. Any default load balancer - implementation (e.g. cloud providers) should ignore Services that set this field. - This field can only be set when creating or updating a Service to type 'LoadBalancer'. - Once set, it can not be changed. This field will be wiped when a service is updated to a non 'LoadBalancer' type. - type: string - loadBalancerIP: - description: |- - Only applies to Service Type: LoadBalancer. - This feature depends on whether the underlying cloud-provider supports specifying - the loadBalancerIP when a load balancer is created. - This field will be ignored if the cloud-provider does not support the feature. - Deprecated: This field was under-specified and its meaning varies across implementations. - Using it is non-portable and it may not support dual-stack. - Users are encouraged to use implementation-specific annotations when available. - type: string - loadBalancerSourceRanges: - description: |- - If specified and supported by the platform, this will restrict traffic through the cloud-provider - load-balancer will be restricted to the specified client IPs. This field will be ignored if the - cloud-provider does not support the feature." - More info: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/ - items: - type: string - type: array - x-kubernetes-list-type: atomic - ports: - description: |- - The list of ports that are exposed by this service. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - items: - description: ServicePort contains information on service's - port. - properties: - appProtocol: - description: |- - The application protocol for this port. - This is used as a hint for implementations to offer richer behavior for protocols that they understand. - This field follows standard Kubernetes label syntax. - Valid values are either: - - * Un-prefixed protocol names - reserved for IANA standard service names (as per - RFC-6335 and https://www.iana.org/assignments/service-names). - - * Kubernetes-defined prefixed names: - * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- - * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 - * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - - * Other protocols should use implementation-defined prefixed names such as - mycompany.com/my-custom-protocol. - type: string - name: - description: |- - The name of this port within the service. This must be a DNS_LABEL. - All ports within a ServiceSpec must have unique names. When considering - the endpoints for a Service, this must match the 'name' field in the - EndpointPort. - Optional if only one ServicePort is defined on this service. - type: string - nodePort: - description: |- - The port on each node on which this service is exposed when type is - NodePort or LoadBalancer. Usually assigned by the system. If a value is - specified, in-range, and not in use it will be used, otherwise the - operation will fail. If not specified, a port will be allocated if this - Service requires one. If this field is specified when creating a - Service which does not need it, creation will fail. This field will be - wiped when updating a Service to no longer need it (e.g. changing type - from NodePort to ClusterIP). - More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport - format: int32 - type: integer - port: - description: The port that will be exposed by this service. - format: int32 - type: integer - protocol: - default: TCP - description: |- - The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". - Default is TCP. - type: string - targetPort: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the pods targeted by the service. - Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. - If this is a string, it will be looked up as a named port in the - target Pod's container ports. If this is not specified, the value - of the 'port' field is used (an identity map). - This field is ignored for services with clusterIP=None, and should be - omitted or set equal to the 'port' field. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service - x-kubernetes-int-or-string: true - required: - - port - type: object - type: array - x-kubernetes-list-map-keys: - - port - - protocol - x-kubernetes-list-type: map - publishNotReadyAddresses: - description: |- - publishNotReadyAddresses indicates that any agent which deals with endpoints for this - Service should disregard any indications of ready/not-ready. - The primary use case for setting this field is for a StatefulSet's Headless Service to - propagate SRV DNS records for its Pods for the purpose of peer discovery. - The Kubernetes controllers that generate Endpoints and EndpointSlice resources for - Services interpret this to mean that all endpoints are considered "ready" even if the - Pods themselves are not. Agents which consume only Kubernetes generated endpoints - through the Endpoints or EndpointSlice resources can safely assume this behavior. - type: boolean - selector: - additionalProperties: - type: string - description: |- - Route service traffic to pods with label keys and values matching this - selector. If empty or not present, the service is assumed to have an - external process managing its endpoints, which Kubernetes will not - modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. - Ignored if type is ExternalName. - More info: https://kubernetes.io/docs/concepts/services-networking/service/ - type: object - x-kubernetes-map-type: atomic - sessionAffinity: - description: |- - Supports "ClientIP" and "None". Used to maintain session affinity. - Enable client IP based session affinity. - Must be ClientIP or None. - Defaults to None. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - type: string - sessionAffinityConfig: - description: sessionAffinityConfig contains the configurations - of session affinity. - properties: - clientIP: - description: clientIP contains the configurations of Client - IP based session affinity. - properties: - timeoutSeconds: - description: |- - timeoutSeconds specifies the seconds of ClientIP type session sticky time. - The value must be >0 && <=86400(for 1 day) if ServiceAffinity == "ClientIP". - Default value is 10800(for 3 hours). - format: int32 - type: integer - type: object - type: object - trafficDistribution: - description: |- - TrafficDistribution offers a way to express preferences for how traffic - is distributed to Service endpoints. Implementations can use this field - as a hint, but are not required to guarantee strict adherence. If the - field is not set, the implementation will apply its default routing - strategy. If set to "PreferClose", implementations should prioritize - endpoints that are in the same zone. - type: string - type: - description: |- - type determines how the Service is exposed. Defaults to ClusterIP. Valid - options are ExternalName, ClusterIP, NodePort, and LoadBalancer. - "ClusterIP" allocates a cluster-internal IP address for load-balancing - to endpoints. Endpoints are determined by the selector or if that is not - specified, by manual construction of an Endpoints object or - EndpointSlice objects. If clusterIP is "None", no virtual IP is - allocated and the endpoints are published as a set of endpoints rather - than a virtual IP. - "NodePort" builds on ClusterIP and allocates a port on every node which - routes to the same endpoints as the clusterIP. - "LoadBalancer" builds on NodePort and creates an external load-balancer - (if supported in the current cloud) which routes to the same endpoints - as the clusterIP. - "ExternalName" aliases this service to the specified externalName. - Several other fields do not apply to ExternalName services. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types - type: string - type: object - type: object - template: - description: The template of the Pod to be created - properties: - metadata: - description: |- - Standard object's metadata. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - properties: - annotations: - additionalProperties: - type: string - description: |- - Annotations is an unstructured key value map stored with a resource that may be - set by external tools to store and retrieve arbitrary metadata. They are not - queryable and should be preserved when modifying objects. - More info: http://kubernetes.io/docs/user-guide/annotations - type: object - labels: - additionalProperties: - type: string - description: |- - Map of string keys and values that can be used to organize and categorize - (scope and select) objects. May match selectors of replication controllers - and services. - More info: http://kubernetes.io/docs/user-guide/labels - type: object - name: - description: The name of the resource. Only supported for - certain types - type: string - type: object - spec: - description: |- - Specification of the desired behavior of the pod. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - activeDeadlineSeconds: - description: |- - Optional duration in seconds the pod may be active on the node relative to - StartTime before the system will actively try to mark it failed and kill associated containers. - Value must be a positive integer. - format: int64 - type: integer - affinity: - description: If specified, the pod's scheduling constraints - properties: - nodeAffinity: - description: Describes node affinity scheduling rules - for the pod. - properties: - preferredDuringSchedulingIgnoredDuringExecution: - description: |- - The scheduler will prefer to schedule pods to nodes that satisfy - the affinity expressions specified by this field, but it may choose - a node that violates one or more of the expressions. The node that is - most preferred is the one with the greatest sum of weights, i.e. - for each node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling affinity expressions, etc.), - compute a sum by iterating through the elements of this field and adding - "weight" to the sum if the node matches the corresponding matchExpressions; the - node(s) with the highest sum are the most preferred. - items: - description: |- - An empty preferred scheduling term matches all objects with implicit weight 0 - (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). - properties: - preference: - description: A node selector term, associated - with the corresponding weight. - properties: - matchExpressions: - description: A list of node selector requirements - by node's labels. - items: - description: |- - A node selector requirement is a selector that contains values, a key, and an operator - that relates the key and values. - properties: - key: - description: The label key that the - selector applies to. - type: string - operator: - description: |- - Represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: |- - An array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. If the operator is Gt or Lt, the values - array must have a single element, which will be interpreted as an integer. - This array is replaced during a strategic merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchFields: - description: A list of node selector requirements - by node's fields. - items: - description: |- - A node selector requirement is a selector that contains values, a key, and an operator - that relates the key and values. - properties: - key: - description: The label key that the - selector applies to. - type: string - operator: - description: |- - Represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: |- - An array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. If the operator is Gt or Lt, the values - array must have a single element, which will be interpreted as an integer. - This array is replaced during a strategic merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - type: object - x-kubernetes-map-type: atomic - weight: - description: Weight associated with matching - the corresponding nodeSelectorTerm, in the - range 1-100. - format: int32 - type: integer - required: - - preference - - weight - type: object - type: array - x-kubernetes-list-type: atomic - requiredDuringSchedulingIgnoredDuringExecution: - description: |- - If the affinity requirements specified by this field are not met at - scheduling time, the pod will not be scheduled onto the node. - If the affinity requirements specified by this field cease to be met - at some point during pod execution (e.g. due to an update), the system - may or may not try to eventually evict the pod from its node. - properties: - nodeSelectorTerms: - description: Required. A list of node selector - terms. The terms are ORed. - items: - description: |- - A null or empty node selector term matches no objects. The requirements of - them are ANDed. - The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. - properties: - matchExpressions: - description: A list of node selector requirements - by node's labels. - items: - description: |- - A node selector requirement is a selector that contains values, a key, and an operator - that relates the key and values. - properties: - key: - description: The label key that the - selector applies to. - type: string - operator: - description: |- - Represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: |- - An array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. If the operator is Gt or Lt, the values - array must have a single element, which will be interpreted as an integer. - This array is replaced during a strategic merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchFields: - description: A list of node selector requirements - by node's fields. - items: - description: |- - A node selector requirement is a selector that contains values, a key, and an operator - that relates the key and values. - properties: - key: - description: The label key that the - selector applies to. - type: string - operator: - description: |- - Represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: |- - An array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. If the operator is Gt or Lt, the values - array must have a single element, which will be interpreted as an integer. - This array is replaced during a strategic merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - type: object - x-kubernetes-map-type: atomic - type: array - x-kubernetes-list-type: atomic - required: - - nodeSelectorTerms - type: object - x-kubernetes-map-type: atomic - type: object - podAffinity: - description: Describes pod affinity scheduling rules (e.g. - co-locate this pod in the same node, zone, etc. as some - other pod(s)). - properties: - preferredDuringSchedulingIgnoredDuringExecution: - description: |- - The scheduler will prefer to schedule pods to nodes that satisfy - the affinity expressions specified by this field, but it may choose - a node that violates one or more of the expressions. The node that is - most preferred is the one with the greatest sum of weights, i.e. - for each node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling affinity expressions, etc.), - compute a sum by iterating through the elements of this field and adding - "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the - node(s) with the highest sum are the most preferred. - items: - description: The weights of all of the matched WeightedPodAffinityTerm - fields are added per-node to find the most preferred - node(s) - properties: - podAffinityTerm: - description: Required. A pod affinity term, - associated with the corresponding weight. - properties: - labelSelector: - description: |- - A label query over a set of resources, in this case pods. - If it's null, this PodAffinityTerm matches with no Pods. - properties: - matchExpressions: - description: matchExpressions is a list - of label selector requirements. The - requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label - key that the selector applies - to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - matchLabelKeys: - description: |- - MatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both matchLabelKeys and labelSelector. - Also, matchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - mismatchLabelKeys: - description: |- - MismatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. - Also, mismatchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - namespaceSelector: - description: |- - A label query over the set of namespaces that the term applies to. - The term is applied to the union of the namespaces selected by this field - and the ones listed in the namespaces field. - null selector and null or empty namespaces list means "this pod's namespace". - An empty selector ({}) matches all namespaces. - properties: - matchExpressions: - description: matchExpressions is a list - of label selector requirements. The - requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label - key that the selector applies - to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaces: - description: |- - namespaces specifies a static list of namespace names that the term applies to. - The term is applied to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector means "this pod's namespace". - items: - type: string - type: array - x-kubernetes-list-type: atomic - topologyKey: - description: |- - This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where co-located is defined as running on a node - whose value of the label with key topologyKey matches that of any node on which any of the - selected pods is running. - Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - weight: - description: |- - weight associated with matching the corresponding podAffinityTerm, - in the range 1-100. - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - x-kubernetes-list-type: atomic - requiredDuringSchedulingIgnoredDuringExecution: - description: |- - If the affinity requirements specified by this field are not met at - scheduling time, the pod will not be scheduled onto the node. - If the affinity requirements specified by this field cease to be met - at some point during pod execution (e.g. due to a pod label update), the - system may or may not try to eventually evict the pod from its node. - When there are multiple elements, the lists of nodes corresponding to each - podAffinityTerm are intersected, i.e. all terms must be satisfied. - items: - description: |- - Defines a set of pods (namely those matching the labelSelector - relative to the given namespace(s)) that this pod should be - co-located (affinity) or not co-located (anti-affinity) with, - where co-located is defined as running on a node whose value of - the label with key matches that of any node on which - a pod of the set of pods is running - properties: - labelSelector: - description: |- - A label query over a set of resources, in this case pods. - If it's null, this PodAffinityTerm matches with no Pods. - properties: - matchExpressions: - description: matchExpressions is a list - of label selector requirements. The requirements - are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key - that the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - matchLabelKeys: - description: |- - MatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both matchLabelKeys and labelSelector. - Also, matchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - mismatchLabelKeys: - description: |- - MismatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. - Also, mismatchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - namespaceSelector: - description: |- - A label query over the set of namespaces that the term applies to. - The term is applied to the union of the namespaces selected by this field - and the ones listed in the namespaces field. - null selector and null or empty namespaces list means "this pod's namespace". - An empty selector ({}) matches all namespaces. - properties: - matchExpressions: - description: matchExpressions is a list - of label selector requirements. The requirements - are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key - that the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaces: - description: |- - namespaces specifies a static list of namespace names that the term applies to. - The term is applied to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector means "this pod's namespace". - items: - type: string - type: array - x-kubernetes-list-type: atomic - topologyKey: - description: |- - This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where co-located is defined as running on a node - whose value of the label with key topologyKey matches that of any node on which any of the - selected pods is running. - Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - type: array - x-kubernetes-list-type: atomic - type: object - podAntiAffinity: - description: Describes pod anti-affinity scheduling rules - (e.g. avoid putting this pod in the same node, zone, - etc. as some other pod(s)). - properties: - preferredDuringSchedulingIgnoredDuringExecution: - description: |- - The scheduler will prefer to schedule pods to nodes that satisfy - the anti-affinity expressions specified by this field, but it may choose - a node that violates one or more of the expressions. The node that is - most preferred is the one with the greatest sum of weights, i.e. - for each node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling anti-affinity expressions, etc.), - compute a sum by iterating through the elements of this field and subtracting - "weight" from the sum if the node has pods which matches the corresponding podAffinityTerm; the - node(s) with the highest sum are the most preferred. - items: - description: The weights of all of the matched WeightedPodAffinityTerm - fields are added per-node to find the most preferred - node(s) - properties: - podAffinityTerm: - description: Required. A pod affinity term, - associated with the corresponding weight. - properties: - labelSelector: - description: |- - A label query over a set of resources, in this case pods. - If it's null, this PodAffinityTerm matches with no Pods. - properties: - matchExpressions: - description: matchExpressions is a list - of label selector requirements. The - requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label - key that the selector applies - to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - matchLabelKeys: - description: |- - MatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both matchLabelKeys and labelSelector. - Also, matchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - mismatchLabelKeys: - description: |- - MismatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. - Also, mismatchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - namespaceSelector: - description: |- - A label query over the set of namespaces that the term applies to. - The term is applied to the union of the namespaces selected by this field - and the ones listed in the namespaces field. - null selector and null or empty namespaces list means "this pod's namespace". - An empty selector ({}) matches all namespaces. - properties: - matchExpressions: - description: matchExpressions is a list - of label selector requirements. The - requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label - key that the selector applies - to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaces: - description: |- - namespaces specifies a static list of namespace names that the term applies to. - The term is applied to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector means "this pod's namespace". - items: - type: string - type: array - x-kubernetes-list-type: atomic - topologyKey: - description: |- - This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where co-located is defined as running on a node - whose value of the label with key topologyKey matches that of any node on which any of the - selected pods is running. - Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - weight: - description: |- - weight associated with matching the corresponding podAffinityTerm, - in the range 1-100. - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - x-kubernetes-list-type: atomic - requiredDuringSchedulingIgnoredDuringExecution: - description: |- - If the anti-affinity requirements specified by this field are not met at - scheduling time, the pod will not be scheduled onto the node. - If the anti-affinity requirements specified by this field cease to be met - at some point during pod execution (e.g. due to a pod label update), the - system may or may not try to eventually evict the pod from its node. - When there are multiple elements, the lists of nodes corresponding to each - podAffinityTerm are intersected, i.e. all terms must be satisfied. - items: - description: |- - Defines a set of pods (namely those matching the labelSelector - relative to the given namespace(s)) that this pod should be - co-located (affinity) or not co-located (anti-affinity) with, - where co-located is defined as running on a node whose value of - the label with key matches that of any node on which - a pod of the set of pods is running - properties: - labelSelector: - description: |- - A label query over a set of resources, in this case pods. - If it's null, this PodAffinityTerm matches with no Pods. - properties: - matchExpressions: - description: matchExpressions is a list - of label selector requirements. The requirements - are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key - that the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - matchLabelKeys: - description: |- - MatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both matchLabelKeys and labelSelector. - Also, matchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - mismatchLabelKeys: - description: |- - MismatchLabelKeys is a set of pod label keys to select which pods will - be taken into consideration. The keys are used to lookup values from the - incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` - to select the group of existing pods which pods will be taken into consideration - for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming - pod labels will be ignored. The default value is empty. - The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. - Also, mismatchLabelKeys cannot be set when labelSelector isn't set. - items: - type: string - type: array - x-kubernetes-list-type: atomic - namespaceSelector: - description: |- - A label query over the set of namespaces that the term applies to. - The term is applied to the union of the namespaces selected by this field - and the ones listed in the namespaces field. - null selector and null or empty namespaces list means "this pod's namespace". - An empty selector ({}) matches all namespaces. - properties: - matchExpressions: - description: matchExpressions is a list - of label selector requirements. The requirements - are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key - that the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaces: - description: |- - namespaces specifies a static list of namespace names that the term applies to. - The term is applied to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector means "this pod's namespace". - items: - type: string - type: array - x-kubernetes-list-type: atomic - topologyKey: - description: |- - This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where co-located is defined as running on a node - whose value of the label with key topologyKey matches that of any node on which any of the - selected pods is running. - Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - type: array - x-kubernetes-list-type: atomic - type: object - type: object - automountServiceAccountToken: - description: AutomountServiceAccountToken indicates whether - a service account token should be automatically mounted. - type: boolean - containers: - description: |- - List of containers belonging to the pod. - Containers cannot currently be added or removed. - There must be at least one container in a Pod. - Cannot be updated. - items: - description: A single application container that you want - to run within a pod. - properties: - args: - description: |- - Arguments to the entrypoint. - The container image's CMD is used if this is not provided. - Variable references $(VAR_NAME) are expanded using the container's environment. If a variable - cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will - produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless - of whether the variable exists or not. Cannot be updated. - More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell - items: - type: string - type: array - x-kubernetes-list-type: atomic - command: - description: |- - Entrypoint array. Not executed within a shell. - The container image's ENTRYPOINT is used if this is not provided. - Variable references $(VAR_NAME) are expanded using the container's environment. If a variable - cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will - produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless - of whether the variable exists or not. Cannot be updated. - More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell - items: - type: string - type: array - x-kubernetes-list-type: atomic - env: - description: |- - List of environment variables to set in the container. - Cannot be updated. - items: - description: EnvVar represents an environment variable - present in a Container. - properties: - name: - description: |- - Name of the environment variable. - May consist of any printable ASCII characters except '='. - type: string - value: - description: |- - Variable references $(VAR_NAME) are expanded - using the previously defined environment variables in the container and - any service environment variables. If a variable cannot be resolved, - the reference in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. - "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". - Escaped references will never be expanded, regardless of whether the variable - exists or not. - Defaults to "". - type: string - valueFrom: - description: Source for the environment variable's - value. Cannot be used if value is not empty. - properties: - configMapKeyRef: - description: Selects a key of a ConfigMap. - properties: - key: - description: The key to select. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the ConfigMap - or its key must be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - fieldRef: - description: |- - Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, - spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. - properties: - apiVersion: - description: Version of the schema the - FieldPath is written in terms of, defaults - to "v1". - type: string - fieldPath: - description: Path of the field to select - in the specified API version. - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - fileKeyRef: - description: |- - FileKeyRef selects a key of the env file. - Requires the EnvFiles feature gate to be enabled. - properties: - key: - description: |- - The key within the env file. An invalid key will prevent the pod from starting. - The keys defined within a source may consist of any printable ASCII characters except '='. - During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters. - type: string - optional: - default: false - description: |- - Specify whether the file or its key must be defined. If the file or key - does not exist, then the env var is not published. - If optional is set to true and the specified key does not exist, - the environment variable will not be set in the Pod's containers. - - If optional is set to false and the specified key does not exist, - an error will be returned during Pod creation. - type: boolean - path: - description: |- - The path within the volume from which to select the file. - Must be relative and may not contain the '..' path or start with '..'. - type: string - volumeName: - description: The name of the volume mount - containing the env file. - type: string - required: - - key - - path - - volumeName - type: object - x-kubernetes-map-type: atomic - resourceFieldRef: - description: |- - Selects a resource of the container: only resources limits and requests - (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. - properties: - containerName: - description: 'Container name: required - for volumes, optional for env vars' - type: string - divisor: - anyOf: - - type: integer - - type: string - description: Specifies the output format - of the exposed resources, defaults to - "1" - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - description: 'Required: resource to select' - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - secretKeyRef: - description: Selects a key of a secret in - the pod's namespace - properties: - key: - description: The key of the secret to - select from. Must be a valid secret - key. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the Secret - or its key must be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - type: object - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - envFrom: - description: |- - List of sources to populate environment variables in the container. - The keys defined within a source may consist of any printable ASCII characters except '='. - When a key exists in multiple - sources, the value associated with the last source will take precedence. - Values defined by an Env with a duplicate key will take precedence. - Cannot be updated. - items: - description: EnvFromSource represents the source of - a set of ConfigMaps or Secrets - properties: - configMapRef: - description: The ConfigMap to select from - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the ConfigMap - must be defined - type: boolean - type: object - x-kubernetes-map-type: atomic - prefix: - description: |- - Optional text to prepend to the name of each environment variable. - May consist of any printable ASCII characters except '='. - type: string - secretRef: - description: The Secret to select from - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the Secret must - be defined - type: boolean - type: object - x-kubernetes-map-type: atomic - type: object - type: array - x-kubernetes-list-type: atomic - image: - description: |- - Container image name. - More info: https://kubernetes.io/docs/concepts/containers/images - This field is optional to allow higher level config management to default or override - container images in workload controllers like Deployments and StatefulSets. - type: string - imagePullPolicy: - description: |- - Image pull policy. - One of Always, Never, IfNotPresent. - Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. - Cannot be updated. - More info: https://kubernetes.io/docs/concepts/containers/images#updating-images - type: string - lifecycle: - description: |- - Actions that the management system should take in response to container lifecycle events. - Cannot be updated. - properties: - postStart: - description: |- - PostStart is called immediately after a container is created. If the handler fails, - the container is terminated and restarted according to its restart policy. - Other management of the container blocks until the hook completes. - More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the - request. HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP - server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - sleep: - description: Sleep represents a duration that - the container should sleep. - properties: - seconds: - description: Seconds is the number of seconds - to sleep. - format: int64 - type: integer - required: - - seconds - type: object - tcpSocket: - description: |- - Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept - for backward compatibility. There is no validation of this field and - lifecycle hooks will fail at runtime when it is specified. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - preStop: - description: |- - PreStop is called immediately before a container is terminated due to an - API request or management event such as liveness/startup probe failure, - preemption, resource contention, etc. The handler is not called if the - container crashes or exits. The Pod's termination grace period countdown begins before the - PreStop hook is executed. Regardless of the outcome of the handler, the - container will eventually terminate within the Pod's termination grace - period (unless delayed by finalizers). Other management of the container blocks until the hook completes - or until the termination grace period is reached. - More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the - request. HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP - server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - sleep: - description: Sleep represents a duration that - the container should sleep. - properties: - seconds: - description: Seconds is the number of seconds - to sleep. - format: int64 - type: integer - required: - - seconds - type: object - tcpSocket: - description: |- - Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept - for backward compatibility. There is no validation of this field and - lifecycle hooks will fail at runtime when it is specified. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - stopSignal: - description: |- - StopSignal defines which signal will be sent to a container when it is being stopped. - If not specified, the default is defined by the container runtime in use. - StopSignal can only be set for Pods with a non-empty .spec.os.name - type: string - type: object - livenessProbe: - description: |- - Periodic probe of container liveness. - Container will be restarted if the probe fails. - Cannot be updated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - failureThreshold: - description: |- - Minimum consecutive failures for the probe to be considered failed after having succeeded. - Defaults to 3. Minimum value is 1. - format: int32 - type: integer - grpc: - description: GRPC specifies a GRPC HealthCheckRequest. - properties: - port: - description: Port number of the gRPC service. - Number must be in the range 1 to 65535. - format: int32 - type: integer - service: - default: "" - description: |- - Service is the name of the service to place in the gRPC HealthCheckRequest - (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - - If this is not specified, the default behavior is defined by gRPC. - type: string - required: - - port - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the request. - HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - initialDelaySeconds: - description: |- - Number of seconds after the container has started before liveness probes are initiated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - periodSeconds: - description: |- - How often (in seconds) to perform the probe. - Default to 10 seconds. Minimum value is 1. - format: int32 - type: integer - successThreshold: - description: |- - Minimum consecutive successes for the probe to be considered successful after having failed. - Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. - format: int32 - type: integer - tcpSocket: - description: TCPSocket specifies a connection to - a TCP port. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - description: |- - Optional duration in seconds the pod needs to terminate gracefully upon probe failure. - The grace period is the duration in seconds after the processes running in the pod are sent - a termination signal and the time when the processes are forcibly halted with a kill signal. - Set this value longer than the expected cleanup time for your process. - If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this - value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates stop immediately via - the kill signal (no opportunity to shut down). - This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. - format: int64 - type: integer - timeoutSeconds: - description: |- - Number of seconds after which the probe times out. - Defaults to 1 second. Minimum value is 1. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - type: object - name: - description: |- - Name of the container specified as a DNS_LABEL. - Each container in a pod must have a unique name (DNS_LABEL). - Cannot be updated. - type: string - ports: - description: |- - List of ports to expose from the container. Not specifying a port here - DOES NOT prevent that port from being exposed. Any port which is - listening on the default "0.0.0.0" address inside a container will be - accessible from the network. - Modifying this array with strategic merge patch may corrupt the data. - For more information See https://github.com/kubernetes/kubernetes/issues/108255. - Cannot be updated. - items: - description: ContainerPort represents a network port - in a single container. - properties: - containerPort: - description: |- - Number of port to expose on the pod's IP address. - This must be a valid port number, 0 < x < 65536. - format: int32 - type: integer - hostIP: - description: What host IP to bind the external - port to. - type: string - hostPort: - description: |- - Number of port to expose on the host. - If specified, this must be a valid port number, 0 < x < 65536. - If HostNetwork is specified, this must match ContainerPort. - Most containers do not need this. - format: int32 - type: integer - name: - description: |- - If specified, this must be an IANA_SVC_NAME and unique within the pod. Each - named port in a pod must have a unique name. Name for the port that can be - referred to by services. - type: string - protocol: - default: TCP - description: |- - Protocol for port. Must be UDP, TCP, or SCTP. - Defaults to "TCP". - type: string - required: - - containerPort - type: object - type: array - x-kubernetes-list-map-keys: - - containerPort - - protocol - x-kubernetes-list-type: map - readinessProbe: - description: |- - Periodic probe of container service readiness. - Container will be removed from service endpoints if the probe fails. - Cannot be updated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - failureThreshold: - description: |- - Minimum consecutive failures for the probe to be considered failed after having succeeded. - Defaults to 3. Minimum value is 1. - format: int32 - type: integer - grpc: - description: GRPC specifies a GRPC HealthCheckRequest. - properties: - port: - description: Port number of the gRPC service. - Number must be in the range 1 to 65535. - format: int32 - type: integer - service: - default: "" - description: |- - Service is the name of the service to place in the gRPC HealthCheckRequest - (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - - If this is not specified, the default behavior is defined by gRPC. - type: string - required: - - port - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the request. - HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - initialDelaySeconds: - description: |- - Number of seconds after the container has started before liveness probes are initiated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - periodSeconds: - description: |- - How often (in seconds) to perform the probe. - Default to 10 seconds. Minimum value is 1. - format: int32 - type: integer - successThreshold: - description: |- - Minimum consecutive successes for the probe to be considered successful after having failed. - Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. - format: int32 - type: integer - tcpSocket: - description: TCPSocket specifies a connection to - a TCP port. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - description: |- - Optional duration in seconds the pod needs to terminate gracefully upon probe failure. - The grace period is the duration in seconds after the processes running in the pod are sent - a termination signal and the time when the processes are forcibly halted with a kill signal. - Set this value longer than the expected cleanup time for your process. - If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this - value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates stop immediately via - the kill signal (no opportunity to shut down). - This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. - format: int64 - type: integer - timeoutSeconds: - description: |- - Number of seconds after which the probe times out. - Defaults to 1 second. Minimum value is 1. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - type: object - resizePolicy: - description: |- - Resources resize policy for the container. - This field cannot be set on ephemeral containers. - items: - description: ContainerResizePolicy represents resource - resize policy for the container. - properties: - resourceName: - description: |- - Name of the resource to which this resource resize policy applies. - Supported values: cpu, memory. - type: string - restartPolicy: - description: |- - Restart policy to apply when specified resource is resized. - If not specified, it defaults to NotRequired. - type: string - required: - - resourceName - - restartPolicy - type: object - type: array - x-kubernetes-list-type: atomic - resources: - description: |- - Compute Resources required by this container. - Cannot be updated. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - properties: - claims: - description: |- - Claims lists the names of resources, defined in spec.resourceClaims, - that are used by this container. - - This field depends on the - DynamicResourceAllocation feature gate. - - This field is immutable. It can only be set for containers. - items: - description: ResourceClaim references one entry - in PodSpec.ResourceClaims. - properties: - name: - description: |- - Name must match the name of one entry in pod.spec.resourceClaims of - the Pod where this field is used. It makes that resource available - inside a container. - type: string - request: - description: |- - Request is the name chosen for a request in the referenced claim. - If empty, everything from the claim is made available, otherwise - only the result of this request. - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Limits describes the maximum amount of compute resources allowed. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Requests describes the minimum amount of compute resources required. - If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. Requests cannot exceed Limits. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - type: object - restartPolicy: - description: |- - RestartPolicy defines the restart behavior of individual containers in a pod. - This overrides the pod-level restart policy. When this field is not specified, - the restart behavior is defined by the Pod's restart policy and the container type. - Additionally, setting the RestartPolicy as "Always" for the init container will - have the following effect: - this init container will be continually restarted on - exit until all regular containers have terminated. Once all regular - containers have completed, all init containers with restartPolicy "Always" - will be shut down. This lifecycle differs from normal init containers and - is often referred to as a "sidecar" container. Although this init - container still starts in the init container sequence, it does not wait - for the container to complete before proceeding to the next init - container. Instead, the next init container starts immediately after this - init container is started, or after any startupProbe has successfully - completed. - type: string - restartPolicyRules: - description: |- - Represents a list of rules to be checked to determine if the - container should be restarted on exit. The rules are evaluated in - order. Once a rule matches a container exit condition, the remaining - rules are ignored. If no rule matches the container exit condition, - the Container-level restart policy determines the whether the container - is restarted or not. Constraints on the rules: - - At most 20 rules are allowed. - - Rules can have the same action. - - Identical rules are not forbidden in validations. - When rules are specified, container MUST set RestartPolicy explicitly - even it if matches the Pod's RestartPolicy. - items: - description: ContainerRestartRule describes how a - container exit is handled. - properties: - action: - description: |- - Specifies the action taken on a container exit if the requirements - are satisfied. The only possible value is "Restart" to restart the - container. - type: string - exitCodes: - description: Represents the exit codes to check - on container exits. - properties: - operator: - description: |- - Represents the relationship between the container exit code(s) and the - specified values. Possible values are: - - In: the requirement is satisfied if the container exit code is in the - set of specified values. - - NotIn: the requirement is satisfied if the container exit code is - not in the set of specified values. - type: string - values: - description: |- - Specifies the set of values to check for container exit codes. - At most 255 elements are allowed. - items: - format: int32 - type: integer - type: array - x-kubernetes-list-type: set - required: - - operator - type: object - required: - - action - type: object - type: array - x-kubernetes-list-type: atomic - securityContext: - description: |- - SecurityContext defines the security options the container should be run with. - If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. - More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ - properties: - allowPrivilegeEscalation: - description: |- - AllowPrivilegeEscalation controls whether a process can gain more - privileges than its parent process. This bool directly controls if - the no_new_privs flag will be set on the container process. - AllowPrivilegeEscalation is true always when the container is: - 1) run as Privileged - 2) has CAP_SYS_ADMIN - Note that this field cannot be set when spec.os.name is windows. - type: boolean - appArmorProfile: - description: |- - appArmorProfile is the AppArmor options to use by this container. If set, this profile - overrides the pod's appArmorProfile. - Note that this field cannot be set when spec.os.name is windows. - properties: - localhostProfile: - description: |- - localhostProfile indicates a profile loaded on the node that should be used. - The profile must be preconfigured on the node to work. - Must match the loaded name of the profile. - Must be set if and only if type is "Localhost". - type: string - type: - description: |- - type indicates which kind of AppArmor profile will be applied. - Valid options are: - Localhost - a profile pre-loaded on the node. - RuntimeDefault - the container runtime's default profile. - Unconfined - no AppArmor enforcement. - type: string - required: - - type - type: object - capabilities: - description: |- - The capabilities to add/drop when running containers. - Defaults to the default set of capabilities granted by the container runtime. - Note that this field cannot be set when spec.os.name is windows. - properties: - add: - description: Added capabilities - items: - description: Capability represent POSIX capabilities - type - type: string - type: array - x-kubernetes-list-type: atomic - drop: - description: Removed capabilities - items: - description: Capability represent POSIX capabilities - type - type: string - type: array - x-kubernetes-list-type: atomic - type: object - privileged: - description: |- - Run container in privileged mode. - Processes in privileged containers are essentially equivalent to root on the host. - Defaults to false. - Note that this field cannot be set when spec.os.name is windows. - type: boolean - procMount: - description: |- - procMount denotes the type of proc mount to use for the containers. - The default value is Default which uses the container runtime defaults for - readonly paths and masked paths. - Note that this field cannot be set when spec.os.name is windows. - type: string - readOnlyRootFilesystem: - description: |- - Whether this container has a read-only root filesystem. - Default is false. - Note that this field cannot be set when spec.os.name is windows. - type: boolean - runAsGroup: - description: |- - The GID to run the entrypoint of the container process. - Uses runtime default if unset. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is windows. - format: int64 - type: integer - runAsNonRoot: - description: |- - Indicates that the container must run as a non-root user. - If true, the Kubelet will validate the image at runtime to ensure that it - does not run as UID 0 (root) and fail to start the container if it does. - If unset or false, no such validation will be performed. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - type: boolean - runAsUser: - description: |- - The UID to run the entrypoint of the container process. - Defaults to user specified in image metadata if unspecified. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is windows. - format: int64 - type: integer - seLinuxOptions: - description: |- - The SELinux context to be applied to the container. - If unspecified, the container runtime will allocate a random SELinux context for each - container. May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is windows. - properties: - level: - description: Level is SELinux level label that - applies to the container. - type: string - role: - description: Role is a SELinux role label that - applies to the container. - type: string - type: - description: Type is a SELinux type label that - applies to the container. - type: string - user: - description: User is a SELinux user label that - applies to the container. - type: string - type: object - seccompProfile: - description: |- - The seccomp options to use by this container. If seccomp options are - provided at both the pod & container level, the container options - override the pod options. - Note that this field cannot be set when spec.os.name is windows. - properties: - localhostProfile: - description: |- - localhostProfile indicates a profile defined in a file on the node should be used. - The profile must be preconfigured on the node to work. - Must be a descending path, relative to the kubelet's configured seccomp profile location. - Must be set if type is "Localhost". Must NOT be set for any other type. - type: string - type: - description: |- - type indicates which kind of seccomp profile will be applied. - Valid options are: - - Localhost - a profile defined in a file on the node should be used. - RuntimeDefault - the container runtime default profile should be used. - Unconfined - no profile should be applied. - type: string - required: - - type - type: object - windowsOptions: - description: |- - The Windows specific settings applied to all containers. - If unspecified, the options from the PodSecurityContext will be used. - If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is linux. - properties: - gmsaCredentialSpec: - description: |- - GMSACredentialSpec is where the GMSA admission webhook - (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the - GMSA credential spec named by the GMSACredentialSpecName field. - type: string - gmsaCredentialSpecName: - description: GMSACredentialSpecName is the name - of the GMSA credential spec to use. - type: string - hostProcess: - description: |- - HostProcess determines if a container should be run as a 'Host Process' container. - All of a Pod's containers must have the same effective HostProcess value - (it is not allowed to have a mix of HostProcess containers and non-HostProcess containers). - In addition, if HostProcess is true then HostNetwork must also be set to true. - type: boolean - runAsUserName: - description: |- - The UserName in Windows to run the entrypoint of the container process. - Defaults to the user specified in image metadata if unspecified. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - type: string - type: object - type: object - startupProbe: - description: |- - StartupProbe indicates that the Pod has successfully initialized. - If specified, no other probes are executed until this completes successfully. - If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. - This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, - when it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - failureThreshold: - description: |- - Minimum consecutive failures for the probe to be considered failed after having succeeded. - Defaults to 3. Minimum value is 1. - format: int32 - type: integer - grpc: - description: GRPC specifies a GRPC HealthCheckRequest. - properties: - port: - description: Port number of the gRPC service. - Number must be in the range 1 to 65535. - format: int32 - type: integer - service: - default: "" - description: |- - Service is the name of the service to place in the gRPC HealthCheckRequest - (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - - If this is not specified, the default behavior is defined by gRPC. - type: string - required: - - port - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the request. - HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - initialDelaySeconds: - description: |- - Number of seconds after the container has started before liveness probes are initiated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - periodSeconds: - description: |- - How often (in seconds) to perform the probe. - Default to 10 seconds. Minimum value is 1. - format: int32 - type: integer - successThreshold: - description: |- - Minimum consecutive successes for the probe to be considered successful after having failed. - Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. - format: int32 - type: integer - tcpSocket: - description: TCPSocket specifies a connection to - a TCP port. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - description: |- - Optional duration in seconds the pod needs to terminate gracefully upon probe failure. - The grace period is the duration in seconds after the processes running in the pod are sent - a termination signal and the time when the processes are forcibly halted with a kill signal. - Set this value longer than the expected cleanup time for your process. - If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this - value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates stop immediately via - the kill signal (no opportunity to shut down). - This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. - format: int64 - type: integer - timeoutSeconds: - description: |- - Number of seconds after which the probe times out. - Defaults to 1 second. Minimum value is 1. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - type: object - stdin: - description: |- - Whether this container should allocate a buffer for stdin in the container runtime. If this - is not set, reads from stdin in the container will always result in EOF. - Default is false. - type: boolean - stdinOnce: - description: |- - Whether the container runtime should close the stdin channel after it has been opened by - a single attach. When stdin is true the stdin stream will remain open across multiple attach - sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the - first client attaches to stdin, and then remains open and accepts data until the client disconnects, - at which time stdin is closed and remains closed until the container is restarted. If this - flag is false, a container processes that reads from stdin will never receive an EOF. - Default is false - type: boolean - terminationMessagePath: - description: |- - Optional: Path at which the file to which the container's termination message - will be written is mounted into the container's filesystem. - Message written is intended to be brief final status, such as an assertion failure message. - Will be truncated by the node if greater than 4096 bytes. The total message length across - all containers will be limited to 12kb. - Defaults to /dev/termination-log. - Cannot be updated. - type: string - terminationMessagePolicy: - description: |- - Indicate how the termination message should be populated. File will use the contents of - terminationMessagePath to populate the container status message on both success and failure. - FallbackToLogsOnError will use the last chunk of container log output if the termination - message file is empty and the container exited with an error. - The log output is limited to 2048 bytes or 80 lines, whichever is smaller. - Defaults to File. - Cannot be updated. - type: string - tty: - description: |- - Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. - Default is false. - type: boolean - volumeDevices: - description: volumeDevices is the list of block devices - to be used by the container. - items: - description: volumeDevice describes a mapping of a - raw block device within a container. - properties: - devicePath: - description: devicePath is the path inside of - the container that the device will be mapped - to. - type: string - name: - description: name must match the name of a persistentVolumeClaim - in the pod - type: string - required: - - devicePath - - name - type: object - type: array - x-kubernetes-list-map-keys: - - devicePath - x-kubernetes-list-type: map - volumeMounts: - description: |- - Pod volumes to mount into the container's filesystem. - Cannot be updated. - items: - description: VolumeMount describes a mounting of a - Volume within a container. - properties: - mountPath: - description: |- - Path within the container at which the volume should be mounted. Must - not contain ':'. - type: string - mountPropagation: - description: |- - mountPropagation determines how mounts are propagated from the host - to container and the other way around. - When not set, MountPropagationNone is used. - This field is beta in 1.10. - When RecursiveReadOnly is set to IfPossible or to Enabled, MountPropagation must be None or unspecified - (which defaults to None). - type: string - name: - description: This must match the Name of a Volume. - type: string - readOnly: - description: |- - Mounted read-only if true, read-write otherwise (false or unspecified). - Defaults to false. - type: boolean - recursiveReadOnly: - description: |- - RecursiveReadOnly specifies whether read-only mounts should be handled - recursively. - - If ReadOnly is false, this field has no meaning and must be unspecified. - - If ReadOnly is true, and this field is set to Disabled, the mount is not made - recursively read-only. If this field is set to IfPossible, the mount is made - recursively read-only, if it is supported by the container runtime. If this - field is set to Enabled, the mount is made recursively read-only if it is - supported by the container runtime, otherwise the pod will not be started and - an error will be generated to indicate the reason. - - If this field is set to IfPossible or Enabled, MountPropagation must be set to - None (or be unspecified, which defaults to None). - - If this field is not specified, it is treated as an equivalent of Disabled. - type: string - subPath: - description: |- - Path within the volume from which the container's volume should be mounted. - Defaults to "" (volume's root). - type: string - subPathExpr: - description: |- - Expanded path within the volume from which the container's volume should be mounted. - Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. - Defaults to "" (volume's root). - SubPathExpr and SubPath are mutually exclusive. - type: string - required: - - mountPath - - name - type: object - type: array - x-kubernetes-list-map-keys: - - mountPath - x-kubernetes-list-type: map - workingDir: - description: |- - Container's working directory. - If not specified, the container runtime's default will be used, which - might be configured in the container image. - Cannot be updated. - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - dnsConfig: - description: |- - Specifies the DNS parameters of a pod. - Parameters specified here will be merged to the generated DNS - configuration based on DNSPolicy. - properties: - nameservers: - description: |- - A list of DNS name server IP addresses. - This will be appended to the base nameservers generated from DNSPolicy. - Duplicated nameservers will be removed. - items: - type: string - type: array - x-kubernetes-list-type: atomic - options: - description: |- - A list of DNS resolver options. - This will be merged with the base options generated from DNSPolicy. - Duplicated entries will be removed. Resolution options given in Options - will override those that appear in the base DNSPolicy. - items: - description: PodDNSConfigOption defines DNS resolver - options of a pod. - properties: - name: - description: |- - Name is this DNS resolver option's name. - Required. - type: string - value: - description: Value is this DNS resolver option's - value. - type: string - type: object - type: array - x-kubernetes-list-type: atomic - searches: - description: |- - A list of DNS search domains for host-name lookup. - This will be appended to the base search paths generated from DNSPolicy. - Duplicated search paths will be removed. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - dnsPolicy: - description: |- - Set DNS policy for the pod. - Defaults to "ClusterFirst". - Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. - DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. - To have DNS options set along with hostNetwork, you have to specify DNS policy - explicitly to 'ClusterFirstWithHostNet'. - type: string - enableServiceLinks: - description: |- - EnableServiceLinks indicates whether information about services should be injected into pod's - environment variables, matching the syntax of Docker links. - Optional: Defaults to true. - type: boolean - ephemeralContainers: - description: |- - List of ephemeral containers run in this pod. Ephemeral containers may be run in an existing - pod to perform user-initiated actions such as debugging. This list cannot be specified when - creating a pod, and it cannot be modified by updating the pod spec. In order to add an - ephemeral container to an existing pod, use the pod's ephemeralcontainers subresource. - items: - description: |- - An EphemeralContainer is a temporary container that you may add to an existing Pod for - user-initiated activities such as debugging. Ephemeral containers have no resource or - scheduling guarantees, and they will not be restarted when they exit or when a Pod is - removed or restarted. The kubelet may evict a Pod if an ephemeral container causes the - Pod to exceed its resource allocation. - - To add an ephemeral container, use the ephemeralcontainers subresource of an existing - Pod. Ephemeral containers may not be removed or restarted. - properties: - args: - description: |- - Arguments to the entrypoint. - The image's CMD is used if this is not provided. - Variable references $(VAR_NAME) are expanded using the container's environment. If a variable - cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will - produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless - of whether the variable exists or not. Cannot be updated. - More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell - items: - type: string - type: array - x-kubernetes-list-type: atomic - command: - description: |- - Entrypoint array. Not executed within a shell. - The image's ENTRYPOINT is used if this is not provided. - Variable references $(VAR_NAME) are expanded using the container's environment. If a variable - cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will - produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless - of whether the variable exists or not. Cannot be updated. - More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell - items: - type: string - type: array - x-kubernetes-list-type: atomic - env: - description: |- - List of environment variables to set in the container. - Cannot be updated. - items: - description: EnvVar represents an environment variable - present in a Container. - properties: - name: - description: |- - Name of the environment variable. - May consist of any printable ASCII characters except '='. - type: string - value: - description: |- - Variable references $(VAR_NAME) are expanded - using the previously defined environment variables in the container and - any service environment variables. If a variable cannot be resolved, - the reference in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. - "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". - Escaped references will never be expanded, regardless of whether the variable - exists or not. - Defaults to "". - type: string - valueFrom: - description: Source for the environment variable's - value. Cannot be used if value is not empty. - properties: - configMapKeyRef: - description: Selects a key of a ConfigMap. - properties: - key: - description: The key to select. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the ConfigMap - or its key must be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - fieldRef: - description: |- - Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, - spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. - properties: - apiVersion: - description: Version of the schema the - FieldPath is written in terms of, defaults - to "v1". - type: string - fieldPath: - description: Path of the field to select - in the specified API version. - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - fileKeyRef: - description: |- - FileKeyRef selects a key of the env file. - Requires the EnvFiles feature gate to be enabled. - properties: - key: - description: |- - The key within the env file. An invalid key will prevent the pod from starting. - The keys defined within a source may consist of any printable ASCII characters except '='. - During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters. - type: string - optional: - default: false - description: |- - Specify whether the file or its key must be defined. If the file or key - does not exist, then the env var is not published. - If optional is set to true and the specified key does not exist, - the environment variable will not be set in the Pod's containers. - - If optional is set to false and the specified key does not exist, - an error will be returned during Pod creation. - type: boolean - path: - description: |- - The path within the volume from which to select the file. - Must be relative and may not contain the '..' path or start with '..'. - type: string - volumeName: - description: The name of the volume mount - containing the env file. - type: string - required: - - key - - path - - volumeName - type: object - x-kubernetes-map-type: atomic - resourceFieldRef: - description: |- - Selects a resource of the container: only resources limits and requests - (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. - properties: - containerName: - description: 'Container name: required - for volumes, optional for env vars' - type: string - divisor: - anyOf: - - type: integer - - type: string - description: Specifies the output format - of the exposed resources, defaults to - "1" - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - description: 'Required: resource to select' - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - secretKeyRef: - description: Selects a key of a secret in - the pod's namespace - properties: - key: - description: The key of the secret to - select from. Must be a valid secret - key. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the Secret - or its key must be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - type: object - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - envFrom: - description: |- - List of sources to populate environment variables in the container. - The keys defined within a source may consist of any printable ASCII characters except '='. - When a key exists in multiple - sources, the value associated with the last source will take precedence. - Values defined by an Env with a duplicate key will take precedence. - Cannot be updated. - items: - description: EnvFromSource represents the source of - a set of ConfigMaps or Secrets - properties: - configMapRef: - description: The ConfigMap to select from - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the ConfigMap - must be defined - type: boolean - type: object - x-kubernetes-map-type: atomic - prefix: - description: |- - Optional text to prepend to the name of each environment variable. - May consist of any printable ASCII characters except '='. - type: string - secretRef: - description: The Secret to select from - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the Secret must - be defined - type: boolean - type: object - x-kubernetes-map-type: atomic - type: object - type: array - x-kubernetes-list-type: atomic - image: - description: |- - Container image name. - More info: https://kubernetes.io/docs/concepts/containers/images - type: string - imagePullPolicy: - description: |- - Image pull policy. - One of Always, Never, IfNotPresent. - Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. - Cannot be updated. - More info: https://kubernetes.io/docs/concepts/containers/images#updating-images - type: string - lifecycle: - description: Lifecycle is not allowed for ephemeral - containers. - properties: - postStart: - description: |- - PostStart is called immediately after a container is created. If the handler fails, - the container is terminated and restarted according to its restart policy. - Other management of the container blocks until the hook completes. - More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the - request. HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP - server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - sleep: - description: Sleep represents a duration that - the container should sleep. - properties: - seconds: - description: Seconds is the number of seconds - to sleep. - format: int64 - type: integer - required: - - seconds - type: object - tcpSocket: - description: |- - Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept - for backward compatibility. There is no validation of this field and - lifecycle hooks will fail at runtime when it is specified. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - preStop: - description: |- - PreStop is called immediately before a container is terminated due to an - API request or management event such as liveness/startup probe failure, - preemption, resource contention, etc. The handler is not called if the - container crashes or exits. The Pod's termination grace period countdown begins before the - PreStop hook is executed. Regardless of the outcome of the handler, the - container will eventually terminate within the Pod's termination grace - period (unless delayed by finalizers). Other management of the container blocks until the hook completes - or until the termination grace period is reached. - More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the - request. HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP - server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - sleep: - description: Sleep represents a duration that - the container should sleep. - properties: - seconds: - description: Seconds is the number of seconds - to sleep. - format: int64 - type: integer - required: - - seconds - type: object - tcpSocket: - description: |- - Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept - for backward compatibility. There is no validation of this field and - lifecycle hooks will fail at runtime when it is specified. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - stopSignal: - description: |- - StopSignal defines which signal will be sent to a container when it is being stopped. - If not specified, the default is defined by the container runtime in use. - StopSignal can only be set for Pods with a non-empty .spec.os.name - type: string - type: object - livenessProbe: - description: Probes are not allowed for ephemeral containers. - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - failureThreshold: - description: |- - Minimum consecutive failures for the probe to be considered failed after having succeeded. - Defaults to 3. Minimum value is 1. - format: int32 - type: integer - grpc: - description: GRPC specifies a GRPC HealthCheckRequest. - properties: - port: - description: Port number of the gRPC service. - Number must be in the range 1 to 65535. - format: int32 - type: integer - service: - default: "" - description: |- - Service is the name of the service to place in the gRPC HealthCheckRequest - (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - - If this is not specified, the default behavior is defined by gRPC. - type: string - required: - - port - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the request. - HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - initialDelaySeconds: - description: |- - Number of seconds after the container has started before liveness probes are initiated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - periodSeconds: - description: |- - How often (in seconds) to perform the probe. - Default to 10 seconds. Minimum value is 1. - format: int32 - type: integer - successThreshold: - description: |- - Minimum consecutive successes for the probe to be considered successful after having failed. - Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. - format: int32 - type: integer - tcpSocket: - description: TCPSocket specifies a connection to - a TCP port. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - description: |- - Optional duration in seconds the pod needs to terminate gracefully upon probe failure. - The grace period is the duration in seconds after the processes running in the pod are sent - a termination signal and the time when the processes are forcibly halted with a kill signal. - Set this value longer than the expected cleanup time for your process. - If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this - value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates stop immediately via - the kill signal (no opportunity to shut down). - This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. - format: int64 - type: integer - timeoutSeconds: - description: |- - Number of seconds after which the probe times out. - Defaults to 1 second. Minimum value is 1. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - type: object - name: - description: |- - Name of the ephemeral container specified as a DNS_LABEL. - This name must be unique among all containers, init containers and ephemeral containers. - type: string - ports: - description: Ports are not allowed for ephemeral containers. - items: - description: ContainerPort represents a network port - in a single container. - properties: - containerPort: - description: |- - Number of port to expose on the pod's IP address. - This must be a valid port number, 0 < x < 65536. - format: int32 - type: integer - hostIP: - description: What host IP to bind the external - port to. - type: string - hostPort: - description: |- - Number of port to expose on the host. - If specified, this must be a valid port number, 0 < x < 65536. - If HostNetwork is specified, this must match ContainerPort. - Most containers do not need this. - format: int32 - type: integer - name: - description: |- - If specified, this must be an IANA_SVC_NAME and unique within the pod. Each - named port in a pod must have a unique name. Name for the port that can be - referred to by services. - type: string - protocol: - default: TCP - description: |- - Protocol for port. Must be UDP, TCP, or SCTP. - Defaults to "TCP". - type: string - required: - - containerPort - type: object - type: array - x-kubernetes-list-map-keys: - - containerPort - - protocol - x-kubernetes-list-type: map - readinessProbe: - description: Probes are not allowed for ephemeral containers. - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - failureThreshold: - description: |- - Minimum consecutive failures for the probe to be considered failed after having succeeded. - Defaults to 3. Minimum value is 1. - format: int32 - type: integer - grpc: - description: GRPC specifies a GRPC HealthCheckRequest. - properties: - port: - description: Port number of the gRPC service. - Number must be in the range 1 to 65535. - format: int32 - type: integer - service: - default: "" - description: |- - Service is the name of the service to place in the gRPC HealthCheckRequest - (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - - If this is not specified, the default behavior is defined by gRPC. - type: string - required: - - port - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the request. - HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - initialDelaySeconds: - description: |- - Number of seconds after the container has started before liveness probes are initiated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - periodSeconds: - description: |- - How often (in seconds) to perform the probe. - Default to 10 seconds. Minimum value is 1. - format: int32 - type: integer - successThreshold: - description: |- - Minimum consecutive successes for the probe to be considered successful after having failed. - Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. - format: int32 - type: integer - tcpSocket: - description: TCPSocket specifies a connection to - a TCP port. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - description: |- - Optional duration in seconds the pod needs to terminate gracefully upon probe failure. - The grace period is the duration in seconds after the processes running in the pod are sent - a termination signal and the time when the processes are forcibly halted with a kill signal. - Set this value longer than the expected cleanup time for your process. - If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this - value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates stop immediately via - the kill signal (no opportunity to shut down). - This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. - format: int64 - type: integer - timeoutSeconds: - description: |- - Number of seconds after which the probe times out. - Defaults to 1 second. Minimum value is 1. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - type: object - resizePolicy: - description: Resources resize policy for the container. - items: - description: ContainerResizePolicy represents resource - resize policy for the container. - properties: - resourceName: - description: |- - Name of the resource to which this resource resize policy applies. - Supported values: cpu, memory. - type: string - restartPolicy: - description: |- - Restart policy to apply when specified resource is resized. - If not specified, it defaults to NotRequired. - type: string - required: - - resourceName - - restartPolicy - type: object - type: array - x-kubernetes-list-type: atomic - resources: - description: |- - Resources are not allowed for ephemeral containers. Ephemeral containers use spare resources - already allocated to the pod. - properties: - claims: - description: |- - Claims lists the names of resources, defined in spec.resourceClaims, - that are used by this container. - - This field depends on the - DynamicResourceAllocation feature gate. - - This field is immutable. It can only be set for containers. - items: - description: ResourceClaim references one entry - in PodSpec.ResourceClaims. - properties: - name: - description: |- - Name must match the name of one entry in pod.spec.resourceClaims of - the Pod where this field is used. It makes that resource available - inside a container. - type: string - request: - description: |- - Request is the name chosen for a request in the referenced claim. - If empty, everything from the claim is made available, otherwise - only the result of this request. - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Limits describes the maximum amount of compute resources allowed. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Requests describes the minimum amount of compute resources required. - If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. Requests cannot exceed Limits. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - type: object - restartPolicy: - description: |- - Restart policy for the container to manage the restart behavior of each - container within a pod. - You cannot set this field on ephemeral containers. - type: string - restartPolicyRules: - description: |- - Represents a list of rules to be checked to determine if the - container should be restarted on exit. You cannot set this field on - ephemeral containers. - items: - description: ContainerRestartRule describes how a - container exit is handled. - properties: - action: - description: |- - Specifies the action taken on a container exit if the requirements - are satisfied. The only possible value is "Restart" to restart the - container. - type: string - exitCodes: - description: Represents the exit codes to check - on container exits. - properties: - operator: - description: |- - Represents the relationship between the container exit code(s) and the - specified values. Possible values are: - - In: the requirement is satisfied if the container exit code is in the - set of specified values. - - NotIn: the requirement is satisfied if the container exit code is - not in the set of specified values. - type: string - values: - description: |- - Specifies the set of values to check for container exit codes. - At most 255 elements are allowed. - items: - format: int32 - type: integer - type: array - x-kubernetes-list-type: set - required: - - operator - type: object - required: - - action - type: object - type: array - x-kubernetes-list-type: atomic - securityContext: - description: |- - Optional: SecurityContext defines the security options the ephemeral container should be run with. - If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. - properties: - allowPrivilegeEscalation: - description: |- - AllowPrivilegeEscalation controls whether a process can gain more - privileges than its parent process. This bool directly controls if - the no_new_privs flag will be set on the container process. - AllowPrivilegeEscalation is true always when the container is: - 1) run as Privileged - 2) has CAP_SYS_ADMIN - Note that this field cannot be set when spec.os.name is windows. - type: boolean - appArmorProfile: - description: |- - appArmorProfile is the AppArmor options to use by this container. If set, this profile - overrides the pod's appArmorProfile. - Note that this field cannot be set when spec.os.name is windows. - properties: - localhostProfile: - description: |- - localhostProfile indicates a profile loaded on the node that should be used. - The profile must be preconfigured on the node to work. - Must match the loaded name of the profile. - Must be set if and only if type is "Localhost". - type: string - type: - description: |- - type indicates which kind of AppArmor profile will be applied. - Valid options are: - Localhost - a profile pre-loaded on the node. - RuntimeDefault - the container runtime's default profile. - Unconfined - no AppArmor enforcement. - type: string - required: - - type - type: object - capabilities: - description: |- - The capabilities to add/drop when running containers. - Defaults to the default set of capabilities granted by the container runtime. - Note that this field cannot be set when spec.os.name is windows. - properties: - add: - description: Added capabilities - items: - description: Capability represent POSIX capabilities - type - type: string - type: array - x-kubernetes-list-type: atomic - drop: - description: Removed capabilities - items: - description: Capability represent POSIX capabilities - type - type: string - type: array - x-kubernetes-list-type: atomic - type: object - privileged: - description: |- - Run container in privileged mode. - Processes in privileged containers are essentially equivalent to root on the host. - Defaults to false. - Note that this field cannot be set when spec.os.name is windows. - type: boolean - procMount: - description: |- - procMount denotes the type of proc mount to use for the containers. - The default value is Default which uses the container runtime defaults for - readonly paths and masked paths. - Note that this field cannot be set when spec.os.name is windows. - type: string - readOnlyRootFilesystem: - description: |- - Whether this container has a read-only root filesystem. - Default is false. - Note that this field cannot be set when spec.os.name is windows. - type: boolean - runAsGroup: - description: |- - The GID to run the entrypoint of the container process. - Uses runtime default if unset. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is windows. - format: int64 - type: integer - runAsNonRoot: - description: |- - Indicates that the container must run as a non-root user. - If true, the Kubelet will validate the image at runtime to ensure that it - does not run as UID 0 (root) and fail to start the container if it does. - If unset or false, no such validation will be performed. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - type: boolean - runAsUser: - description: |- - The UID to run the entrypoint of the container process. - Defaults to user specified in image metadata if unspecified. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is windows. - format: int64 - type: integer - seLinuxOptions: - description: |- - The SELinux context to be applied to the container. - If unspecified, the container runtime will allocate a random SELinux context for each - container. May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is windows. - properties: - level: - description: Level is SELinux level label that - applies to the container. - type: string - role: - description: Role is a SELinux role label that - applies to the container. - type: string - type: - description: Type is a SELinux type label that - applies to the container. - type: string - user: - description: User is a SELinux user label that - applies to the container. - type: string - type: object - seccompProfile: - description: |- - The seccomp options to use by this container. If seccomp options are - provided at both the pod & container level, the container options - override the pod options. - Note that this field cannot be set when spec.os.name is windows. - properties: - localhostProfile: - description: |- - localhostProfile indicates a profile defined in a file on the node should be used. - The profile must be preconfigured on the node to work. - Must be a descending path, relative to the kubelet's configured seccomp profile location. - Must be set if type is "Localhost". Must NOT be set for any other type. - type: string - type: - description: |- - type indicates which kind of seccomp profile will be applied. - Valid options are: - - Localhost - a profile defined in a file on the node should be used. - RuntimeDefault - the container runtime default profile should be used. - Unconfined - no profile should be applied. - type: string - required: - - type - type: object - windowsOptions: - description: |- - The Windows specific settings applied to all containers. - If unspecified, the options from the PodSecurityContext will be used. - If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is linux. - properties: - gmsaCredentialSpec: - description: |- - GMSACredentialSpec is where the GMSA admission webhook - (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the - GMSA credential spec named by the GMSACredentialSpecName field. - type: string - gmsaCredentialSpecName: - description: GMSACredentialSpecName is the name - of the GMSA credential spec to use. - type: string - hostProcess: - description: |- - HostProcess determines if a container should be run as a 'Host Process' container. - All of a Pod's containers must have the same effective HostProcess value - (it is not allowed to have a mix of HostProcess containers and non-HostProcess containers). - In addition, if HostProcess is true then HostNetwork must also be set to true. - type: boolean - runAsUserName: - description: |- - The UserName in Windows to run the entrypoint of the container process. - Defaults to the user specified in image metadata if unspecified. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - type: string - type: object - type: object - startupProbe: - description: Probes are not allowed for ephemeral containers. - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - failureThreshold: - description: |- - Minimum consecutive failures for the probe to be considered failed after having succeeded. - Defaults to 3. Minimum value is 1. - format: int32 - type: integer - grpc: - description: GRPC specifies a GRPC HealthCheckRequest. - properties: - port: - description: Port number of the gRPC service. - Number must be in the range 1 to 65535. - format: int32 - type: integer - service: - default: "" - description: |- - Service is the name of the service to place in the gRPC HealthCheckRequest - (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - - If this is not specified, the default behavior is defined by gRPC. - type: string - required: - - port - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the request. - HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - initialDelaySeconds: - description: |- - Number of seconds after the container has started before liveness probes are initiated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - periodSeconds: - description: |- - How often (in seconds) to perform the probe. - Default to 10 seconds. Minimum value is 1. - format: int32 - type: integer - successThreshold: - description: |- - Minimum consecutive successes for the probe to be considered successful after having failed. - Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. - format: int32 - type: integer - tcpSocket: - description: TCPSocket specifies a connection to - a TCP port. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - description: |- - Optional duration in seconds the pod needs to terminate gracefully upon probe failure. - The grace period is the duration in seconds after the processes running in the pod are sent - a termination signal and the time when the processes are forcibly halted with a kill signal. - Set this value longer than the expected cleanup time for your process. - If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this - value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates stop immediately via - the kill signal (no opportunity to shut down). - This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. - format: int64 - type: integer - timeoutSeconds: - description: |- - Number of seconds after which the probe times out. - Defaults to 1 second. Minimum value is 1. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - type: object - stdin: - description: |- - Whether this container should allocate a buffer for stdin in the container runtime. If this - is not set, reads from stdin in the container will always result in EOF. - Default is false. - type: boolean - stdinOnce: - description: |- - Whether the container runtime should close the stdin channel after it has been opened by - a single attach. When stdin is true the stdin stream will remain open across multiple attach - sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the - first client attaches to stdin, and then remains open and accepts data until the client disconnects, - at which time stdin is closed and remains closed until the container is restarted. If this - flag is false, a container processes that reads from stdin will never receive an EOF. - Default is false - type: boolean - targetContainerName: - description: |- - If set, the name of the container from PodSpec that this ephemeral container targets. - The ephemeral container will be run in the namespaces (IPC, PID, etc) of this container. - If not set then the ephemeral container uses the namespaces configured in the Pod spec. - - The container runtime must implement support for this feature. If the runtime does not - support namespace targeting then the result of setting this field is undefined. - type: string - terminationMessagePath: - description: |- - Optional: Path at which the file to which the container's termination message - will be written is mounted into the container's filesystem. - Message written is intended to be brief final status, such as an assertion failure message. - Will be truncated by the node if greater than 4096 bytes. The total message length across - all containers will be limited to 12kb. - Defaults to /dev/termination-log. - Cannot be updated. - type: string - terminationMessagePolicy: - description: |- - Indicate how the termination message should be populated. File will use the contents of - terminationMessagePath to populate the container status message on both success and failure. - FallbackToLogsOnError will use the last chunk of container log output if the termination - message file is empty and the container exited with an error. - The log output is limited to 2048 bytes or 80 lines, whichever is smaller. - Defaults to File. - Cannot be updated. - type: string - tty: - description: |- - Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. - Default is false. - type: boolean - volumeDevices: - description: volumeDevices is the list of block devices - to be used by the container. - items: - description: volumeDevice describes a mapping of a - raw block device within a container. - properties: - devicePath: - description: devicePath is the path inside of - the container that the device will be mapped - to. - type: string - name: - description: name must match the name of a persistentVolumeClaim - in the pod - type: string - required: - - devicePath - - name - type: object - type: array - x-kubernetes-list-map-keys: - - devicePath - x-kubernetes-list-type: map - volumeMounts: - description: |- - Pod volumes to mount into the container's filesystem. Subpath mounts are not allowed for ephemeral containers. - Cannot be updated. - items: - description: VolumeMount describes a mounting of a - Volume within a container. - properties: - mountPath: - description: |- - Path within the container at which the volume should be mounted. Must - not contain ':'. - type: string - mountPropagation: - description: |- - mountPropagation determines how mounts are propagated from the host - to container and the other way around. - When not set, MountPropagationNone is used. - This field is beta in 1.10. - When RecursiveReadOnly is set to IfPossible or to Enabled, MountPropagation must be None or unspecified - (which defaults to None). - type: string - name: - description: This must match the Name of a Volume. - type: string - readOnly: - description: |- - Mounted read-only if true, read-write otherwise (false or unspecified). - Defaults to false. - type: boolean - recursiveReadOnly: - description: |- - RecursiveReadOnly specifies whether read-only mounts should be handled - recursively. - - If ReadOnly is false, this field has no meaning and must be unspecified. - - If ReadOnly is true, and this field is set to Disabled, the mount is not made - recursively read-only. If this field is set to IfPossible, the mount is made - recursively read-only, if it is supported by the container runtime. If this - field is set to Enabled, the mount is made recursively read-only if it is - supported by the container runtime, otherwise the pod will not be started and - an error will be generated to indicate the reason. - - If this field is set to IfPossible or Enabled, MountPropagation must be set to - None (or be unspecified, which defaults to None). - - If this field is not specified, it is treated as an equivalent of Disabled. - type: string - subPath: - description: |- - Path within the volume from which the container's volume should be mounted. - Defaults to "" (volume's root). - type: string - subPathExpr: - description: |- - Expanded path within the volume from which the container's volume should be mounted. - Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. - Defaults to "" (volume's root). - SubPathExpr and SubPath are mutually exclusive. - type: string - required: - - mountPath - - name - type: object - type: array - x-kubernetes-list-map-keys: - - mountPath - x-kubernetes-list-type: map - workingDir: - description: |- - Container's working directory. - If not specified, the container runtime's default will be used, which - might be configured in the container image. - Cannot be updated. - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - hostAliases: - description: |- - HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts - file if specified. - items: - description: |- - HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the - pod's hosts file. - properties: - hostnames: - description: Hostnames for the above IP address. - items: - type: string - type: array - x-kubernetes-list-type: atomic - ip: - description: IP address of the host file entry. - type: string - required: - - ip - type: object - type: array - x-kubernetes-list-map-keys: - - ip - x-kubernetes-list-type: map - hostIPC: - description: |- - Use the host's ipc namespace. - Optional: Default to false. - type: boolean - hostNetwork: - description: |- - Host networking requested for this pod. Use the host's network namespace. - When using HostNetwork you should specify ports so the scheduler is aware. - When `hostNetwork` is true, specified `hostPort` fields in port definitions must match `containerPort`, - and unspecified `hostPort` fields in port definitions are defaulted to match `containerPort`. - Default to false. - type: boolean - hostPID: - description: |- - Use the host's pid namespace. - Optional: Default to false. - type: boolean - hostUsers: - description: |- - Use the host's user namespace. - Optional: Default to true. - If set to true or not present, the pod will be run in the host user namespace, useful - for when the pod needs a feature only available to the host user namespace, such as - loading a kernel module with CAP_SYS_MODULE. - When set to false, a new userns is created for the pod. Setting false is useful for - mitigating container breakout vulnerabilities even allowing users to run their - containers as root without actually having root privileges on the host. - type: boolean - hostname: - description: |- - Specifies the hostname of the Pod - If not specified, the pod's hostname will be set to a system-defined value. - type: string - hostnameOverride: - description: |- - HostnameOverride specifies an explicit override for the pod's hostname as perceived by the pod. - This field only specifies the pod's hostname and does not affect its DNS records. - When this field is set to a non-empty string: - - It takes precedence over the values set in `hostname` and `subdomain`. - - The Pod's hostname will be set to this value. - - `setHostnameAsFQDN` must be nil or set to false. - - `hostNetwork` must be set to false. - - This field must be a valid DNS subdomain as defined in RFC 1123 and contain at most 64 characters. - Requires the HostnameOverride feature gate to be enabled. - type: string - imagePullSecrets: - description: |- - ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. - If specified, these secrets will be passed to individual puller implementations for them to use. - More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod - items: - description: |- - LocalObjectReference contains enough information to let you locate the - referenced object inside the same namespace. - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - type: object - x-kubernetes-map-type: atomic - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - initContainers: - description: |- - List of initialization containers belonging to the pod. - Init containers are executed in order prior to containers being started. If any - init container fails, the pod is considered to have failed and is handled according - to its restartPolicy. The name for an init container or normal container must be - unique among all containers. - Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. - The resourceRequirements of an init container are taken into account during scheduling - by finding the highest request/limit for each resource type, and then using the max of - that value or the sum of the normal containers. Limits are applied to init containers - in a similar fashion. - Init containers cannot currently be added or removed. - Cannot be updated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ - items: - description: A single application container that you want - to run within a pod. - properties: - args: - description: |- - Arguments to the entrypoint. - The container image's CMD is used if this is not provided. - Variable references $(VAR_NAME) are expanded using the container's environment. If a variable - cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will - produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless - of whether the variable exists or not. Cannot be updated. - More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell - items: - type: string - type: array - x-kubernetes-list-type: atomic - command: - description: |- - Entrypoint array. Not executed within a shell. - The container image's ENTRYPOINT is used if this is not provided. - Variable references $(VAR_NAME) are expanded using the container's environment. If a variable - cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will - produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless - of whether the variable exists or not. Cannot be updated. - More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell - items: - type: string - type: array - x-kubernetes-list-type: atomic - env: - description: |- - List of environment variables to set in the container. - Cannot be updated. - items: - description: EnvVar represents an environment variable - present in a Container. - properties: - name: - description: |- - Name of the environment variable. - May consist of any printable ASCII characters except '='. - type: string - value: - description: |- - Variable references $(VAR_NAME) are expanded - using the previously defined environment variables in the container and - any service environment variables. If a variable cannot be resolved, - the reference in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. - "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". - Escaped references will never be expanded, regardless of whether the variable - exists or not. - Defaults to "". - type: string - valueFrom: - description: Source for the environment variable's - value. Cannot be used if value is not empty. - properties: - configMapKeyRef: - description: Selects a key of a ConfigMap. - properties: - key: - description: The key to select. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the ConfigMap - or its key must be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - fieldRef: - description: |- - Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, - spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. - properties: - apiVersion: - description: Version of the schema the - FieldPath is written in terms of, defaults - to "v1". - type: string - fieldPath: - description: Path of the field to select - in the specified API version. - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - fileKeyRef: - description: |- - FileKeyRef selects a key of the env file. - Requires the EnvFiles feature gate to be enabled. - properties: - key: - description: |- - The key within the env file. An invalid key will prevent the pod from starting. - The keys defined within a source may consist of any printable ASCII characters except '='. - During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters. - type: string - optional: - default: false - description: |- - Specify whether the file or its key must be defined. If the file or key - does not exist, then the env var is not published. - If optional is set to true and the specified key does not exist, - the environment variable will not be set in the Pod's containers. - - If optional is set to false and the specified key does not exist, - an error will be returned during Pod creation. - type: boolean - path: - description: |- - The path within the volume from which to select the file. - Must be relative and may not contain the '..' path or start with '..'. - type: string - volumeName: - description: The name of the volume mount - containing the env file. - type: string - required: - - key - - path - - volumeName - type: object - x-kubernetes-map-type: atomic - resourceFieldRef: - description: |- - Selects a resource of the container: only resources limits and requests - (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. - properties: - containerName: - description: 'Container name: required - for volumes, optional for env vars' - type: string - divisor: - anyOf: - - type: integer - - type: string - description: Specifies the output format - of the exposed resources, defaults to - "1" - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - description: 'Required: resource to select' - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - secretKeyRef: - description: Selects a key of a secret in - the pod's namespace - properties: - key: - description: The key of the secret to - select from. Must be a valid secret - key. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the Secret - or its key must be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - type: object - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - envFrom: - description: |- - List of sources to populate environment variables in the container. - The keys defined within a source may consist of any printable ASCII characters except '='. - When a key exists in multiple - sources, the value associated with the last source will take precedence. - Values defined by an Env with a duplicate key will take precedence. - Cannot be updated. - items: - description: EnvFromSource represents the source of - a set of ConfigMaps or Secrets - properties: - configMapRef: - description: The ConfigMap to select from - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the ConfigMap - must be defined - type: boolean - type: object - x-kubernetes-map-type: atomic - prefix: - description: |- - Optional text to prepend to the name of each environment variable. - May consist of any printable ASCII characters except '='. - type: string - secretRef: - description: The Secret to select from - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the Secret must - be defined - type: boolean - type: object - x-kubernetes-map-type: atomic - type: object - type: array - x-kubernetes-list-type: atomic - image: - description: |- - Container image name. - More info: https://kubernetes.io/docs/concepts/containers/images - This field is optional to allow higher level config management to default or override - container images in workload controllers like Deployments and StatefulSets. - type: string - imagePullPolicy: - description: |- - Image pull policy. - One of Always, Never, IfNotPresent. - Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. - Cannot be updated. - More info: https://kubernetes.io/docs/concepts/containers/images#updating-images - type: string - lifecycle: - description: |- - Actions that the management system should take in response to container lifecycle events. - Cannot be updated. - properties: - postStart: - description: |- - PostStart is called immediately after a container is created. If the handler fails, - the container is terminated and restarted according to its restart policy. - Other management of the container blocks until the hook completes. - More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the - request. HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP - server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - sleep: - description: Sleep represents a duration that - the container should sleep. - properties: - seconds: - description: Seconds is the number of seconds - to sleep. - format: int64 - type: integer - required: - - seconds - type: object - tcpSocket: - description: |- - Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept - for backward compatibility. There is no validation of this field and - lifecycle hooks will fail at runtime when it is specified. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - preStop: - description: |- - PreStop is called immediately before a container is terminated due to an - API request or management event such as liveness/startup probe failure, - preemption, resource contention, etc. The handler is not called if the - container crashes or exits. The Pod's termination grace period countdown begins before the - PreStop hook is executed. Regardless of the outcome of the handler, the - container will eventually terminate within the Pod's termination grace - period (unless delayed by finalizers). Other management of the container blocks until the hook completes - or until the termination grace period is reached. - More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the - request. HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP - server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - sleep: - description: Sleep represents a duration that - the container should sleep. - properties: - seconds: - description: Seconds is the number of seconds - to sleep. - format: int64 - type: integer - required: - - seconds - type: object - tcpSocket: - description: |- - Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept - for backward compatibility. There is no validation of this field and - lifecycle hooks will fail at runtime when it is specified. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - type: object - stopSignal: - description: |- - StopSignal defines which signal will be sent to a container when it is being stopped. - If not specified, the default is defined by the container runtime in use. - StopSignal can only be set for Pods with a non-empty .spec.os.name - type: string - type: object - livenessProbe: - description: |- - Periodic probe of container liveness. - Container will be restarted if the probe fails. - Cannot be updated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - failureThreshold: - description: |- - Minimum consecutive failures for the probe to be considered failed after having succeeded. - Defaults to 3. Minimum value is 1. - format: int32 - type: integer - grpc: - description: GRPC specifies a GRPC HealthCheckRequest. - properties: - port: - description: Port number of the gRPC service. - Number must be in the range 1 to 65535. - format: int32 - type: integer - service: - default: "" - description: |- - Service is the name of the service to place in the gRPC HealthCheckRequest - (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - - If this is not specified, the default behavior is defined by gRPC. - type: string - required: - - port - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the request. - HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - initialDelaySeconds: - description: |- - Number of seconds after the container has started before liveness probes are initiated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - periodSeconds: - description: |- - How often (in seconds) to perform the probe. - Default to 10 seconds. Minimum value is 1. - format: int32 - type: integer - successThreshold: - description: |- - Minimum consecutive successes for the probe to be considered successful after having failed. - Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. - format: int32 - type: integer - tcpSocket: - description: TCPSocket specifies a connection to - a TCP port. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - description: |- - Optional duration in seconds the pod needs to terminate gracefully upon probe failure. - The grace period is the duration in seconds after the processes running in the pod are sent - a termination signal and the time when the processes are forcibly halted with a kill signal. - Set this value longer than the expected cleanup time for your process. - If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this - value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates stop immediately via - the kill signal (no opportunity to shut down). - This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. - format: int64 - type: integer - timeoutSeconds: - description: |- - Number of seconds after which the probe times out. - Defaults to 1 second. Minimum value is 1. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - type: object - name: - description: |- - Name of the container specified as a DNS_LABEL. - Each container in a pod must have a unique name (DNS_LABEL). - Cannot be updated. - type: string - ports: - description: |- - List of ports to expose from the container. Not specifying a port here - DOES NOT prevent that port from being exposed. Any port which is - listening on the default "0.0.0.0" address inside a container will be - accessible from the network. - Modifying this array with strategic merge patch may corrupt the data. - For more information See https://github.com/kubernetes/kubernetes/issues/108255. - Cannot be updated. - items: - description: ContainerPort represents a network port - in a single container. - properties: - containerPort: - description: |- - Number of port to expose on the pod's IP address. - This must be a valid port number, 0 < x < 65536. - format: int32 - type: integer - hostIP: - description: What host IP to bind the external - port to. - type: string - hostPort: - description: |- - Number of port to expose on the host. - If specified, this must be a valid port number, 0 < x < 65536. - If HostNetwork is specified, this must match ContainerPort. - Most containers do not need this. - format: int32 - type: integer - name: - description: |- - If specified, this must be an IANA_SVC_NAME and unique within the pod. Each - named port in a pod must have a unique name. Name for the port that can be - referred to by services. - type: string - protocol: - default: TCP - description: |- - Protocol for port. Must be UDP, TCP, or SCTP. - Defaults to "TCP". - type: string - required: - - containerPort - type: object - type: array - x-kubernetes-list-map-keys: - - containerPort - - protocol - x-kubernetes-list-type: map - readinessProbe: - description: |- - Periodic probe of container service readiness. - Container will be removed from service endpoints if the probe fails. - Cannot be updated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - failureThreshold: - description: |- - Minimum consecutive failures for the probe to be considered failed after having succeeded. - Defaults to 3. Minimum value is 1. - format: int32 - type: integer - grpc: - description: GRPC specifies a GRPC HealthCheckRequest. - properties: - port: - description: Port number of the gRPC service. - Number must be in the range 1 to 65535. - format: int32 - type: integer - service: - default: "" - description: |- - Service is the name of the service to place in the gRPC HealthCheckRequest - (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - - If this is not specified, the default behavior is defined by gRPC. - type: string - required: - - port - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the request. - HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - initialDelaySeconds: - description: |- - Number of seconds after the container has started before liveness probes are initiated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - periodSeconds: - description: |- - How often (in seconds) to perform the probe. - Default to 10 seconds. Minimum value is 1. - format: int32 - type: integer - successThreshold: - description: |- - Minimum consecutive successes for the probe to be considered successful after having failed. - Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. - format: int32 - type: integer - tcpSocket: - description: TCPSocket specifies a connection to - a TCP port. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - description: |- - Optional duration in seconds the pod needs to terminate gracefully upon probe failure. - The grace period is the duration in seconds after the processes running in the pod are sent - a termination signal and the time when the processes are forcibly halted with a kill signal. - Set this value longer than the expected cleanup time for your process. - If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this - value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates stop immediately via - the kill signal (no opportunity to shut down). - This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. - format: int64 - type: integer - timeoutSeconds: - description: |- - Number of seconds after which the probe times out. - Defaults to 1 second. Minimum value is 1. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - type: object - resizePolicy: - description: |- - Resources resize policy for the container. - This field cannot be set on ephemeral containers. - items: - description: ContainerResizePolicy represents resource - resize policy for the container. - properties: - resourceName: - description: |- - Name of the resource to which this resource resize policy applies. - Supported values: cpu, memory. - type: string - restartPolicy: - description: |- - Restart policy to apply when specified resource is resized. - If not specified, it defaults to NotRequired. - type: string - required: - - resourceName - - restartPolicy - type: object - type: array - x-kubernetes-list-type: atomic - resources: - description: |- - Compute Resources required by this container. - Cannot be updated. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - properties: - claims: - description: |- - Claims lists the names of resources, defined in spec.resourceClaims, - that are used by this container. - - This field depends on the - DynamicResourceAllocation feature gate. - - This field is immutable. It can only be set for containers. - items: - description: ResourceClaim references one entry - in PodSpec.ResourceClaims. - properties: - name: - description: |- - Name must match the name of one entry in pod.spec.resourceClaims of - the Pod where this field is used. It makes that resource available - inside a container. - type: string - request: - description: |- - Request is the name chosen for a request in the referenced claim. - If empty, everything from the claim is made available, otherwise - only the result of this request. - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Limits describes the maximum amount of compute resources allowed. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Requests describes the minimum amount of compute resources required. - If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. Requests cannot exceed Limits. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - type: object - restartPolicy: - description: |- - RestartPolicy defines the restart behavior of individual containers in a pod. - This overrides the pod-level restart policy. When this field is not specified, - the restart behavior is defined by the Pod's restart policy and the container type. - Additionally, setting the RestartPolicy as "Always" for the init container will - have the following effect: - this init container will be continually restarted on - exit until all regular containers have terminated. Once all regular - containers have completed, all init containers with restartPolicy "Always" - will be shut down. This lifecycle differs from normal init containers and - is often referred to as a "sidecar" container. Although this init - container still starts in the init container sequence, it does not wait - for the container to complete before proceeding to the next init - container. Instead, the next init container starts immediately after this - init container is started, or after any startupProbe has successfully - completed. - type: string - restartPolicyRules: - description: |- - Represents a list of rules to be checked to determine if the - container should be restarted on exit. The rules are evaluated in - order. Once a rule matches a container exit condition, the remaining - rules are ignored. If no rule matches the container exit condition, - the Container-level restart policy determines the whether the container - is restarted or not. Constraints on the rules: - - At most 20 rules are allowed. - - Rules can have the same action. - - Identical rules are not forbidden in validations. - When rules are specified, container MUST set RestartPolicy explicitly - even it if matches the Pod's RestartPolicy. - items: - description: ContainerRestartRule describes how a - container exit is handled. - properties: - action: - description: |- - Specifies the action taken on a container exit if the requirements - are satisfied. The only possible value is "Restart" to restart the - container. - type: string - exitCodes: - description: Represents the exit codes to check - on container exits. - properties: - operator: - description: |- - Represents the relationship between the container exit code(s) and the - specified values. Possible values are: - - In: the requirement is satisfied if the container exit code is in the - set of specified values. - - NotIn: the requirement is satisfied if the container exit code is - not in the set of specified values. - type: string - values: - description: |- - Specifies the set of values to check for container exit codes. - At most 255 elements are allowed. - items: - format: int32 - type: integer - type: array - x-kubernetes-list-type: set - required: - - operator - type: object - required: - - action - type: object - type: array - x-kubernetes-list-type: atomic - securityContext: - description: |- - SecurityContext defines the security options the container should be run with. - If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. - More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ - properties: - allowPrivilegeEscalation: - description: |- - AllowPrivilegeEscalation controls whether a process can gain more - privileges than its parent process. This bool directly controls if - the no_new_privs flag will be set on the container process. - AllowPrivilegeEscalation is true always when the container is: - 1) run as Privileged - 2) has CAP_SYS_ADMIN - Note that this field cannot be set when spec.os.name is windows. - type: boolean - appArmorProfile: - description: |- - appArmorProfile is the AppArmor options to use by this container. If set, this profile - overrides the pod's appArmorProfile. - Note that this field cannot be set when spec.os.name is windows. - properties: - localhostProfile: - description: |- - localhostProfile indicates a profile loaded on the node that should be used. - The profile must be preconfigured on the node to work. - Must match the loaded name of the profile. - Must be set if and only if type is "Localhost". - type: string - type: - description: |- - type indicates which kind of AppArmor profile will be applied. - Valid options are: - Localhost - a profile pre-loaded on the node. - RuntimeDefault - the container runtime's default profile. - Unconfined - no AppArmor enforcement. - type: string - required: - - type - type: object - capabilities: - description: |- - The capabilities to add/drop when running containers. - Defaults to the default set of capabilities granted by the container runtime. - Note that this field cannot be set when spec.os.name is windows. - properties: - add: - description: Added capabilities - items: - description: Capability represent POSIX capabilities - type - type: string - type: array - x-kubernetes-list-type: atomic - drop: - description: Removed capabilities - items: - description: Capability represent POSIX capabilities - type - type: string - type: array - x-kubernetes-list-type: atomic - type: object - privileged: - description: |- - Run container in privileged mode. - Processes in privileged containers are essentially equivalent to root on the host. - Defaults to false. - Note that this field cannot be set when spec.os.name is windows. - type: boolean - procMount: - description: |- - procMount denotes the type of proc mount to use for the containers. - The default value is Default which uses the container runtime defaults for - readonly paths and masked paths. - Note that this field cannot be set when spec.os.name is windows. - type: string - readOnlyRootFilesystem: - description: |- - Whether this container has a read-only root filesystem. - Default is false. - Note that this field cannot be set when spec.os.name is windows. - type: boolean - runAsGroup: - description: |- - The GID to run the entrypoint of the container process. - Uses runtime default if unset. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is windows. - format: int64 - type: integer - runAsNonRoot: - description: |- - Indicates that the container must run as a non-root user. - If true, the Kubelet will validate the image at runtime to ensure that it - does not run as UID 0 (root) and fail to start the container if it does. - If unset or false, no such validation will be performed. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - type: boolean - runAsUser: - description: |- - The UID to run the entrypoint of the container process. - Defaults to user specified in image metadata if unspecified. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is windows. - format: int64 - type: integer - seLinuxOptions: - description: |- - The SELinux context to be applied to the container. - If unspecified, the container runtime will allocate a random SELinux context for each - container. May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is windows. - properties: - level: - description: Level is SELinux level label that - applies to the container. - type: string - role: - description: Role is a SELinux role label that - applies to the container. - type: string - type: - description: Type is a SELinux type label that - applies to the container. - type: string - user: - description: User is a SELinux user label that - applies to the container. - type: string - type: object - seccompProfile: - description: |- - The seccomp options to use by this container. If seccomp options are - provided at both the pod & container level, the container options - override the pod options. - Note that this field cannot be set when spec.os.name is windows. - properties: - localhostProfile: - description: |- - localhostProfile indicates a profile defined in a file on the node should be used. - The profile must be preconfigured on the node to work. - Must be a descending path, relative to the kubelet's configured seccomp profile location. - Must be set if type is "Localhost". Must NOT be set for any other type. - type: string - type: - description: |- - type indicates which kind of seccomp profile will be applied. - Valid options are: - - Localhost - a profile defined in a file on the node should be used. - RuntimeDefault - the container runtime default profile should be used. - Unconfined - no profile should be applied. - type: string - required: - - type - type: object - windowsOptions: - description: |- - The Windows specific settings applied to all containers. - If unspecified, the options from the PodSecurityContext will be used. - If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is linux. - properties: - gmsaCredentialSpec: - description: |- - GMSACredentialSpec is where the GMSA admission webhook - (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the - GMSA credential spec named by the GMSACredentialSpecName field. - type: string - gmsaCredentialSpecName: - description: GMSACredentialSpecName is the name - of the GMSA credential spec to use. - type: string - hostProcess: - description: |- - HostProcess determines if a container should be run as a 'Host Process' container. - All of a Pod's containers must have the same effective HostProcess value - (it is not allowed to have a mix of HostProcess containers and non-HostProcess containers). - In addition, if HostProcess is true then HostNetwork must also be set to true. - type: boolean - runAsUserName: - description: |- - The UserName in Windows to run the entrypoint of the container process. - Defaults to the user specified in image metadata if unspecified. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - type: string - type: object - type: object - startupProbe: - description: |- - StartupProbe indicates that the Pod has successfully initialized. - If specified, no other probes are executed until this completes successfully. - If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. - This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, - when it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - properties: - exec: - description: Exec specifies a command to execute - in the container. - properties: - command: - description: |- - Command is the command line to execute inside the container, the working directory for the - command is root ('/') in the container's filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use - a shell, you need to explicitly call out to that shell. - Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - failureThreshold: - description: |- - Minimum consecutive failures for the probe to be considered failed after having succeeded. - Defaults to 3. Minimum value is 1. - format: int32 - type: integer - grpc: - description: GRPC specifies a GRPC HealthCheckRequest. - properties: - port: - description: Port number of the gRPC service. - Number must be in the range 1 to 65535. - format: int32 - type: integer - service: - default: "" - description: |- - Service is the name of the service to place in the gRPC HealthCheckRequest - (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - - If this is not specified, the default behavior is defined by gRPC. - type: string - required: - - port - type: object - httpGet: - description: HTTPGet specifies an HTTP GET request - to perform. - properties: - host: - description: |- - Host name to connect to, defaults to the pod IP. You probably want to set - "Host" in httpHeaders instead. - type: string - httpHeaders: - description: Custom headers to set in the request. - HTTP allows repeated headers. - items: - description: HTTPHeader describes a custom - header to be used in HTTP probes - properties: - name: - description: |- - The header field name. - This will be canonicalized upon output, so case-variant names will be understood as the same header. - type: string - value: - description: The header field value - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - path: - description: Path to access on the HTTP server. - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Name or number of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - scheme: - description: |- - Scheme to use for connecting to the host. - Defaults to HTTP. - type: string - required: - - port - type: object - initialDelaySeconds: - description: |- - Number of seconds after the container has started before liveness probes are initiated. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - periodSeconds: - description: |- - How often (in seconds) to perform the probe. - Default to 10 seconds. Minimum value is 1. - format: int32 - type: integer - successThreshold: - description: |- - Minimum consecutive successes for the probe to be considered successful after having failed. - Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. - format: int32 - type: integer - tcpSocket: - description: TCPSocket specifies a connection to - a TCP port. - properties: - host: - description: 'Optional: Host name to connect - to, defaults to the pod IP.' - type: string - port: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the container. - Number must be in the range 1 to 65535. - Name must be an IANA_SVC_NAME. - x-kubernetes-int-or-string: true - required: - - port - type: object - terminationGracePeriodSeconds: - description: |- - Optional duration in seconds the pod needs to terminate gracefully upon probe failure. - The grace period is the duration in seconds after the processes running in the pod are sent - a termination signal and the time when the processes are forcibly halted with a kill signal. - Set this value longer than the expected cleanup time for your process. - If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this - value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates stop immediately via - the kill signal (no opportunity to shut down). - This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. - format: int64 - type: integer - timeoutSeconds: - description: |- - Number of seconds after which the probe times out. - Defaults to 1 second. Minimum value is 1. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - format: int32 - type: integer - type: object - stdin: - description: |- - Whether this container should allocate a buffer for stdin in the container runtime. If this - is not set, reads from stdin in the container will always result in EOF. - Default is false. - type: boolean - stdinOnce: - description: |- - Whether the container runtime should close the stdin channel after it has been opened by - a single attach. When stdin is true the stdin stream will remain open across multiple attach - sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the - first client attaches to stdin, and then remains open and accepts data until the client disconnects, - at which time stdin is closed and remains closed until the container is restarted. If this - flag is false, a container processes that reads from stdin will never receive an EOF. - Default is false - type: boolean - terminationMessagePath: - description: |- - Optional: Path at which the file to which the container's termination message - will be written is mounted into the container's filesystem. - Message written is intended to be brief final status, such as an assertion failure message. - Will be truncated by the node if greater than 4096 bytes. The total message length across - all containers will be limited to 12kb. - Defaults to /dev/termination-log. - Cannot be updated. - type: string - terminationMessagePolicy: - description: |- - Indicate how the termination message should be populated. File will use the contents of - terminationMessagePath to populate the container status message on both success and failure. - FallbackToLogsOnError will use the last chunk of container log output if the termination - message file is empty and the container exited with an error. - The log output is limited to 2048 bytes or 80 lines, whichever is smaller. - Defaults to File. - Cannot be updated. - type: string - tty: - description: |- - Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. - Default is false. - type: boolean - volumeDevices: - description: volumeDevices is the list of block devices - to be used by the container. - items: - description: volumeDevice describes a mapping of a - raw block device within a container. - properties: - devicePath: - description: devicePath is the path inside of - the container that the device will be mapped - to. - type: string - name: - description: name must match the name of a persistentVolumeClaim - in the pod - type: string - required: - - devicePath - - name - type: object - type: array - x-kubernetes-list-map-keys: - - devicePath - x-kubernetes-list-type: map - volumeMounts: - description: |- - Pod volumes to mount into the container's filesystem. - Cannot be updated. - items: - description: VolumeMount describes a mounting of a - Volume within a container. - properties: - mountPath: - description: |- - Path within the container at which the volume should be mounted. Must - not contain ':'. - type: string - mountPropagation: - description: |- - mountPropagation determines how mounts are propagated from the host - to container and the other way around. - When not set, MountPropagationNone is used. - This field is beta in 1.10. - When RecursiveReadOnly is set to IfPossible or to Enabled, MountPropagation must be None or unspecified - (which defaults to None). - type: string - name: - description: This must match the Name of a Volume. - type: string - readOnly: - description: |- - Mounted read-only if true, read-write otherwise (false or unspecified). - Defaults to false. - type: boolean - recursiveReadOnly: - description: |- - RecursiveReadOnly specifies whether read-only mounts should be handled - recursively. - - If ReadOnly is false, this field has no meaning and must be unspecified. - - If ReadOnly is true, and this field is set to Disabled, the mount is not made - recursively read-only. If this field is set to IfPossible, the mount is made - recursively read-only, if it is supported by the container runtime. If this - field is set to Enabled, the mount is made recursively read-only if it is - supported by the container runtime, otherwise the pod will not be started and - an error will be generated to indicate the reason. - - If this field is set to IfPossible or Enabled, MountPropagation must be set to - None (or be unspecified, which defaults to None). - - If this field is not specified, it is treated as an equivalent of Disabled. - type: string - subPath: - description: |- - Path within the volume from which the container's volume should be mounted. - Defaults to "" (volume's root). - type: string - subPathExpr: - description: |- - Expanded path within the volume from which the container's volume should be mounted. - Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. - Defaults to "" (volume's root). - SubPathExpr and SubPath are mutually exclusive. - type: string - required: - - mountPath - - name - type: object - type: array - x-kubernetes-list-map-keys: - - mountPath - x-kubernetes-list-type: map - workingDir: - description: |- - Container's working directory. - If not specified, the container runtime's default will be used, which - might be configured in the container image. - Cannot be updated. - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - nodeName: - description: |- - NodeName indicates in which node this pod is scheduled. - If empty, this pod is a candidate for scheduling by the scheduler defined in schedulerName. - Once this field is set, the kubelet for this node becomes responsible for the lifecycle of this pod. - This field should not be used to express a desire for the pod to be scheduled on a specific node. - https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodename - type: string - nodeSelector: - additionalProperties: - type: string - description: |- - NodeSelector is a selector which must be true for the pod to fit on a node. - Selector which must match a node's labels for the pod to be scheduled on that node. - More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ - type: object - x-kubernetes-map-type: atomic - os: - description: |- - Specifies the OS of the containers in the pod. - Some pod and container fields are restricted if this is set. - - If the OS field is set to linux, the following fields must be unset: - -securityContext.windowsOptions - - If the OS field is set to windows, following fields must be unset: - - spec.hostPID - - spec.hostIPC - - spec.hostUsers - - spec.resources - - spec.securityContext.appArmorProfile - - spec.securityContext.seLinuxOptions - - spec.securityContext.seccompProfile - - spec.securityContext.fsGroup - - spec.securityContext.fsGroupChangePolicy - - spec.securityContext.sysctls - - spec.shareProcessNamespace - - spec.securityContext.runAsUser - - spec.securityContext.runAsGroup - - spec.securityContext.supplementalGroups - - spec.securityContext.supplementalGroupsPolicy - - spec.containers[*].securityContext.appArmorProfile - - spec.containers[*].securityContext.seLinuxOptions - - spec.containers[*].securityContext.seccompProfile - - spec.containers[*].securityContext.capabilities - - spec.containers[*].securityContext.readOnlyRootFilesystem - - spec.containers[*].securityContext.privileged - - spec.containers[*].securityContext.allowPrivilegeEscalation - - spec.containers[*].securityContext.procMount - - spec.containers[*].securityContext.runAsUser - - spec.containers[*].securityContext.runAsGroup - properties: - name: - description: |- - Name is the name of the operating system. The currently supported values are linux and windows. - Additional value may be defined in future and can be one of: - https://github.com/opencontainers/runtime-spec/blob/master/config.md#platform-specific-configuration - Clients should expect to handle additional values and treat unrecognized values in this field as os: null - type: string - required: - - name - type: object - overhead: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. - This field will be autopopulated at admission time by the RuntimeClass admission controller. If - the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. - The RuntimeClass admission controller will reject Pod create requests which have the overhead already - set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value - defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. - More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md - type: object - preemptionPolicy: - description: |- - PreemptionPolicy is the Policy for preempting pods with lower priority. - One of Never, PreemptLowerPriority. - Defaults to PreemptLowerPriority if unset. - type: string - priority: - description: |- - The priority value. Various system components use this field to find the - priority of the pod. When Priority Admission Controller is enabled, it - prevents users from setting this field. The admission controller populates - this field from PriorityClassName. - The higher the value, the higher the priority. - format: int32 - type: integer - priorityClassName: - description: |- - If specified, indicates the pod's priority. "system-node-critical" and - "system-cluster-critical" are two special keywords which indicate the - highest priorities with the former being the highest priority. Any other - name must be defined by creating a PriorityClass object with that name. - If not specified, the pod priority will be default or zero if there is no - default. - type: string - readinessGates: - description: |- - If specified, all readiness gates will be evaluated for pod readiness. - A pod is ready when all its containers are ready AND - all conditions specified in the readiness gates have status equal to "True" - More info: https://git.k8s.io/enhancements/keps/sig-network/580-pod-readiness-gates - items: - description: PodReadinessGate contains the reference to - a pod condition - properties: - conditionType: - description: ConditionType refers to a condition in - the pod's condition list with matching type. - type: string - required: - - conditionType - type: object - type: array - x-kubernetes-list-type: atomic - resourceClaims: - description: |- - ResourceClaims defines which ResourceClaims must be allocated - and reserved before the Pod is allowed to start. The resources - will be made available to those containers which consume them - by name. - - This is a stable field but requires that the - DynamicResourceAllocation feature gate is enabled. - - This field is immutable. - items: - description: |- - PodResourceClaim references exactly one ResourceClaim, either directly - or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim - for the pod. - - It adds a name to it that uniquely identifies the ResourceClaim inside the Pod. - Containers that need access to the ResourceClaim reference it with this name. - - When the DRAWorkloadResourceClaims feature gate is enabled and this Pod - belongs to a PodGroup, a PodResourceClaim is matched to a - PodGroupResourceClaim if all of their fields are equal (Name, - ResourceClaimName, and ResourceClaimTemplateName). A matched claim references - a single ResourceClaim shared across all Pods in the PodGroup, reserved for - the PodGroup in ResourceClaimStatus.ReservedFor rather than for individual - Pods. - properties: - name: - description: |- - Name uniquely identifies this resource claim inside the pod. - This must be a DNS_LABEL. - type: string - resourceClaimName: - description: |- - ResourceClaimName is the name of a ResourceClaim object in the same - namespace as this pod. - - Exactly one of ResourceClaimName and ResourceClaimTemplateName must - be set. - type: string - resourceClaimTemplateName: - description: |- - ResourceClaimTemplateName is the name of a ResourceClaimTemplate - object in the same namespace as this pod. - - The template will be used to create a new ResourceClaim, which will - be bound to this pod. When this pod is deleted, the ResourceClaim - will also be deleted. The pod name and resource name, along with a - generated component, will be used to form a unique name for the - ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses. - - When the DRAWorkloadResourceClaims feature gate is enabled and the pod - belongs to a PodGroup that defines a PodGroupResourceClaim with the same - Name and ResourceClaimTemplateName, this PodResourceClaim resolves to the - ResourceClaim generated for the PodGroup. All pods in the group that - define an equivalent PodResourceClaim matching the - PodGroupResourceClaim's Name and ResourceClaimTemplateName share the same - generated ResourceClaim. ResourceClaims generated for a PodGroup are - owned by the PodGroup and their lifecycles are tied to the PodGroup - instead of any individual pod. - - This field is immutable and no changes will be made to the - corresponding ResourceClaim by the control plane after creating the - ResourceClaim. - - Exactly one of ResourceClaimName and ResourceClaimTemplateName must - be set. - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - resources: - description: |- - Resources is the total amount of CPU and Memory resources required by all - containers in the pod. It supports specifying Requests and Limits for - "cpu", "memory" and "hugepages-" resource names only. ResourceClaims are not supported. - - This field enables fine-grained control over resource allocation for the - entire pod, allowing resource sharing among containers in a pod. - - This is an alpha field and requires enabling the PodLevelResources feature - gate. - properties: - claims: - description: |- - Claims lists the names of resources, defined in spec.resourceClaims, - that are used by this container. - - This field depends on the - DynamicResourceAllocation feature gate. - - This field is immutable. It can only be set for containers. - items: - description: ResourceClaim references one entry in PodSpec.ResourceClaims. - properties: - name: - description: |- - Name must match the name of one entry in pod.spec.resourceClaims of - the Pod where this field is used. It makes that resource available - inside a container. - type: string - request: - description: |- - Request is the name chosen for a request in the referenced claim. - If empty, everything from the claim is made available, otherwise - only the result of this request. - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Limits describes the maximum amount of compute resources allowed. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Requests describes the minimum amount of compute resources required. - If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. Requests cannot exceed Limits. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - type: object - restartPolicy: - description: |- - Restart policy for all containers within the pod. - One of Always, OnFailure, Never. In some contexts, only a subset of those values may be permitted. - Default to Always. - More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy - type: string - runtimeClassName: - description: |- - RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used - to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. - If unset or empty, the "legacy" RuntimeClass will be used, which is an implicit class with an - empty definition that uses the default runtime handler. - More info: https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class - type: string - schedulerName: - description: |- - If specified, the pod will be dispatched by specified scheduler. - If not specified, the pod will be dispatched by default scheduler. - type: string - schedulingGates: - description: |- - SchedulingGates is an opaque list of values that if specified will block scheduling the pod. - If schedulingGates is not empty, the pod will stay in the SchedulingGated state and the - scheduler will not attempt to schedule the pod. - - SchedulingGates can only be set at pod creation time, and be removed only afterwards. - items: - description: PodSchedulingGate is associated to a Pod to - guard its scheduling. - properties: - name: - description: |- - Name of the scheduling gate. - Each scheduling gate must have a unique name field. - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - schedulingGroup: - description: |- - SchedulingGroup provides a reference to the immediate scheduling runtime - grouping object that this Pod belongs to. - This field is used by the scheduler to identify the group and apply the - correct group scheduling policies. The association with a group also - impacts other lifecycle aspects of a Pod that are relevant in a wider context - of scheduling like preemption, resource attachment, etc. If not specified, - the Pod is treated as a single unit in all of these aspects. - The group object referenced by this field may not exist at the time the - Pod is created. - This field is immutable, but a group object with the same name may be - recreated with different policies. Doing this during pod scheduling - may result in the placement not conforming to the expected policies. - properties: - podGroupName: - description: |- - PodGroupName specifies the name of the standalone PodGroup object - that represents the runtime instance of this group. - Must be a DNS subdomain. - type: string - type: object - securityContext: - description: |- - SecurityContext holds pod-level security attributes and common container settings. - Optional: Defaults to empty. See type description for default values of each field. - properties: - appArmorProfile: - description: |- - appArmorProfile is the AppArmor options to use by the containers in this pod. - Note that this field cannot be set when spec.os.name is windows. - properties: - localhostProfile: - description: |- - localhostProfile indicates a profile loaded on the node that should be used. - The profile must be preconfigured on the node to work. - Must match the loaded name of the profile. - Must be set if and only if type is "Localhost". - type: string - type: - description: |- - type indicates which kind of AppArmor profile will be applied. - Valid options are: - Localhost - a profile pre-loaded on the node. - RuntimeDefault - the container runtime's default profile. - Unconfined - no AppArmor enforcement. - type: string - required: - - type - type: object - fsGroup: - description: |- - A special supplemental group that applies to all containers in a pod. - Some volume types allow the Kubelet to change the ownership of that volume - to be owned by the pod: - - 1. The owning GID will be the FSGroup - 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) - 3. The permission bits are OR'd with rw-rw---- - - If unset, the Kubelet will not modify the ownership and permissions of any volume. - Note that this field cannot be set when spec.os.name is windows. - format: int64 - type: integer - fsGroupChangePolicy: - description: |- - fsGroupChangePolicy defines behavior of changing ownership and permission of the volume - before being exposed inside Pod. This field will only apply to - volume types which support fsGroup based ownership(and permissions). - It will have no effect on ephemeral volume types such as: secret, configmaps - and emptydir. - Valid values are "OnRootMismatch" and "Always". If not specified, "Always" is used. - Note that this field cannot be set when spec.os.name is windows. - type: string - runAsGroup: - description: |- - The GID to run the entrypoint of the container process. - Uses runtime default if unset. - May also be set in SecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence - for that container. - Note that this field cannot be set when spec.os.name is windows. - format: int64 - type: integer - runAsNonRoot: - description: |- - Indicates that the container must run as a non-root user. - If true, the Kubelet will validate the image at runtime to ensure that it - does not run as UID 0 (root) and fail to start the container if it does. - If unset or false, no such validation will be performed. - May also be set in SecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - type: boolean - runAsUser: - description: |- - The UID to run the entrypoint of the container process. - Defaults to user specified in image metadata if unspecified. - May also be set in SecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence - for that container. - Note that this field cannot be set when spec.os.name is windows. - format: int64 - type: integer - seLinuxChangePolicy: - description: |- - seLinuxChangePolicy defines how the container's SELinux label is applied to all volumes used by the Pod. - It has no effect on nodes that do not support SELinux or to volumes does not support SELinux. - Valid values are "MountOption" and "Recursive". - - "Recursive" means relabeling of all files on all Pod volumes by the container runtime. - This may be slow for large volumes, but allows mixing privileged and unprivileged Pods sharing the same volume on the same node. - - "MountOption" mounts all eligible Pod volumes with `-o context` mount option. - This requires all Pods that share the same volume to use the same SELinux label. - It is not possible to share the same volume among privileged and unprivileged Pods. - Eligible volumes are in-tree FibreChannel and iSCSI volumes, and all CSI volumes - whose CSI driver announces SELinux support by setting spec.seLinuxMount: true in their - CSIDriver instance. Other volumes are always re-labelled recursively. - "MountOption" value is allowed only when SELinuxMount feature gate is enabled. - - If not specified and SELinuxMount feature gate is enabled, "MountOption" is used. - If not specified and SELinuxMount feature gate is disabled, "MountOption" is used for ReadWriteOncePod volumes - and "Recursive" for all other volumes. - - This field affects only Pods that have SELinux label set, either in PodSecurityContext or in SecurityContext of all containers. - - All Pods that use the same volume should use the same seLinuxChangePolicy, otherwise some pods can get stuck in ContainerCreating state. - Note that this field cannot be set when spec.os.name is windows. - type: string - seLinuxOptions: - description: |- - The SELinux context to be applied to all containers. - If unspecified, the container runtime will allocate a random SELinux context for each - container. May also be set in SecurityContext. If set in - both SecurityContext and PodSecurityContext, the value specified in SecurityContext - takes precedence for that container. - Note that this field cannot be set when spec.os.name is windows. - properties: - level: - description: Level is SELinux level label that applies - to the container. - type: string - role: - description: Role is a SELinux role label that applies - to the container. - type: string - type: - description: Type is a SELinux type label that applies - to the container. - type: string - user: - description: User is a SELinux user label that applies - to the container. - type: string - type: object - seccompProfile: - description: |- - The seccomp options to use by the containers in this pod. - Note that this field cannot be set when spec.os.name is windows. - properties: - localhostProfile: - description: |- - localhostProfile indicates a profile defined in a file on the node should be used. - The profile must be preconfigured on the node to work. - Must be a descending path, relative to the kubelet's configured seccomp profile location. - Must be set if type is "Localhost". Must NOT be set for any other type. - type: string - type: - description: |- - type indicates which kind of seccomp profile will be applied. - Valid options are: - - Localhost - a profile defined in a file on the node should be used. - RuntimeDefault - the container runtime default profile should be used. - Unconfined - no profile should be applied. - type: string - required: - - type - type: object - supplementalGroups: - description: |- - A list of groups applied to the first process run in each container, in - addition to the container's primary GID and fsGroup (if specified). If - the SupplementalGroupsPolicy feature is enabled, the - supplementalGroupsPolicy field determines whether these are in addition - to or instead of any group memberships defined in the container image. - If unspecified, no additional groups are added, though group memberships - defined in the container image may still be used, depending on the - supplementalGroupsPolicy field. - Note that this field cannot be set when spec.os.name is windows. - items: - format: int64 - type: integer - type: array - x-kubernetes-list-type: atomic - supplementalGroupsPolicy: - description: |- - Defines how supplemental groups of the first container processes are calculated. - Valid values are "Merge" and "Strict". If not specified, "Merge" is used. - (Alpha) Using the field requires the SupplementalGroupsPolicy feature gate to be enabled - and the container runtime must implement support for this feature. - Note that this field cannot be set when spec.os.name is windows. - type: string - sysctls: - description: |- - Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported - sysctls (by the container runtime) might fail to launch. - Note that this field cannot be set when spec.os.name is windows. - items: - description: Sysctl defines a kernel parameter to be - set - properties: - name: - description: Name of a property to set - type: string - value: - description: Value of a property to set - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - windowsOptions: - description: |- - The Windows specific settings applied to all containers. - If unspecified, the options within a container's SecurityContext will be used. - If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is linux. - properties: - gmsaCredentialSpec: - description: |- - GMSACredentialSpec is where the GMSA admission webhook - (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the - GMSA credential spec named by the GMSACredentialSpecName field. - type: string - gmsaCredentialSpecName: - description: GMSACredentialSpecName is the name of - the GMSA credential spec to use. - type: string - hostProcess: - description: |- - HostProcess determines if a container should be run as a 'Host Process' container. - All of a Pod's containers must have the same effective HostProcess value - (it is not allowed to have a mix of HostProcess containers and non-HostProcess containers). - In addition, if HostProcess is true then HostNetwork must also be set to true. - type: boolean - runAsUserName: - description: |- - The UserName in Windows to run the entrypoint of the container process. - Defaults to the user specified in image metadata if unspecified. - May also be set in PodSecurityContext. If set in both SecurityContext and - PodSecurityContext, the value specified in SecurityContext takes precedence. - type: string - type: object - type: object - serviceAccount: - description: |- - DeprecatedServiceAccount is a deprecated alias for ServiceAccountName. - Deprecated: Use serviceAccountName instead. - type: string - serviceAccountName: - description: |- - ServiceAccountName is the name of the ServiceAccount to use to run this pod. - More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ - type: string - setHostnameAsFQDN: - description: |- - If true the pod's hostname will be configured as the pod's FQDN, rather than the leaf name (the default). - In Linux containers, this means setting the FQDN in the hostname field of the kernel (the nodename field of struct utsname). - In Windows containers, this means setting the registry value of hostname for the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters to FQDN. - If a pod does not have FQDN, this has no effect. - Default to false. - type: boolean - shareProcessNamespace: - description: |- - Share a single process namespace between all of the containers in a pod. - When this is set containers will be able to view and signal processes from other containers - in the same pod, and the first process in each container will not be assigned PID 1. - HostPID and ShareProcessNamespace cannot both be set. - Optional: Default to false. - type: boolean - subdomain: - description: |- - If specified, the fully qualified Pod hostname will be "...svc.". - If not specified, the pod will not have a domainname at all. - type: string - terminationGracePeriodSeconds: - description: |- - Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. - Value must be non-negative integer. The value zero indicates stop immediately via - the kill signal (no opportunity to shut down). - If this value is nil, the default grace period will be used instead. - The grace period is the duration in seconds after the processes running in the pod are sent - a termination signal and the time when the processes are forcibly halted with a kill signal. - Set this value longer than the expected cleanup time for your process. - Defaults to 30 seconds. - format: int64 - type: integer - tolerations: - description: If specified, the pod's tolerations. - items: - description: |- - The pod this Toleration is attached to tolerates any taint that matches - the triple using the matching operator . - properties: - effect: - description: |- - Effect indicates the taint effect to match. Empty means match all taint effects. - When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. - type: string - key: - description: |- - Key is the taint key that the toleration applies to. Empty means match all taint keys. - If the key is empty, operator must be Exists; this combination means to match all values and all keys. - type: string - operator: - description: |- - Operator represents a key's relationship to the value. - Valid operators are Exists, Equal, Lt, and Gt. Defaults to Equal. - Exists is equivalent to wildcard for value, so that a pod can - tolerate all taints of a particular category. - Lt and Gt perform numeric comparisons (requires feature gate TaintTolerationComparisonOperators). - type: string - tolerationSeconds: - description: |- - TolerationSeconds represents the period of time the toleration (which must be - of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, - it is not set, which means tolerate the taint forever (do not evict). Zero and - negative values will be treated as 0 (evict immediately) by the system. - format: int64 - type: integer - value: - description: |- - Value is the taint value the toleration matches to. - If the operator is Exists, the value should be empty, otherwise just a regular string. - type: string - type: object - type: array - x-kubernetes-list-type: atomic - topologySpreadConstraints: - description: |- - TopologySpreadConstraints describes how a group of pods ought to spread across topology - domains. Scheduler will schedule pods in a way which abides by the constraints. - All topologySpreadConstraints are ANDed. - items: - description: TopologySpreadConstraint specifies how to spread - matching pods among the given topology. - properties: - labelSelector: - description: |- - LabelSelector is used to find matching pods. - Pods that match this label selector are counted to determine the number of pods - in their corresponding topology domain. - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the - selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - matchLabelKeys: - description: |- - MatchLabelKeys is a set of pod label keys to select the pods over which - spreading will be calculated. The keys are used to lookup values from the - incoming pod labels, those key-value labels are ANDed with labelSelector - to select the group of existing pods over which spreading will be calculated - for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. - MatchLabelKeys cannot be set when LabelSelector isn't set. - Keys that don't exist in the incoming pod labels will - be ignored. A null or empty list means only match against labelSelector. - - This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default). - items: - type: string - type: array - x-kubernetes-list-type: atomic - maxSkew: - description: |- - MaxSkew describes the degree to which pods may be unevenly distributed. - When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference - between the number of matching pods in the target topology and the global minimum. - The global minimum is the minimum number of matching pods in an eligible domain - or zero if the number of eligible domains is less than MinDomains. - For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same - labelSelector spread as 2/2/1: - In this case, the global minimum is 1. - | zone1 | zone2 | zone3 | - | P P | P P | P | - - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; - scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) - violate MaxSkew(1). - - if MaxSkew is 2, incoming pod can be scheduled onto any zone. - When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence - to topologies that satisfy it. - It's a required field. Default value is 1 and 0 is not allowed. - format: int32 - type: integer - minDomains: - description: |- - MinDomains indicates a minimum number of eligible domains. - When the number of eligible domains with matching topology keys is less than minDomains, - Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed. - And when the number of eligible domains with matching topology keys equals or greater than minDomains, - this value has no effect on scheduling. - As a result, when the number of eligible domains is less than minDomains, - scheduler won't schedule more than maxSkew Pods to those domains. - If value is nil, the constraint behaves as if MinDomains is equal to 1. - Valid values are integers greater than 0. - When value is not nil, WhenUnsatisfiable must be DoNotSchedule. - - For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same - labelSelector spread as 2/2/2: - | zone1 | zone2 | zone3 | - | P P | P P | P P | - The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0. - In this situation, new pod with the same labelSelector cannot be scheduled, - because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, - it will violate MaxSkew. - format: int32 - type: integer - nodeAffinityPolicy: - description: |- - NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector - when calculating pod topology spread skew. Options are: - - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. - - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. - - If this value is nil, the behavior is equivalent to the Honor policy. - type: string - nodeTaintsPolicy: - description: |- - NodeTaintsPolicy indicates how we will treat node taints when calculating - pod topology spread skew. Options are: - - Honor: nodes without taints, along with tainted nodes for which the incoming pod - has a toleration, are included. - - Ignore: node taints are ignored. All nodes are included. - - If this value is nil, the behavior is equivalent to the Ignore policy. - type: string - topologyKey: - description: |- - TopologyKey is the key of node labels. Nodes that have a label with this key - and identical values are considered to be in the same topology. - We consider each as a "bucket", and try to put balanced number - of pods into each bucket. - We define a domain as a particular instance of a topology. - Also, we define an eligible domain as a domain whose nodes meet the requirements of - nodeAffinityPolicy and nodeTaintsPolicy. - e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology. - And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology. - It's a required field. - type: string - whenUnsatisfiable: - description: |- - WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy - the spread constraint. - - DoNotSchedule (default) tells the scheduler not to schedule it. - - ScheduleAnyway tells the scheduler to schedule the pod in any location, - but giving higher precedence to topologies that would help reduce the - skew. - A constraint is considered "Unsatisfiable" for an incoming pod - if and only if every possible node assignment for that pod would violate - "MaxSkew" on some topology. - For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same - labelSelector spread as 3/1/1: - | zone1 | zone2 | zone3 | - | P P P | P | P | - If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled - to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies - MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler - won't make it *more* imbalanced. - It's a required field. - type: string - required: - - maxSkew - - topologyKey - - whenUnsatisfiable - type: object - type: array - x-kubernetes-list-map-keys: - - topologyKey - - whenUnsatisfiable - x-kubernetes-list-type: map - volumes: - description: |- - List of volumes that can be mounted by containers belonging to the pod. - More info: https://kubernetes.io/docs/concepts/storage/volumes - items: - description: Volume represents a named volume in a pod that - may be accessed by any container in the pod. - properties: - awsElasticBlockStore: - description: |- - awsElasticBlockStore represents an AWS Disk resource that is attached to a - kubelet's host machine and then exposed to the pod. - Deprecated: AWSElasticBlockStore is deprecated. All operations for the in-tree - awsElasticBlockStore type are redirected to the ebs.csi.aws.com CSI driver. - More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore - properties: - fsType: - description: |- - fsType is the filesystem type of the volume that you want to mount. - Tip: Ensure that the filesystem type is supported by the host operating system. - Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore - type: string - partition: - description: |- - partition is the partition in the volume that you want to mount. - If omitted, the default is to mount by volume name. - Examples: For volume /dev/sda1, you specify the partition as "1". - Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). - format: int32 - type: integer - readOnly: - description: |- - readOnly value true will force the readOnly setting in VolumeMounts. - More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore - type: boolean - volumeID: - description: |- - volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). - More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore - type: string - required: - - volumeID - type: object - azureDisk: - description: |- - azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. - Deprecated: AzureDisk is deprecated. All operations for the in-tree azureDisk type - are redirected to the disk.csi.azure.com CSI driver. - properties: - cachingMode: - description: 'cachingMode is the Host Caching mode: - None, Read Only, Read Write.' - type: string - diskName: - description: diskName is the Name of the data disk - in the blob storage - type: string - diskURI: - description: diskURI is the URI of data disk in - the blob storage - type: string - fsType: - default: ext4 - description: |- - fsType is Filesystem type to mount. - Must be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - type: string - kind: - description: 'kind expected values are Shared: multiple - blob disks per storage account Dedicated: single - blob disk per storage account Managed: azure - managed data disk (only in managed availability - set). defaults to shared' - type: string - readOnly: - default: false - description: |- - readOnly Defaults to false (read/write). ReadOnly here will force - the ReadOnly setting in VolumeMounts. - type: boolean - required: - - diskName - - diskURI - type: object - azureFile: - description: |- - azureFile represents an Azure File Service mount on the host and bind mount to the pod. - Deprecated: AzureFile is deprecated. All operations for the in-tree azureFile type - are redirected to the file.csi.azure.com CSI driver. - properties: - readOnly: - description: |- - readOnly defaults to false (read/write). ReadOnly here will force - the ReadOnly setting in VolumeMounts. - type: boolean - secretName: - description: secretName is the name of secret that - contains Azure Storage Account Name and Key - type: string - shareName: - description: shareName is the azure share Name - type: string - required: - - secretName - - shareName - type: object - cephfs: - description: |- - cephFS represents a Ceph FS mount on the host that shares a pod's lifetime. - Deprecated: CephFS is deprecated and the in-tree cephfs type is no longer supported. - properties: - monitors: - description: |- - monitors is Required: Monitors is a collection of Ceph monitors - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it - items: - type: string - type: array - x-kubernetes-list-type: atomic - path: - description: 'path is Optional: Used as the mounted - root, rather than the full Ceph tree, default - is /' - type: string - readOnly: - description: |- - readOnly is Optional: Defaults to false (read/write). ReadOnly here will force - the ReadOnly setting in VolumeMounts. - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it - type: boolean - secretFile: - description: |- - secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it - type: string - secretRef: - description: |- - secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - type: object - x-kubernetes-map-type: atomic - user: - description: |- - user is optional: User is the rados user name, default is admin - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it - type: string - required: - - monitors - type: object - cinder: - description: |- - cinder represents a cinder volume attached and mounted on kubelets host machine. - Deprecated: Cinder is deprecated. All operations for the in-tree cinder type - are redirected to the cinder.csi.openstack.org CSI driver. - More info: https://examples.k8s.io/mysql-cinder-pd/README.md - properties: - fsType: - description: |- - fsType is the filesystem type to mount. - Must be a filesystem type supported by the host operating system. - Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - More info: https://examples.k8s.io/mysql-cinder-pd/README.md - type: string - readOnly: - description: |- - readOnly defaults to false (read/write). ReadOnly here will force - the ReadOnly setting in VolumeMounts. - More info: https://examples.k8s.io/mysql-cinder-pd/README.md - type: boolean - secretRef: - description: |- - secretRef is optional: points to a secret object containing parameters used to connect - to OpenStack. - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - type: object - x-kubernetes-map-type: atomic - volumeID: - description: |- - volumeID used to identify the volume in cinder. - More info: https://examples.k8s.io/mysql-cinder-pd/README.md - type: string - required: - - volumeID - type: object - configMap: - description: configMap represents a configMap that should - populate this volume - properties: - defaultMode: - description: |- - defaultMode is optional: mode bits used to set permissions on created files by default. - Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. - YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. - Defaults to 0644. - Directories within the path are not affected by this setting. - This might be in conflict with other options that affect the file - mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - items: - description: |- - items if unspecified, each key-value pair in the Data field of the referenced - ConfigMap will be projected into the volume as a file whose name is the - key and content is the value. If specified, the listed keys will be - projected into the specified paths, and unlisted keys will not be - present. If a key is specified which is not present in the ConfigMap, - the volume setup will error unless it is marked optional. Paths must be - relative and may not contain the '..' path or start with '..'. - items: - description: Maps a string key to a path within - a volume. - properties: - key: - description: key is the key to project. - type: string - mode: - description: |- - mode is Optional: mode bits used to set permissions on this file. - Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. - YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. - If not specified, the volume defaultMode will be used. - This might be in conflict with other options that affect the file - mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - path: - description: |- - path is the relative path of the file to map the key to. - May not be an absolute path. - May not contain the path element '..'. - May not start with the string '..'. - type: string - required: - - key - - path - type: object - type: array - x-kubernetes-list-type: atomic - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: optional specify whether the ConfigMap - or its keys must be defined - type: boolean - type: object - x-kubernetes-map-type: atomic - csi: - description: csi (Container Storage Interface) represents - ephemeral storage that is handled by certain external - CSI drivers. - properties: - driver: - description: |- - driver is the name of the CSI driver that handles this volume. - Consult with your admin for the correct name as registered in the cluster. - type: string - fsType: - description: |- - fsType to mount. Ex. "ext4", "xfs", "ntfs". - If not provided, the empty value is passed to the associated CSI driver - which will determine the default filesystem to apply. - type: string - nodePublishSecretRef: - description: |- - nodePublishSecretRef is a reference to the secret object containing - sensitive information to pass to the CSI driver to complete the CSI - NodePublishVolume and NodeUnpublishVolume calls. - This field is optional, and may be empty if no secret is required. If the - secret object contains more than one secret, all secret references are passed. - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - type: object - x-kubernetes-map-type: atomic - readOnly: - description: |- - readOnly specifies a read-only configuration for the volume. - Defaults to false (read/write). - type: boolean - volumeAttributes: - additionalProperties: - type: string - description: |- - volumeAttributes stores driver-specific properties that are passed to the CSI - driver. Consult your driver's documentation for supported values. - type: object - required: - - driver - type: object - downwardAPI: - description: downwardAPI represents downward API about - the pod that should populate this volume - properties: - defaultMode: - description: |- - Optional: mode bits to use on created files by default. Must be a - Optional: mode bits used to set permissions on created files by default. - Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. - YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. - Defaults to 0644. - Directories within the path are not affected by this setting. - This might be in conflict with other options that affect the file - mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - items: - description: Items is a list of downward API volume - file - items: - description: DownwardAPIVolumeFile represents - information to create the file containing the - pod field - properties: - fieldRef: - description: 'Required: Selects a field of - the pod: only annotations, labels, name, - namespace and uid are supported.' - properties: - apiVersion: - description: Version of the schema the - FieldPath is written in terms of, defaults - to "v1". - type: string - fieldPath: - description: Path of the field to select - in the specified API version. - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - mode: - description: |- - Optional: mode bits used to set permissions on this file, must be an octal value - between 0000 and 0777 or a decimal value between 0 and 511. - YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. - If not specified, the volume defaultMode will be used. - This might be in conflict with other options that affect the file - mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - path: - description: 'Required: Path is the relative - path name of the file to be created. Must - not be absolute or contain the ''..'' path. - Must be utf-8 encoded. The first item of - the relative path must not start with ''..''' - type: string - resourceFieldRef: - description: |- - Selects a resource of the container: only resources limits and requests - (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. - properties: - containerName: - description: 'Container name: required - for volumes, optional for env vars' - type: string - divisor: - anyOf: - - type: integer - - type: string - description: Specifies the output format - of the exposed resources, defaults to - "1" - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - description: 'Required: resource to select' - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - required: - - path - type: object - type: array - x-kubernetes-list-type: atomic - type: object - emptyDir: - description: |- - emptyDir represents a temporary directory that shares a pod's lifetime. - More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir - properties: - medium: - description: |- - medium represents what type of storage medium should back this directory. - The default is "" which means to use the node's default medium. - Must be an empty string (default) or Memory. - More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir - type: string - sizeLimit: - anyOf: - - type: integer - - type: string - description: |- - sizeLimit is the total amount of local storage required for this EmptyDir volume. - The size limit is also applicable for memory medium. - The maximum usage on memory medium EmptyDir would be the minimum value between - the SizeLimit specified here and the sum of memory limits of all containers in a pod. - The default is nil which means that the limit is undefined. - More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - ephemeral: - description: |- - ephemeral represents a volume that is handled by a cluster storage driver. - The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, - and deleted when the pod is removed. - - Use this if: - a) the volume is only needed while the pod runs, - b) features of normal volumes like restoring from snapshot or capacity - tracking are needed, - c) the storage driver is specified through a storage class, and - d) the storage driver supports dynamic volume provisioning through - a PersistentVolumeClaim (see EphemeralVolumeSource for more - information on the connection between this volume type - and PersistentVolumeClaim). - - Use PersistentVolumeClaim or one of the vendor-specific - APIs for volumes that persist for longer than the lifecycle - of an individual pod. - - Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to - be used that way - see the documentation of the driver for - more information. - - A pod can use both types of ephemeral volumes and - persistent volumes at the same time. - properties: - volumeClaimTemplate: - description: |- - Will be used to create a stand-alone PVC to provision the volume. - The pod in which this EphemeralVolumeSource is embedded will be the - owner of the PVC, i.e. the PVC will be deleted together with the - pod. The name of the PVC will be `-` where - `` is the name from the `PodSpec.Volumes` array - entry. Pod validation will reject the pod if the concatenated name - is not valid for a PVC (for example, too long). - - An existing PVC with that name that is not owned by the pod - will *not* be used for the pod to avoid using an unrelated - volume by mistake. Starting the pod is then blocked until - the unrelated PVC is removed. If such a pre-created PVC is - meant to be used by the pod, the PVC has to updated with an - owner reference to the pod once the pod exists. Normally - this should not be necessary, but it may be useful when - manually reconstructing a broken cluster. - - This field is read-only and no changes will be made by Kubernetes - to the PVC after it has been created. - - Required, must not be nil. - properties: - metadata: - description: |- - May contain labels and annotations that will be copied into the PVC - when creating it. No other fields are allowed and will be rejected during - validation. - type: object - spec: - description: |- - The specification for the PersistentVolumeClaim. The entire content is - copied unchanged into the PVC that gets created from this - template. The same fields as in a PersistentVolumeClaim - are also valid here. - properties: - accessModes: - description: |- - accessModes contains the desired access modes the volume should have. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 - items: - type: string - type: array - x-kubernetes-list-type: atomic - dataSource: - description: |- - dataSource field can be used to specify either: - * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) - * An existing PVC (PersistentVolumeClaim) - If the provisioner or an external controller can support the specified data source, - it will create a new volume based on the contents of the specified data source. - When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, - and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. - If the namespace is specified, then dataSourceRef will not be copied to dataSource. - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - kind: - description: Kind is the type of resource - being referenced - type: string - name: - description: Name is the name of resource - being referenced - type: string - required: - - kind - - name - type: object - x-kubernetes-map-type: atomic - dataSourceRef: - description: |- - dataSourceRef specifies the object from which to populate the volume with data, if a non-empty - volume is desired. This may be any object from a non-empty API group (non - core object) or a PersistentVolumeClaim object. - When this field is specified, volume binding will only succeed if the type of - the specified object matches some installed volume populator or dynamic - provisioner. - This field will replace the functionality of the dataSource field and as such - if both fields are non-empty, they must have the same value. For backwards - compatibility, when namespace isn't specified in dataSourceRef, - both fields (dataSource and dataSourceRef) will be set to the same - value automatically if one of them is empty and the other is non-empty. - When namespace is specified in dataSourceRef, - dataSource isn't set to the same value and must be empty. - There are three important differences between dataSource and dataSourceRef: - * While dataSource only allows two specific types of objects, dataSourceRef - allows any non-core object, as well as PersistentVolumeClaim objects. - * While dataSource ignores disallowed values (dropping them), dataSourceRef - preserves all values, and generates an error if a disallowed value is - specified. - * While dataSource only allows local objects, dataSourceRef allows objects - in any namespaces. - (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. - (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. - properties: - apiGroup: - description: |- - APIGroup is the group for the resource being referenced. - If APIGroup is not specified, the specified Kind must be in the core API group. - For any other third-party types, APIGroup is required. - type: string - kind: - description: Kind is the type of resource - being referenced - type: string - name: - description: Name is the name of resource - being referenced - type: string - namespace: - description: |- - Namespace is the namespace of resource being referenced - Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. - (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. - type: string - required: - - kind - - name - type: object - resources: - description: |- - resources represents the minimum resources the volume should have. - Users are allowed to specify resource requirements - that are lower than previous value but must still be higher than capacity recorded in the - status field of the claim. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Limits describes the maximum amount of compute resources allowed. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Requests describes the minimum amount of compute resources required. - If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. Requests cannot exceed Limits. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - type: object - selector: - description: selector is a label query over - volumes to consider for binding. - properties: - matchExpressions: - description: matchExpressions is a list - of label selector requirements. The - requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label - key that the selector applies - to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - storageClassName: - description: |- - storageClassName is the name of the StorageClass required by the claim. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 - type: string - volumeAttributesClassName: - description: |- - volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. - If specified, the CSI driver will create or update the volume with the attributes defined - in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, - it can be changed after the claim is created. An empty string or nil value indicates that no - VolumeAttributesClass will be applied to the claim. If the claim enters an Infeasible error state, - this field can be reset to its previous value (including nil) to cancel the modification. - If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be - set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource - exists. - More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ - type: string - volumeMode: - description: |- - volumeMode defines what type of volume is required by the claim. - Value of Filesystem is implied when not included in claim spec. - type: string - volumeName: - description: volumeName is the binding reference - to the PersistentVolume backing this claim. - type: string - type: object - required: - - spec - type: object - type: object - fc: - description: fc represents a Fibre Channel resource - that is attached to a kubelet's host machine and then - exposed to the pod. - properties: - fsType: - description: |- - fsType is the filesystem type to mount. - Must be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - type: string - lun: - description: 'lun is Optional: FC target lun number' - format: int32 - type: integer - readOnly: - description: |- - readOnly is Optional: Defaults to false (read/write). ReadOnly here will force - the ReadOnly setting in VolumeMounts. - type: boolean - targetWWNs: - description: 'targetWWNs is Optional: FC target - worldwide names (WWNs)' - items: - type: string - type: array - x-kubernetes-list-type: atomic - wwids: - description: |- - wwids Optional: FC volume world wide identifiers (wwids) - Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - flexVolume: - description: |- - flexVolume represents a generic volume resource that is - provisioned/attached using an exec based plugin. - Deprecated: FlexVolume is deprecated. Consider using a CSIDriver instead. - properties: - driver: - description: driver is the name of the driver to - use for this volume. - type: string - fsType: - description: |- - fsType is the filesystem type to mount. - Must be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. - type: string - options: - additionalProperties: - type: string - description: 'options is Optional: this field holds - extra command options if any.' - type: object - readOnly: - description: |- - readOnly is Optional: defaults to false (read/write). ReadOnly here will force - the ReadOnly setting in VolumeMounts. - type: boolean - secretRef: - description: |- - secretRef is Optional: secretRef is reference to the secret object containing - sensitive information to pass to the plugin scripts. This may be - empty if no secret object is specified. If the secret object - contains more than one secret, all secrets are passed to the plugin - scripts. - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - type: object - x-kubernetes-map-type: atomic - required: - - driver - type: object - flocker: - description: |- - flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running. - Deprecated: Flocker is deprecated and the in-tree flocker type is no longer supported. - properties: - datasetName: - description: |- - datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker - should be considered as deprecated - type: string - datasetUUID: - description: datasetUUID is the UUID of the dataset. - This is unique identifier of a Flocker dataset - type: string - type: object - gcePersistentDisk: - description: |- - gcePersistentDisk represents a GCE Disk resource that is attached to a - kubelet's host machine and then exposed to the pod. - Deprecated: GCEPersistentDisk is deprecated. All operations for the in-tree - gcePersistentDisk type are redirected to the pd.csi.storage.gke.io CSI driver. - More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk - properties: - fsType: - description: |- - fsType is filesystem type of the volume that you want to mount. - Tip: Ensure that the filesystem type is supported by the host operating system. - Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk - type: string - partition: - description: |- - partition is the partition in the volume that you want to mount. - If omitted, the default is to mount by volume name. - Examples: For volume /dev/sda1, you specify the partition as "1". - Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). - More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk - format: int32 - type: integer - pdName: - description: |- - pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. - More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk - type: string - readOnly: - description: |- - readOnly here will force the ReadOnly setting in VolumeMounts. - Defaults to false. - More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk - type: boolean - required: - - pdName - type: object - gitRepo: - description: |- - gitRepo represents a git repository at a particular revision. - Deprecated: GitRepo is deprecated. To provision a container with a git repo, mount an - EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir - into the Pod's container. - properties: - directory: - description: |- - directory is the target directory name. - Must not contain or start with '..'. If '.' is supplied, the volume directory will be the - git repository. Otherwise, if specified, the volume will contain the git repository in - the subdirectory with the given name. - type: string - repository: - description: repository is the URL - type: string - revision: - description: revision is the commit hash for the - specified revision. - type: string - required: - - repository - type: object - glusterfs: - description: |- - glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. - Deprecated: Glusterfs is deprecated and the in-tree glusterfs type is no longer supported. - properties: - endpoints: - description: endpoints is the endpoint name that - details Glusterfs topology. - type: string - path: - description: |- - path is the Glusterfs volume path. - More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod - type: string - readOnly: - description: |- - readOnly here will force the Glusterfs volume to be mounted with read-only permissions. - Defaults to false. - More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod - type: boolean - required: - - endpoints - - path - type: object - hostPath: - description: |- - hostPath represents a pre-existing file or directory on the host - machine that is directly exposed to the container. This is generally - used for system agents or other privileged things that are allowed - to see the host machine. Most containers will NOT need this. - More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath - properties: - path: - description: |- - path of the directory on the host. - If the path is a symlink, it will follow the link to the real path. - More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath - type: string - type: - description: |- - type for HostPath Volume - Defaults to "" - More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath - type: string - required: - - path - type: object - image: - description: |- - image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. - The volume is resolved at pod startup depending on which PullPolicy value is provided: - - - Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. - - The volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. - A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. - The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. - The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. - The volume will be mounted read-only (ro). - Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33. - The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type. - properties: - pullPolicy: - description: |- - Policy for pulling OCI objects. Possible values are: - Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. - Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. - type: string - reference: - description: |- - Required: Image or artifact reference to be used. - Behaves in the same way as pod.spec.containers[*].image. - Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. - More info: https://kubernetes.io/docs/concepts/containers/images - This field is optional to allow higher level config management to default or override - container images in workload controllers like Deployments and StatefulSets. - type: string - type: object - iscsi: - description: |- - iscsi represents an ISCSI Disk resource that is attached to a - kubelet's host machine and then exposed to the pod. - More info: https://kubernetes.io/docs/concepts/storage/volumes/#iscsi - properties: - chapAuthDiscovery: - description: chapAuthDiscovery defines whether support - iSCSI Discovery CHAP authentication - type: boolean - chapAuthSession: - description: chapAuthSession defines whether support - iSCSI Session CHAP authentication - type: boolean - fsType: - description: |- - fsType is the filesystem type of the volume that you want to mount. - Tip: Ensure that the filesystem type is supported by the host operating system. - Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi - type: string - initiatorName: - description: |- - initiatorName is the custom iSCSI Initiator Name. - If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface - : will be created for the connection. - type: string - iqn: - description: iqn is the target iSCSI Qualified Name. - type: string - iscsiInterface: - default: default - description: |- - iscsiInterface is the interface Name that uses an iSCSI transport. - Defaults to 'default' (tcp). - type: string - lun: - description: lun represents iSCSI Target Lun number. - format: int32 - type: integer - portals: - description: |- - portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port - is other than default (typically TCP ports 860 and 3260). - items: - type: string - type: array - x-kubernetes-list-type: atomic - readOnly: - description: |- - readOnly here will force the ReadOnly setting in VolumeMounts. - Defaults to false. - type: boolean - secretRef: - description: secretRef is the CHAP Secret for iSCSI - target and initiator authentication - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - type: object - x-kubernetes-map-type: atomic - targetPortal: - description: |- - targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port - is other than default (typically TCP ports 860 and 3260). - type: string - required: - - iqn - - lun - - targetPortal - type: object - name: - description: |- - name of the volume. - Must be a DNS_LABEL and unique within the pod. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - nfs: - description: |- - nfs represents an NFS mount on the host that shares a pod's lifetime - More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs - properties: - path: - description: |- - path that is exported by the NFS server. - More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs - type: string - readOnly: - description: |- - readOnly here will force the NFS export to be mounted with read-only permissions. - Defaults to false. - More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs - type: boolean - server: - description: |- - server is the hostname or IP address of the NFS server. - More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs - type: string - required: - - path - - server - type: object - persistentVolumeClaim: - description: |- - persistentVolumeClaimVolumeSource represents a reference to a - PersistentVolumeClaim in the same namespace. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims - properties: - claimName: - description: |- - claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims - type: string - readOnly: - description: |- - readOnly Will force the ReadOnly setting in VolumeMounts. - Default false. - type: boolean - required: - - claimName - type: object - photonPersistentDisk: - description: |- - photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine. - Deprecated: PhotonPersistentDisk is deprecated and the in-tree photonPersistentDisk type is no longer supported. - properties: - fsType: - description: |- - fsType is the filesystem type to mount. - Must be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - type: string - pdID: - description: pdID is the ID that identifies Photon - Controller persistent disk - type: string - required: - - pdID - type: object - portworxVolume: - description: |- - portworxVolume represents a portworx volume attached and mounted on kubelets host machine. - Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type - are redirected to the pxd.portworx.com CSI driver. - properties: - fsType: - description: |- - fSType represents the filesystem type to mount - Must be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. - type: string - readOnly: - description: |- - readOnly defaults to false (read/write). ReadOnly here will force - the ReadOnly setting in VolumeMounts. - type: boolean - volumeID: - description: volumeID uniquely identifies a Portworx - volume - type: string - required: - - volumeID - type: object - projected: - description: projected items for all in one resources - secrets, configmaps, and downward API - properties: - defaultMode: - description: |- - defaultMode are the mode bits used to set permissions on created files by default. - Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. - YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. - Directories within the path are not affected by this setting. - This might be in conflict with other options that affect the file - mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - sources: - description: |- - sources is the list of volume projections. Each entry in this list - handles one source. - items: - description: |- - Projection that may be projected along with other supported volume types. - Exactly one of these fields must be set. - properties: - clusterTrustBundle: - description: |- - ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field - of ClusterTrustBundle objects in an auto-updating file. - - Alpha, gated by the ClusterTrustBundleProjection feature gate. - - ClusterTrustBundle objects can either be selected by name, or by the - combination of signer name and a label selector. - - Kubelet performs aggressive normalization of the PEM contents written - into the pod filesystem. Esoteric PEM features such as inter-block - comments and block headers are stripped. Certificates are deduplicated. - The ordering of certificates within the file is arbitrary, and Kubelet - may change the order over time. - properties: - labelSelector: - description: |- - Select all ClusterTrustBundles that match this label selector. Only has - effect if signerName is set. Mutually-exclusive with name. If unset, - interpreted as "match nothing". If set but empty, interpreted as "match - everything". - properties: - matchExpressions: - description: matchExpressions is a - list of label selector requirements. - The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label - key that the selector applies - to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - name: - description: |- - Select a single ClusterTrustBundle by object name. Mutually-exclusive - with signerName and labelSelector. - type: string - optional: - description: |- - If true, don't block pod startup if the referenced ClusterTrustBundle(s) - aren't available. If using name, then the named ClusterTrustBundle is - allowed not to exist. If using signerName, then the combination of - signerName and labelSelector is allowed to match zero - ClusterTrustBundles. - type: boolean - path: - description: Relative path from the volume - root to write the bundle. - type: string - signerName: - description: |- - Select all ClusterTrustBundles that match this signer name. - Mutually-exclusive with name. The contents of all selected - ClusterTrustBundles will be unified and deduplicated. - type: string - required: - - path - type: object - configMap: - description: configMap information about the - configMap data to project - properties: - items: - description: |- - items if unspecified, each key-value pair in the Data field of the referenced - ConfigMap will be projected into the volume as a file whose name is the - key and content is the value. If specified, the listed keys will be - projected into the specified paths, and unlisted keys will not be - present. If a key is specified which is not present in the ConfigMap, - the volume setup will error unless it is marked optional. Paths must be - relative and may not contain the '..' path or start with '..'. - items: - description: Maps a string key to a - path within a volume. - properties: - key: - description: key is the key to project. - type: string - mode: - description: |- - mode is Optional: mode bits used to set permissions on this file. - Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. - YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. - If not specified, the volume defaultMode will be used. - This might be in conflict with other options that affect the file - mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - path: - description: |- - path is the relative path of the file to map the key to. - May not be an absolute path. - May not contain the path element '..'. - May not start with the string '..'. - type: string - required: - - key - - path - type: object - type: array - x-kubernetes-list-type: atomic - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: optional specify whether - the ConfigMap or its keys must be defined - type: boolean - type: object - x-kubernetes-map-type: atomic - downwardAPI: - description: downwardAPI information about - the downwardAPI data to project - properties: - items: - description: Items is a list of DownwardAPIVolume - file - items: - description: DownwardAPIVolumeFile represents - information to create the file containing - the pod field - properties: - fieldRef: - description: 'Required: Selects - a field of the pod: only annotations, - labels, name, namespace and uid - are supported.' - properties: - apiVersion: - description: Version of the - schema the FieldPath is written - in terms of, defaults to "v1". - type: string - fieldPath: - description: Path of the field - to select in the specified - API version. - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - mode: - description: |- - Optional: mode bits used to set permissions on this file, must be an octal value - between 0000 and 0777 or a decimal value between 0 and 511. - YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. - If not specified, the volume defaultMode will be used. - This might be in conflict with other options that affect the file - mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - path: - description: 'Required: Path is the - relative path name of the file - to be created. Must not be absolute - or contain the ''..'' path. Must - be utf-8 encoded. The first item - of the relative path must not - start with ''..''' - type: string - resourceFieldRef: - description: |- - Selects a resource of the container: only resources limits and requests - (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. - properties: - containerName: - description: 'Container name: - required for volumes, optional - for env vars' - type: string - divisor: - anyOf: - - type: integer - - type: string - description: Specifies the output - format of the exposed resources, - defaults to "1" - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - description: 'Required: resource - to select' - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - required: - - path - type: object - type: array - x-kubernetes-list-type: atomic - type: object - podCertificate: - description: |- - Projects an auto-rotating credential bundle (private key and certificate - chain) that the pod can use either as a TLS client or server. - - Kubelet generates a private key and uses it to send a - PodCertificateRequest to the named signer. Once the signer approves the - request and issues a certificate chain, Kubelet writes the key and - certificate chain to the pod filesystem. The pod does not start until - certificates have been issued for each podCertificate projected volume - source in its spec. - - Kubelet will begin trying to rotate the certificate at the time indicated - by the signer using the PodCertificateRequest.Status.BeginRefreshAt - timestamp. - - Kubelet can write a single file, indicated by the credentialBundlePath - field, or separate files, indicated by the keyPath and - certificateChainPath fields. - - The credential bundle is a single file in PEM format. The first PEM - entry is the private key (in PKCS#8 format), and the remaining PEM - entries are the certificate chain issued by the signer (typically, - signers will return their certificate chain in leaf-to-root order). - - Prefer using the credential bundle format, since your application code - can read it atomically. If you use keyPath and certificateChainPath, - your application must make two separate file reads. If these coincide - with a certificate rotation, it is possible that the private key and leaf - certificate you read may not correspond to each other. Your application - will need to check for this condition, and re-read until they are - consistent. - - The named signer controls chooses the format of the certificate it - issues; consult the signer implementation's documentation to learn how to - use the certificates it issues. - properties: - certificateChainPath: - description: |- - Write the certificate chain at this path in the projected volume. - - Most applications should use credentialBundlePath. When using keyPath - and certificateChainPath, your application needs to check that the key - and leaf certificate are consistent, because it is possible to read the - files mid-rotation. - type: string - credentialBundlePath: - description: |- - Write the credential bundle at this path in the projected volume. - - The credential bundle is a single file that contains multiple PEM blocks. - The first PEM block is a PRIVATE KEY block, containing a PKCS#8 private - key. - - The remaining blocks are CERTIFICATE blocks, containing the issued - certificate chain from the signer (leaf and any intermediates). - - Using credentialBundlePath lets your Pod's application code make a single - atomic read that retrieves a consistent key and certificate chain. If you - project them to separate files, your application code will need to - additionally check that the leaf certificate was issued to the key. - type: string - keyPath: - description: |- - Write the key at this path in the projected volume. - - Most applications should use credentialBundlePath. When using keyPath - and certificateChainPath, your application needs to check that the key - and leaf certificate are consistent, because it is possible to read the - files mid-rotation. - type: string - keyType: - description: |- - The type of keypair Kubelet will generate for the pod. - - Valid values are "RSA3072", "RSA4096", "ECDSAP256", "ECDSAP384", - "ECDSAP521", and "ED25519". - type: string - maxExpirationSeconds: - description: |- - maxExpirationSeconds is the maximum lifetime permitted for the - certificate. - - Kubelet copies this value verbatim into the PodCertificateRequests it - generates for this projection. - - If omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver - will reject values shorter than 3600 (1 hour). The maximum allowable - value is 7862400 (91 days). - - The signer implementation is then free to issue a certificate with any - lifetime *shorter* than MaxExpirationSeconds, but no shorter than 3600 - seconds (1 hour). This constraint is enforced by kube-apiserver. - `kubernetes.io` signers will never issue certificates with a lifetime - longer than 24 hours. - format: int32 - type: integer - signerName: - description: Kubelet's generated CSRs - will be addressed to this signer. - type: string - userAnnotations: - additionalProperties: - type: string - description: |- - userAnnotations allow pod authors to pass additional information to - the signer implementation. Kubernetes does not restrict or validate this - metadata in any way. - - These values are copied verbatim into the `spec.unverifiedUserAnnotations` field of - the PodCertificateRequest objects that Kubelet creates. - - Entries are subject to the same validation as object metadata annotations, - with the addition that all keys must be domain-prefixed. No restrictions - are placed on values, except an overall size limitation on the entire field. - - Signers should document the keys and values they support. Signers should - deny requests that contain keys they do not recognize. - type: object - required: - - keyType - - signerName - type: object - secret: - description: secret information about the - secret data to project - properties: - items: - description: |- - items if unspecified, each key-value pair in the Data field of the referenced - Secret will be projected into the volume as a file whose name is the - key and content is the value. If specified, the listed keys will be - projected into the specified paths, and unlisted keys will not be - present. If a key is specified which is not present in the Secret, - the volume setup will error unless it is marked optional. Paths must be - relative and may not contain the '..' path or start with '..'. - items: - description: Maps a string key to a - path within a volume. - properties: - key: - description: key is the key to project. - type: string - mode: - description: |- - mode is Optional: mode bits used to set permissions on this file. - Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. - YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. - If not specified, the volume defaultMode will be used. - This might be in conflict with other options that affect the file - mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - path: - description: |- - path is the relative path of the file to map the key to. - May not be an absolute path. - May not contain the path element '..'. - May not start with the string '..'. - type: string - required: - - key - - path - type: object - type: array - x-kubernetes-list-type: atomic - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: optional field specify whether - the Secret or its key must be defined - type: boolean - type: object - x-kubernetes-map-type: atomic - serviceAccountToken: - description: serviceAccountToken is information - about the serviceAccountToken data to project - properties: - audience: - description: |- - audience is the intended audience of the token. A recipient of a token - must identify itself with an identifier specified in the audience of the - token, and otherwise should reject the token. The audience defaults to the - identifier of the apiserver. - type: string - expirationSeconds: - description: |- - expirationSeconds is the requested duration of validity of the service - account token. As the token approaches expiration, the kubelet volume - plugin will proactively rotate the service account token. The kubelet will - start trying to rotate the token if the token is older than 80 percent of - its time to live or if the token is older than 24 hours.Defaults to 1 hour - and must be at least 10 minutes. - format: int64 - type: integer - path: - description: |- - path is the path relative to the mount point of the file to project the - token into. - type: string - required: - - path - type: object - type: object - type: array - x-kubernetes-list-type: atomic - type: object - quobyte: - description: |- - quobyte represents a Quobyte mount on the host that shares a pod's lifetime. - Deprecated: Quobyte is deprecated and the in-tree quobyte type is no longer supported. - properties: - group: - description: |- - group to map volume access to - Default is no group - type: string - readOnly: - description: |- - readOnly here will force the Quobyte volume to be mounted with read-only permissions. - Defaults to false. - type: boolean - registry: - description: |- - registry represents a single or multiple Quobyte Registry services - specified as a string as host:port pair (multiple entries are separated with commas) - which acts as the central registry for volumes - type: string - tenant: - description: |- - tenant owning the given Quobyte volume in the Backend - Used with dynamically provisioned Quobyte volumes, value is set by the plugin - type: string - user: - description: |- - user to map volume access to - Defaults to serivceaccount user - type: string - volume: - description: volume is a string that references - an already created Quobyte volume by name. - type: string - required: - - registry - - volume - type: object - rbd: - description: |- - rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. - Deprecated: RBD is deprecated and the in-tree rbd type is no longer supported. - properties: - fsType: - description: |- - fsType is the filesystem type of the volume that you want to mount. - Tip: Ensure that the filesystem type is supported by the host operating system. - Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd - type: string - image: - description: |- - image is the rados image name. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it - type: string - keyring: - default: /etc/ceph/keyring - description: |- - keyring is the path to key ring for RBDUser. - Default is /etc/ceph/keyring. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it - type: string - monitors: - description: |- - monitors is a collection of Ceph monitors. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it - items: - type: string - type: array - x-kubernetes-list-type: atomic - pool: - default: rbd - description: |- - pool is the rados pool name. - Default is rbd. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it - type: string - readOnly: - description: |- - readOnly here will force the ReadOnly setting in VolumeMounts. - Defaults to false. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it - type: boolean - secretRef: - description: |- - secretRef is name of the authentication secret for RBDUser. If provided - overrides keyring. - Default is nil. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - type: object - x-kubernetes-map-type: atomic - user: - default: admin - description: |- - user is the rados user name. - Default is admin. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it - type: string - required: - - image - - monitors - type: object - scaleIO: - description: |- - scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. - Deprecated: ScaleIO is deprecated and the in-tree scaleIO type is no longer supported. - properties: - fsType: - default: xfs - description: |- - fsType is the filesystem type to mount. - Must be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". - Default is "xfs". - type: string - gateway: - description: gateway is the host address of the - ScaleIO API Gateway. - type: string - protectionDomain: - description: protectionDomain is the name of the - ScaleIO Protection Domain for the configured storage. - type: string - readOnly: - description: |- - readOnly Defaults to false (read/write). ReadOnly here will force - the ReadOnly setting in VolumeMounts. - type: boolean - secretRef: - description: |- - secretRef references to the secret for ScaleIO user and other - sensitive information. If this is not provided, Login operation will fail. - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - type: object - x-kubernetes-map-type: atomic - sslEnabled: - description: sslEnabled Flag enable/disable SSL - communication with Gateway, default false - type: boolean - storageMode: - default: ThinProvisioned - description: |- - storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. - Default is ThinProvisioned. - type: string - storagePool: - description: storagePool is the ScaleIO Storage - Pool associated with the protection domain. - type: string - system: - description: system is the name of the storage system - as configured in ScaleIO. - type: string - volumeName: - description: |- - volumeName is the name of a volume already created in the ScaleIO system - that is associated with this volume source. - type: string - required: - - gateway - - secretRef - - system - type: object - secret: - description: |- - secret represents a secret that should populate this volume. - More info: https://kubernetes.io/docs/concepts/storage/volumes#secret - properties: - defaultMode: - description: |- - defaultMode is Optional: mode bits used to set permissions on created files by default. - Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. - YAML accepts both octal and decimal values, JSON requires decimal values - for mode bits. Defaults to 0644. - Directories within the path are not affected by this setting. - This might be in conflict with other options that affect the file - mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - items: - description: |- - items If unspecified, each key-value pair in the Data field of the referenced - Secret will be projected into the volume as a file whose name is the - key and content is the value. If specified, the listed keys will be - projected into the specified paths, and unlisted keys will not be - present. If a key is specified which is not present in the Secret, - the volume setup will error unless it is marked optional. Paths must be - relative and may not contain the '..' path or start with '..'. - items: - description: Maps a string key to a path within - a volume. - properties: - key: - description: key is the key to project. - type: string - mode: - description: |- - mode is Optional: mode bits used to set permissions on this file. - Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. - YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. - If not specified, the volume defaultMode will be used. - This might be in conflict with other options that affect the file - mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - path: - description: |- - path is the relative path of the file to map the key to. - May not be an absolute path. - May not contain the path element '..'. - May not start with the string '..'. - type: string - required: - - key - - path - type: object - type: array - x-kubernetes-list-type: atomic - optional: - description: optional field specify whether the - Secret or its keys must be defined - type: boolean - secretName: - description: |- - secretName is the name of the secret in the pod's namespace to use. - More info: https://kubernetes.io/docs/concepts/storage/volumes#secret - type: string - type: object - storageos: - description: |- - storageOS represents a StorageOS volume attached and mounted on Kubernetes nodes. - Deprecated: StorageOS is deprecated and the in-tree storageos type is no longer supported. - properties: - fsType: - description: |- - fsType is the filesystem type to mount. - Must be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - type: string - readOnly: - description: |- - readOnly defaults to false (read/write). ReadOnly here will force - the ReadOnly setting in VolumeMounts. - type: boolean - secretRef: - description: |- - secretRef specifies the secret to use for obtaining the StorageOS API - credentials. If not specified, default values will be attempted. - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - type: object - x-kubernetes-map-type: atomic - volumeName: - description: |- - volumeName is the human-readable name of the StorageOS volume. Volume - names are only unique within a namespace. - type: string - volumeNamespace: - description: |- - volumeNamespace specifies the scope of the volume within StorageOS. If no - namespace is specified then the Pod's namespace will be used. This allows the - Kubernetes name scoping to be mirrored within StorageOS for tighter integration. - Set VolumeName to any name to override the default behaviour. - Set to "default" if you are not using namespaces within StorageOS. - Namespaces that do not pre-exist within StorageOS will be created. - type: string - type: object - vsphereVolume: - description: |- - vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine. - Deprecated: VsphereVolume is deprecated. All operations for the in-tree vsphereVolume type - are redirected to the csi.vsphere.vmware.com CSI driver. - properties: - fsType: - description: |- - fsType is filesystem type to mount. - Must be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - type: string - storagePolicyID: - description: storagePolicyID is the storage Policy - Based Management (SPBM) profile ID associated - with the StoragePolicyName. - type: string - storagePolicyName: - description: storagePolicyName is the storage Policy - Based Management (SPBM) profile name. - type: string - volumePath: - description: volumePath is the path that identifies - vSphere volume vmdk - type: string - required: - - volumePath - type: object - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - required: - - containers - type: object - type: object - type: - default: rw - description: 'Type of service to forward traffic to. Default: `rw`.' - enum: - - rw - - ro - - r - type: string - required: - - cluster - - pgbouncer - type: object - status: - description: |- - Most recently observed status of the Pooler. This data may not be up to - date. Populated by the system. Read-only. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - error: - description: Error is the latest admission validation error - type: string - image: - description: |- - Image is the resolved pgbouncer container image that the operator is - using for this Pooler, including any override coming from spec.template. - While Phase is Active or Paused this field reflects what the Deployment - actually runs; while Phase is Inactive or Failed it may carry the last - successfully resolved value (or be empty if the Pooler has never reconciled - successfully). - type: string - instances: - description: The number of pods trying to be scheduled - format: int32 - type: integer - phase: - description: Phase summarizes the overall lifecycle state of the Pooler. - enum: - - active - - paused - - inactive - - failed - type: string - phaseReason: - description: PhaseReason is a human-readable explanation of the current - Phase. - type: string - secrets: - description: The resource version of the config object - properties: - clientCA: - description: The client CA secret version - properties: - name: - description: The name of the secret - type: string - version: - description: The ResourceVersion of the secret - type: string - type: object - clientTLS: - description: The client TLS secret version - properties: - name: - description: The name of the secret - type: string - version: - description: The ResourceVersion of the secret - type: string - type: object - pgBouncerSecrets: - description: The version of the secrets used by PgBouncer - properties: - authQuery: - description: The auth query secret version - properties: - name: - description: The name of the secret - type: string - version: - description: The ResourceVersion of the secret - type: string - type: object - type: object - serverCA: - description: The server CA secret version - properties: - name: - description: The name of the secret - type: string - version: - description: The ResourceVersion of the secret - type: string - type: object - serverTLS: - description: The server TLS secret version - properties: - name: - description: The name of the secret - type: string - version: - description: The ResourceVersion of the secret - type: string - type: object - type: object - type: object - required: - - metadata - - spec - type: object - served: true - storage: true - subresources: - scale: - specReplicasPath: .spec.instances - statusReplicasPath: .status.instances - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.21.0 - name: publications.postgresql.cnpg.io -spec: - group: postgresql.cnpg.io - names: - kind: Publication - listKind: PublicationList - plural: publications - singular: publication - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - jsonPath: .spec.cluster.name - name: Cluster - type: string - - jsonPath: .spec.name - name: PG Name - type: string - - jsonPath: .status.applied - name: Applied - type: boolean - - description: Latest reconciliation message - jsonPath: .status.message - name: Message - type: string - name: v1 - schema: - openAPIV3Schema: - description: Publication is the Schema for the publications API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: PublicationSpec defines the desired state of Publication - properties: - cluster: - description: The name of the PostgreSQL cluster that identifies the - "publisher" - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - type: object - x-kubernetes-map-type: atomic - x-kubernetes-validations: - - message: cluster reference is immutable after creation - rule: self == oldSelf - dbname: - description: |- - The name of the database where the publication will be installed in - the "publisher" cluster - type: string - x-kubernetes-validations: - - message: dbname is immutable - rule: self == oldSelf - name: - description: The name of the publication inside PostgreSQL - type: string - x-kubernetes-validations: - - message: name is immutable - rule: self == oldSelf - parameters: - additionalProperties: - type: string - description: |- - Publication parameters part of the `WITH` clause as expected by - PostgreSQL `CREATE PUBLICATION` command - type: object - publicationReclaimPolicy: - default: retain - description: The policy for end-of-life maintenance of this publication - enum: - - delete - - retain - type: string - target: - description: Target of the publication as expected by PostgreSQL `CREATE - PUBLICATION` command - properties: - allTables: - description: |- - Marks the publication as one that replicates changes for all tables - in the database, including tables created in the future. - Corresponding to `FOR ALL TABLES` in PostgreSQL. - type: boolean - x-kubernetes-validations: - - message: allTables is immutable - rule: self == oldSelf - objects: - description: Just the following schema objects - items: - description: PublicationTargetObject is an object to publish - properties: - table: - description: |- - Specifies a list of tables to add to the publication. Corresponding - to `FOR TABLE` in PostgreSQL. - properties: - columns: - description: The columns to publish - items: - type: string - type: array - name: - description: The table name - type: string - only: - description: Whether to limit to the table only or include - all its descendants - type: boolean - schema: - description: The schema name - type: string - required: - - name - type: object - tablesInSchema: - description: |- - Marks the publication as one that replicates changes for all tables - in the specified list of schemas, including tables created in the - future. Corresponding to `FOR TABLES IN SCHEMA` in PostgreSQL. - type: string - type: object - x-kubernetes-validations: - - message: tablesInSchema and table are mutually exclusive - rule: (has(self.tablesInSchema) && !has(self.table)) || (!has(self.tablesInSchema) - && has(self.table)) - maxItems: 100000 - type: array - x-kubernetes-validations: - - message: specifying a column list when the publication also - publishes tablesInSchema is not supported - rule: '!(self.exists(o, has(o.table) && has(o.table.columns)) - && self.exists(o, has(o.tablesInSchema)))' - type: object - x-kubernetes-validations: - - message: allTables and objects are mutually exclusive - rule: (has(self.allTables) && !has(self.objects)) || (!has(self.allTables) - && has(self.objects)) - required: - - cluster - - dbname - - name - - target - type: object - status: - description: PublicationStatus defines the observed state of Publication - properties: - applied: - description: Applied is true if the publication was reconciled correctly - type: boolean - message: - description: Message is the reconciliation output message - type: string - observedGeneration: - description: |- - A sequence number representing the latest - desired state that was synchronized - format: int64 - type: integer - type: object - required: - - metadata - - spec - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.21.0 - name: scheduledbackups.postgresql.cnpg.io -spec: - group: postgresql.cnpg.io - names: - kind: ScheduledBackup - listKind: ScheduledBackupList - plural: scheduledbackups - singular: scheduledbackup - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - jsonPath: .spec.cluster.name - name: Cluster - type: string - - jsonPath: .status.lastScheduleTime - name: Last Backup - type: date - name: v1 - schema: - openAPIV3Schema: - description: ScheduledBackup is the Schema for the scheduledbackups API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: |- - Specification of the desired behavior of the ScheduledBackup. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - backupOwnerReference: - default: none - description: |- - Indicates which ownerReference should be put inside the created backup resources.
- - none: no owner reference for created backup objects (same behavior as before the field was introduced)
- - self: sets the Scheduled backup object as owner of the backup
- - cluster: set the cluster as owner of the backup
- enum: - - none - - self - - cluster - type: string - cluster: - description: The cluster to backup - properties: - name: - description: Name of the referent. - type: string - required: - - name - type: object - x-kubernetes-validations: - - message: cluster reference is immutable after creation - rule: self == oldSelf - immediate: - description: If the first backup has to be immediately start after - creation or not - type: boolean - method: - default: barmanObjectStore - description: |- - The backup method to be used, possible options are `barmanObjectStore`, - `volumeSnapshot` or `plugin`. Defaults to: `barmanObjectStore`. - enum: - - barmanObjectStore - - volumeSnapshot - - plugin - type: string - online: - description: |- - Whether the default type of backup with volume snapshots is - online/hot (`true`, default) or offline/cold (`false`) - Overrides the default setting specified in the cluster field '.spec.backup.volumeSnapshot.online' - type: boolean - onlineConfiguration: - description: |- - Configuration parameters to control the online/hot backup with volume snapshots - Overrides the default settings specified in the cluster '.backup.volumeSnapshot.onlineConfiguration' stanza - properties: - immediateCheckpoint: - description: |- - Control whether the I/O workload for the backup initial checkpoint will - be limited, according to the `checkpoint_completion_target` setting on - the PostgreSQL server. If set to true, an immediate checkpoint will be - used, meaning PostgreSQL will complete the checkpoint as soon as - possible. `false` by default. - type: boolean - waitForArchive: - default: true - description: |- - If false, the function will return immediately after the backup is completed, - without waiting for WAL to be archived. - This behavior is only useful with backup software that independently monitors WAL archiving. - Otherwise, WAL required to make the backup consistent might be missing and make the backup useless. - By default, or when this parameter is true, pg_backup_stop will wait for WAL to be archived when archiving is - enabled. - On a standby, this means that it will wait only when archive_mode = always. - If write activity on the primary is low, it may be useful to run pg_switch_wal on the primary in order to trigger - an immediate segment switch. - type: boolean - type: object - pluginConfiguration: - description: Configuration parameters passed to the plugin managing - this backup - properties: - name: - description: Name is the name of the plugin managing this backup - type: string - parameters: - additionalProperties: - type: string - description: |- - Parameters are the configuration parameters passed to the backup - plugin for this backup - type: object - required: - - name - type: object - schedule: - description: |- - The schedule does not follow the same format used in Kubernetes CronJobs - as it includes an additional seconds specifier, - see https://pkg.go.dev/github.com/robfig/cron#hdr-CRON_Expression_Format - type: string - suspend: - description: If this backup is suspended or not - type: boolean - target: - description: |- - The policy to decide which instance should perform this backup. If empty, - it defaults to `cluster.spec.backup.target`. - Available options are empty string, `primary` and `prefer-standby`. - `primary` to have backups run always on primary instances, - `prefer-standby` to have backups run preferably on the most updated - standby, if available. - enum: - - primary - - prefer-standby - type: string - required: - - cluster - - schedule - type: object - status: - description: |- - Most recently observed status of the ScheduledBackup. This data may not be up - to date. Populated by the system. Read-only. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - error: - description: Error is the latest admission validation error - type: string - lastCheckTime: - description: The latest time the schedule - format: date-time - type: string - lastScheduleTime: - description: Information when was the last time that backup was successfully - scheduled. - format: date-time - type: string - nextScheduleTime: - description: Next time we will run a backup - format: date-time - type: string - type: object - required: - - metadata - - spec - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.21.0 - name: subscriptions.postgresql.cnpg.io -spec: - group: postgresql.cnpg.io - names: - kind: Subscription - listKind: SubscriptionList - plural: subscriptions - singular: subscription - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - jsonPath: .spec.cluster.name - name: Cluster - type: string - - jsonPath: .spec.name - name: PG Name - type: string - - jsonPath: .status.applied - name: Applied - type: boolean - - description: Latest reconciliation message - jsonPath: .status.message - name: Message - type: string - name: v1 - schema: - openAPIV3Schema: - description: Subscription is the Schema for the subscriptions API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: SubscriptionSpec defines the desired state of Subscription - properties: - cluster: - description: The name of the PostgreSQL cluster that identifies the - "subscriber" - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - type: object - x-kubernetes-map-type: atomic - x-kubernetes-validations: - - message: cluster reference is immutable after creation - rule: self == oldSelf - dbname: - description: |- - The name of the database where the publication will be installed in - the "subscriber" cluster - type: string - x-kubernetes-validations: - - message: dbname is immutable - rule: self == oldSelf - externalClusterName: - description: The name of the external cluster with the publication - ("publisher") - type: string - name: - description: The name of the subscription inside PostgreSQL - type: string - x-kubernetes-validations: - - message: name is immutable - rule: self == oldSelf - parameters: - additionalProperties: - type: string - description: |- - Subscription parameters included in the `WITH` clause of the PostgreSQL - `CREATE SUBSCRIPTION` command. Most parameters cannot be changed - after the subscription is created and will be ignored if modified - later, except for a limited set documented at: - https://www.postgresql.org/docs/current/sql-altersubscription.html#SQL-ALTERSUBSCRIPTION-PARAMS-SET - type: object - publicationDBName: - description: |- - The name of the database containing the publication on the external - cluster. Defaults to the one in the external cluster definition. - type: string - publicationName: - description: |- - The name of the publication inside the PostgreSQL database in the - "publisher" - type: string - subscriptionReclaimPolicy: - default: retain - description: The policy for end-of-life maintenance of this subscription - enum: - - delete - - retain - type: string - required: - - cluster - - dbname - - externalClusterName - - name - - publicationName - type: object - status: - description: SubscriptionStatus defines the observed state of Subscription - properties: - applied: - description: Applied is true if the subscription was reconciled correctly - type: boolean - message: - description: Message is the reconciliation output message - type: string - observedGeneration: - description: |- - A sequence number representing the latest - desired state that was synchronized - format: int64 - type: integer - type: object - required: - - metadata - - spec - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: cnpg-manager - namespace: cnpg-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: cloudnative-pg-kubebuilderv4 - name: cnpg-database-editor-role -rules: -- apiGroups: - - postgresql.cnpg.io - resources: - - databases - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - postgresql.cnpg.io - resources: - - databases/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: cloudnative-pg-kubebuilderv4 - name: cnpg-database-viewer-role -rules: -- apiGroups: - - postgresql.cnpg.io - resources: - - databases - verbs: - - get - - list - - watch -- apiGroups: - - postgresql.cnpg.io - resources: - - databases/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: cnpg-manager -rules: -- apiGroups: - - "" - resources: - - configmaps - - secrets - - services - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - "" - resources: - - configmaps/status - - secrets/status - verbs: - - get - - patch - - update -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch -- apiGroups: - - "" - resources: - - nodes - verbs: - - get - - list - - watch -- apiGroups: - - "" - resources: - - persistentvolumeclaims - - pods - - pods/exec - verbs: - - create - - delete - - get - - list - - patch - - watch -- apiGroups: - - "" - resources: - - pods/status - verbs: - - get -- apiGroups: - - "" - resources: - - serviceaccounts - verbs: - - create - - get - - list - - patch - - update - - watch -- apiGroups: - - admissionregistration.k8s.io - resources: - - mutatingwebhookconfigurations - - validatingwebhookconfigurations - verbs: - - get - - patch -- apiGroups: - - apps - resources: - - deployments - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - batch - resources: - - jobs - verbs: - - create - - delete - - get - - list - - patch - - watch -- apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - create - - get - - list - - update - - watch -- apiGroups: - - discovery.k8s.io - resources: - - endpointslices - verbs: - - get - - list - - watch -- apiGroups: - - monitoring.coreos.com - resources: - - podmonitors - verbs: - - create - - delete - - get - - list - - patch - - watch -- apiGroups: - - policy - resources: - - poddisruptionbudgets - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - postgresql.cnpg.io - resources: - - backups - - clusters - - databaseroles - - databases - - poolers - - publications - - scheduledbackups - - subscriptions - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - postgresql.cnpg.io - resources: - - backups/status - - databases/status - - publications/status - - scheduledbackups/status - - subscriptions/status - verbs: - - get - - patch - - update -- apiGroups: - - postgresql.cnpg.io - resources: - - clusterimagecatalogs - - imagecatalogs - verbs: - - get - - list - - watch -- apiGroups: - - postgresql.cnpg.io - resources: - - clusters/finalizers - - databaseroles/finalizers - - poolers/finalizers - verbs: - - update -- apiGroups: - - postgresql.cnpg.io - resources: - - clusters/status - - databaseroles/status - - failoverquorums/status - - poolers/status - verbs: - - get - - patch - - update - - watch -- apiGroups: - - postgresql.cnpg.io - resources: - - failoverquorums - verbs: - - create - - delete - - get - - list - - watch -- apiGroups: - - rbac.authorization.k8s.io - resources: - - rolebindings - - roles - verbs: - - create - - get - - list - - patch - - update - - watch -- apiGroups: - - snapshot.storage.k8s.io - resources: - - volumesnapshots - verbs: - - create - - get - - list - - patch - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: cloudnative-pg-kubebuilderv4 - name: cnpg-publication-editor-role -rules: -- apiGroups: - - postgresql.cnpg.io - resources: - - publications - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - postgresql.cnpg.io - resources: - - publications/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: cloudnative-pg-kubebuilderv4 - name: cnpg-publication-viewer-role -rules: -- apiGroups: - - postgresql.cnpg.io - resources: - - publications - verbs: - - get - - list - - watch -- apiGroups: - - postgresql.cnpg.io - resources: - - publications/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: cloudnative-pg-kubebuilderv4 - name: cnpg-subscription-editor-role -rules: -- apiGroups: - - postgresql.cnpg.io - resources: - - subscriptions - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - postgresql.cnpg.io - resources: - - subscriptions/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: cloudnative-pg-kubebuilderv4 - name: cnpg-subscription-viewer-role -rules: -- apiGroups: - - postgresql.cnpg.io - resources: - - subscriptions - verbs: - - get - - list - - watch -- apiGroups: - - postgresql.cnpg.io - resources: - - subscriptions/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: cnpg-manager-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: cnpg-manager -subjects: -- kind: ServiceAccount - name: cnpg-manager - namespace: cnpg-system ---- -apiVersion: v1 -data: - queries: | - backends: - query: | - SELECT sa.datname - , sa.usename - , sa.application_name - , states.state - , COALESCE(sa.count, 0) AS total - , COALESCE(sa.max_tx_secs, 0) AS max_tx_duration_seconds - FROM ( VALUES ('active') - , ('idle') - , ('idle in transaction') - , ('idle in transaction (aborted)') - , ('fastpath function call') - , ('disabled') - ) AS states(state) - LEFT JOIN ( - SELECT datname - , state - , usename - , COALESCE(application_name, '') AS application_name - , pg_catalog.count(*) - , COALESCE(EXTRACT (EPOCH FROM (pg_catalog.max(pg_catalog.now() OPERATOR(pg_catalog.-) xact_start))), 0) AS max_tx_secs - FROM pg_catalog.pg_stat_activity - GROUP BY datname, state, usename, application_name - ) sa ON states.state OPERATOR(pg_catalog.=) sa.state - WHERE sa.usename IS NOT NULL - metrics: - - datname: - usage: "LABEL" - description: "Name of the database" - - usename: - usage: "LABEL" - description: "Name of the user" - - application_name: - usage: "LABEL" - description: "Name of the application" - - state: - usage: "LABEL" - description: "State of the backend" - - total: - usage: "GAUGE" - description: "Number of backends" - - max_tx_duration_seconds: - usage: "GAUGE" - description: "Maximum duration of a transaction in seconds" - - backends_waiting: - query: | - SELECT pg_catalog.count(*) AS total - FROM pg_catalog.pg_locks blocked_locks - JOIN pg_catalog.pg_locks blocking_locks - ON blocking_locks.locktype OPERATOR(pg_catalog.=) blocked_locks.locktype - AND blocking_locks.database IS NOT DISTINCT FROM blocked_locks.database - AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation - AND blocking_locks.page IS NOT DISTINCT FROM blocked_locks.page - AND blocking_locks.tuple IS NOT DISTINCT FROM blocked_locks.tuple - AND blocking_locks.virtualxid IS NOT DISTINCT FROM blocked_locks.virtualxid - AND blocking_locks.transactionid IS NOT DISTINCT FROM blocked_locks.transactionid - AND blocking_locks.classid IS NOT DISTINCT FROM blocked_locks.classid - AND blocking_locks.objid IS NOT DISTINCT FROM blocked_locks.objid - AND blocking_locks.objsubid IS NOT DISTINCT FROM blocked_locks.objsubid - AND blocking_locks.pid OPERATOR(pg_catalog.<>) blocked_locks.pid - JOIN pg_catalog.pg_stat_activity blocking_activity ON blocking_activity.pid OPERATOR(pg_catalog.=) blocking_locks.pid - WHERE NOT blocked_locks.granted - metrics: - - total: - usage: "GAUGE" - description: "Total number of backends that are currently waiting on other queries" - - pg_database: - query: | - SELECT datname - , pg_catalog.pg_database_size(datname) AS size_bytes - , pg_catalog.age(datfrozenxid) AS xid_age - , pg_catalog.mxid_age(datminmxid) AS mxid_age - FROM pg_catalog.pg_database - WHERE datallowconn - metrics: - - datname: - usage: "LABEL" - description: "Name of the database" - - size_bytes: - usage: "GAUGE" - description: "Disk space used by the database" - - xid_age: - usage: "GAUGE" - description: "Number of transactions from the frozen XID to the current one" - - mxid_age: - usage: "GAUGE" - description: "Number of multiple transactions (Multixact) from the frozen XID to the current one" - - pg_postmaster: - query: | - SELECT EXTRACT(EPOCH FROM pg_postmaster_start_time) AS start_time - FROM pg_catalog.pg_postmaster_start_time() - metrics: - - start_time: - usage: "GAUGE" - description: "Time at which postgres started (based on epoch)" - - pg_replication: - query: "SELECT CASE WHEN ( - NOT pg_catalog.pg_is_in_recovery() - OR pg_catalog.pg_last_wal_receive_lsn() OPERATOR(pg_catalog.=) pg_catalog.pg_last_wal_replay_lsn()) - THEN 0 - ELSE GREATEST (0, - EXTRACT(EPOCH FROM (pg_catalog.now() OPERATOR(pg_catalog.-) pg_catalog.pg_last_xact_replay_timestamp()))) - END AS lag, - pg_catalog.pg_is_in_recovery() AS in_recovery, - EXISTS (TABLE pg_catalog.pg_stat_wal_receiver) AS is_wal_receiver_up, - (SELECT pg_catalog.count(*) FROM pg_catalog.pg_stat_replication) AS streaming_replicas" - metrics: - - lag: - usage: "GAUGE" - description: "Replication lag behind primary in seconds" - - in_recovery: - usage: "GAUGE" - description: "Whether the instance is in recovery" - - is_wal_receiver_up: - usage: "GAUGE" - description: "Whether the instance wal_receiver is up" - - streaming_replicas: - usage: "GAUGE" - description: "Number of streaming replicas connected to the instance" - - pg_replication_slots: - query: | - SELECT slot_name, - slot_type, - database, - active, - (CASE pg_catalog.pg_is_in_recovery() - WHEN TRUE THEN pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_last_wal_receive_lsn(), restart_lsn) - ELSE pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), restart_lsn) - END) as pg_wal_lsn_diff - FROM pg_catalog.pg_replication_slots - WHERE NOT temporary - metrics: - - slot_name: - usage: "LABEL" - description: "Name of the replication slot" - - slot_type: - usage: "LABEL" - description: "Type of the replication slot" - - database: - usage: "LABEL" - description: "Name of the database" - - active: - usage: "GAUGE" - description: "Flag indicating whether the slot is active" - - pg_wal_lsn_diff: - usage: "GAUGE" - description: "Replication lag in bytes" - - pg_stat_archiver: - query: | - SELECT archived_count - , failed_count - , COALESCE(EXTRACT(EPOCH FROM (pg_catalog.now() OPERATOR(pg_catalog.-) last_archived_time)), -1) AS seconds_since_last_archival - , COALESCE(EXTRACT(EPOCH FROM (pg_catalog.now() OPERATOR(pg_catalog.-) last_failed_time)), -1) AS seconds_since_last_failure - , COALESCE(EXTRACT(EPOCH FROM last_archived_time), -1) AS last_archived_time - , COALESCE(EXTRACT(EPOCH FROM last_failed_time), -1) AS last_failed_time - , COALESCE(CAST(CAST('x' OPERATOR(pg_catalog.||) pg_catalog.right(pg_catalog.split_part(last_archived_wal, '.', 1), 16) AS pg_catalog.bit(64)) AS pg_catalog.int8), -1) AS last_archived_wal_start_lsn - , COALESCE(CAST(CAST('x' OPERATOR(pg_catalog.||) pg_catalog.right(pg_catalog.split_part(last_failed_wal, '.', 1), 16) AS pg_catalog.bit(64)) AS pg_catalog.int8), -1) AS last_failed_wal_start_lsn - , EXTRACT(EPOCH FROM stats_reset) AS stats_reset_time - FROM pg_catalog.pg_stat_archiver - predicate_query: | - SELECT NOT pg_catalog.pg_is_in_recovery() - OR pg_catalog.current_setting('archive_mode') OPERATOR(pg_catalog.=) 'always' - metrics: - - archived_count: - usage: "COUNTER" - description: "Number of WAL files that have been successfully archived" - - failed_count: - usage: "COUNTER" - description: "Number of failed attempts for archiving WAL files" - - seconds_since_last_archival: - usage: "GAUGE" - description: "Seconds since the last successful archival operation" - - seconds_since_last_failure: - usage: "GAUGE" - description: "Seconds since the last failed archival operation" - - last_archived_time: - usage: "GAUGE" - description: "Epoch of the last time WAL archiving succeeded" - - last_failed_time: - usage: "GAUGE" - description: "Epoch of the last time WAL archiving failed" - - last_archived_wal_start_lsn: - usage: "GAUGE" - description: "Archived WAL start LSN" - - last_failed_wal_start_lsn: - usage: "GAUGE" - description: "Last failed WAL LSN" - - stats_reset_time: - usage: "GAUGE" - description: "Time at which these statistics were last reset" - - pg_stat_bgwriter: - runonserver: "<17.0.0" - query: | - SELECT checkpoints_timed - , checkpoints_req - , checkpoint_write_time - , checkpoint_sync_time - , buffers_checkpoint - , buffers_clean - , maxwritten_clean - , buffers_backend - , buffers_backend_fsync - , buffers_alloc - FROM pg_catalog.pg_stat_bgwriter - metrics: - - checkpoints_timed: - usage: "COUNTER" - description: "Number of scheduled checkpoints that have been performed" - - checkpoints_req: - usage: "COUNTER" - description: "Number of requested checkpoints that have been performed" - - checkpoint_write_time: - usage: "COUNTER" - description: "Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds" - - checkpoint_sync_time: - usage: "COUNTER" - description: "Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds" - - buffers_checkpoint: - usage: "COUNTER" - description: "Number of buffers written during checkpoints" - - buffers_clean: - usage: "COUNTER" - description: "Number of buffers written by the background writer" - - maxwritten_clean: - usage: "COUNTER" - description: "Number of times the background writer stopped a cleaning scan because it had written too many buffers" - - buffers_backend: - usage: "COUNTER" - description: "Number of buffers written directly by a backend" - - buffers_backend_fsync: - usage: "COUNTER" - description: "Number of times a backend had to execute its own fsync call (normally the background writer handles those even when the backend does its own write)" - - buffers_alloc: - usage: "COUNTER" - description: "Number of buffers allocated" - - pg_stat_bgwriter_17: - runonserver: ">=17.0.0" - name: pg_stat_bgwriter - query: | - SELECT buffers_clean - , maxwritten_clean - , buffers_alloc - , EXTRACT(EPOCH FROM stats_reset) AS stats_reset_time - FROM pg_catalog.pg_stat_bgwriter - metrics: - - buffers_clean: - usage: "COUNTER" - description: "Number of buffers written by the background writer" - - maxwritten_clean: - usage: "COUNTER" - description: "Number of times the background writer stopped a cleaning scan because it had written too many buffers" - - buffers_alloc: - usage: "COUNTER" - description: "Number of buffers allocated" - - stats_reset_time: - usage: "GAUGE" - description: "Time at which these statistics were last reset" - - pg_stat_checkpointer: - runonserver: ">=17.0.0" - query: | - SELECT num_timed AS checkpoints_timed - , num_requested AS checkpoints_req - , restartpoints_timed - , restartpoints_req - , restartpoints_done - , write_time - , sync_time - , buffers_written - , EXTRACT(EPOCH FROM stats_reset) AS stats_reset_time - FROM pg_catalog.pg_stat_checkpointer - metrics: - - checkpoints_timed: - usage: "COUNTER" - description: "Number of scheduled checkpoints that have been performed" - - checkpoints_req: - usage: "COUNTER" - description: "Number of requested checkpoints that have been performed" - - restartpoints_timed: - usage: "COUNTER" - description: "Number of scheduled restartpoints due to timeout or after a failed attempt to perform it" - - restartpoints_req: - usage: "COUNTER" - description: "Number of requested restartpoints that have been performed" - - restartpoints_done: - usage: "COUNTER" - description: "Number of restartpoints that have been performed" - - write_time: - usage: "COUNTER" - description: "Total amount of time that has been spent in the portion of processing checkpoints and restartpoints where files are written to disk, in milliseconds" - - sync_time: - usage: "COUNTER" - description: "Total amount of time that has been spent in the portion of processing checkpoints and restartpoints where files are synchronized to disk, in milliseconds" - - buffers_written: - usage: "COUNTER" - description: "Number of buffers written during checkpoints and restartpoints" - - stats_reset_time: - usage: "GAUGE" - description: "Time at which these statistics were last reset" - - pg_stat_database: - query: | - SELECT datname - , xact_commit - , xact_rollback - , blks_read - , blks_hit - , tup_returned - , tup_fetched - , tup_inserted - , tup_updated - , tup_deleted - , conflicts - , temp_files - , temp_bytes - , deadlocks - , blk_read_time - , blk_write_time - FROM pg_catalog.pg_stat_database - metrics: - - datname: - usage: "LABEL" - description: "Name of this database" - - xact_commit: - usage: "COUNTER" - description: "Number of transactions in this database that have been committed" - - xact_rollback: - usage: "COUNTER" - description: "Number of transactions in this database that have been rolled back" - - blks_read: - usage: "COUNTER" - description: "Number of disk blocks read in this database" - - blks_hit: - usage: "COUNTER" - description: "Number of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the PostgreSQL buffer cache, not the operating system's file system cache)" - - tup_returned: - usage: "COUNTER" - description: "Number of rows returned by queries in this database" - - tup_fetched: - usage: "COUNTER" - description: "Number of rows fetched by queries in this database" - - tup_inserted: - usage: "COUNTER" - description: "Number of rows inserted by queries in this database" - - tup_updated: - usage: "COUNTER" - description: "Number of rows updated by queries in this database" - - tup_deleted: - usage: "COUNTER" - description: "Number of rows deleted by queries in this database" - - conflicts: - usage: "COUNTER" - description: "Number of queries canceled due to conflicts with recovery in this database" - - temp_files: - usage: "COUNTER" - description: "Number of temporary files created by queries in this database" - - temp_bytes: - usage: "COUNTER" - description: "Total amount of data written to temporary files by queries in this database" - - deadlocks: - usage: "COUNTER" - description: "Number of deadlocks detected in this database" - - blk_read_time: - usage: "COUNTER" - description: "Time spent reading data file blocks by backends in this database, in milliseconds" - - blk_write_time: - usage: "COUNTER" - description: "Time spent writing data file blocks by backends in this database, in milliseconds" - - pg_stat_replication: - primary: true - query: | - SELECT usename - , COALESCE(application_name, '') AS application_name - , COALESCE(client_addr::text, '') AS client_addr - , COALESCE(client_port::text, '') AS client_port - , EXTRACT(EPOCH FROM backend_start) AS backend_start - , COALESCE(pg_catalog.age(backend_xmin), 0) AS backend_xmin_age - , pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), sent_lsn) AS sent_diff_bytes - , pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), write_lsn) AS write_diff_bytes - , pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), flush_lsn) AS flush_diff_bytes - , COALESCE(pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), replay_lsn),0) AS replay_diff_bytes - , COALESCE((EXTRACT(EPOCH FROM write_lag)),0)::float AS write_lag_seconds - , COALESCE((EXTRACT(EPOCH FROM flush_lag)),0)::float AS flush_lag_seconds - , COALESCE((EXTRACT(EPOCH FROM replay_lag)),0)::float AS replay_lag_seconds - FROM pg_catalog.pg_stat_replication - metrics: - - usename: - usage: "LABEL" - description: "Name of the replication user" - - application_name: - usage: "LABEL" - description: "Name of the application" - - client_addr: - usage: "LABEL" - description: "Client IP address" - - client_port: - usage: "LABEL" - description: "Client TCP port" - - backend_start: - usage: "COUNTER" - description: "Time when this process was started" - - backend_xmin_age: - usage: "COUNTER" - description: "The age of this standby's xmin horizon" - - sent_diff_bytes: - usage: "GAUGE" - description: "Difference in bytes from the last write-ahead log location sent on this connection" - - write_diff_bytes: - usage: "GAUGE" - description: "Difference in bytes from the last write-ahead log location written to disk by this standby server" - - flush_diff_bytes: - usage: "GAUGE" - description: "Difference in bytes from the last write-ahead log location flushed to disk by this standby server" - - replay_diff_bytes: - usage: "GAUGE" - description: "Difference in bytes from the last write-ahead log location replayed into the database on this standby server" - - write_lag_seconds: - usage: "GAUGE" - description: "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written it" - - flush_lag_seconds: - usage: "GAUGE" - description: "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written and flushed it" - - replay_lag_seconds: - usage: "GAUGE" - description: "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written, flushed and applied it" - - pg_settings: - query: | - SELECT name, - CASE setting WHEN 'on' THEN '1' WHEN 'off' THEN '0' ELSE setting END AS setting - FROM pg_catalog.pg_settings - WHERE vartype IN ('integer', 'real', 'bool') - ORDER BY 1 - metrics: - - name: - usage: "LABEL" - description: "Name of the setting" - - setting: - usage: "GAUGE" - description: "Setting value" - - pg_extensions: - query: | - SELECT - pg_catalog.current_database() as datname, - name as extname, - default_version, - installed_version, - CASE - WHEN default_version OPERATOR(pg_catalog.=) installed_version THEN 0 - ELSE 1 - END AS update_available - FROM pg_catalog.pg_available_extensions - WHERE installed_version IS NOT NULL - metrics: - - datname: - usage: "LABEL" - description: "Name of the database" - - extname: - usage: "LABEL" - description: "Extension name" - - default_version: - usage: "LABEL" - description: "Default version" - - installed_version: - usage: "LABEL" - description: "Installed version" - - update_available: - usage: "GAUGE" - description: "An update is available" - target_databases: - - '*' -kind: ConfigMap -metadata: - labels: - cnpg.io/reload: "" - name: cnpg-default-monitoring - namespace: cnpg-system ---- -apiVersion: v1 -kind: Service -metadata: - name: cnpg-webhook-service - namespace: cnpg-system -spec: - ports: - - port: 443 - targetPort: 9443 - selector: - app.kubernetes.io/name: cloudnative-pg ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app.kubernetes.io/name: cloudnative-pg - name: cnpg-controller-manager - namespace: cnpg-system -spec: - replicas: 1 - selector: - matchLabels: - app.kubernetes.io/name: cloudnative-pg - template: - metadata: - labels: - app.kubernetes.io/name: cloudnative-pg - spec: - containers: - - args: - - controller - - --leader-elect - - --max-concurrent-reconciles=10 - - --config-map-name=cnpg-controller-manager-config - - --secret-name=cnpg-controller-manager-config - - --webhook-port=9443 - command: - - /manager - env: - - name: OPERATOR_IMAGE_NAME - value: ghcr.io/cloudnative-pg/cloudnative-pg:1.30.0 - - name: OPERATOR_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: MONITORING_QUERIES_CONFIGMAP - value: cnpg-default-monitoring - image: ghcr.io/cloudnative-pg/cloudnative-pg:1.30.0 - imagePullPolicy: Always - livenessProbe: - httpGet: - path: /readyz - port: 9443 - scheme: HTTPS - name: manager - ports: - - containerPort: 8080 - name: metrics - protocol: TCP - - containerPort: 9443 - name: webhook-server - protocol: TCP - readinessProbe: - httpGet: - path: /readyz - port: 9443 - scheme: HTTPS - resources: - limits: - cpu: 100m - memory: 200Mi - requests: - cpu: 100m - memory: 100Mi - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - readOnlyRootFilesystem: true - runAsGroup: 10001 - runAsUser: 10001 - seccompProfile: - type: RuntimeDefault - startupProbe: - failureThreshold: 6 - httpGet: - path: /readyz - port: 9443 - scheme: HTTPS - periodSeconds: 5 - volumeMounts: - - mountPath: /controller - name: scratch-data - - mountPath: /run/secrets/cnpg.io/webhook - name: webhook-certificates - securityContext: - runAsNonRoot: true - seccompProfile: - type: RuntimeDefault - serviceAccountName: cnpg-manager - terminationGracePeriodSeconds: 10 - volumes: - - emptyDir: {} - name: scratch-data - - name: webhook-certificates - secret: - defaultMode: 420 - optional: true - secretName: cnpg-webhook-cert ---- -apiVersion: admissionregistration.k8s.io/v1 -kind: MutatingWebhookConfiguration -metadata: - name: cnpg-mutating-webhook-configuration -webhooks: -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: cnpg-webhook-service - namespace: cnpg-system - path: /mutate-postgresql-cnpg-io-v1-backup - failurePolicy: Fail - name: mbackup.cnpg.io - rules: - - apiGroups: - - postgresql.cnpg.io - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - backups - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: cnpg-webhook-service - namespace: cnpg-system - path: /mutate-postgresql-cnpg-io-v1-cluster - failurePolicy: Fail - name: mcluster.cnpg.io - rules: - - apiGroups: - - postgresql.cnpg.io - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - clusters - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: cnpg-webhook-service - namespace: cnpg-system - path: /mutate-postgresql-cnpg-io-v1-database - failurePolicy: Fail - name: mdatabase.cnpg.io - rules: - - apiGroups: - - postgresql.cnpg.io - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - databases - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: cnpg-webhook-service - namespace: cnpg-system - path: /mutate-postgresql-cnpg-io-v1-scheduledbackup - failurePolicy: Fail - name: mscheduledbackup.cnpg.io - rules: - - apiGroups: - - postgresql.cnpg.io - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - scheduledbackups - sideEffects: None ---- -apiVersion: admissionregistration.k8s.io/v1 -kind: ValidatingWebhookConfiguration -metadata: - name: cnpg-validating-webhook-configuration -webhooks: -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: cnpg-webhook-service - namespace: cnpg-system - path: /validate-postgresql-cnpg-io-v1-backup - failurePolicy: Fail - name: vbackup.cnpg.io - rules: - - apiGroups: - - postgresql.cnpg.io - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - backups - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: cnpg-webhook-service - namespace: cnpg-system - path: /validate-postgresql-cnpg-io-v1-cluster - failurePolicy: Fail - name: vcluster.cnpg.io - rules: - - apiGroups: - - postgresql.cnpg.io - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - clusters - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: cnpg-webhook-service - namespace: cnpg-system - path: /validate-postgresql-cnpg-io-v1-database - failurePolicy: Fail - name: vdatabase.cnpg.io - rules: - - apiGroups: - - postgresql.cnpg.io - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - databases - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: cnpg-webhook-service - namespace: cnpg-system - path: /validate-postgresql-cnpg-io-v1-pooler - failurePolicy: Fail - name: vpooler.cnpg.io - rules: - - apiGroups: - - postgresql.cnpg.io - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - poolers - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: cnpg-webhook-service - namespace: cnpg-system - path: /validate-postgresql-cnpg-io-v1-scheduledbackup - failurePolicy: Fail - name: vscheduledbackup.cnpg.io - rules: - - apiGroups: - - postgresql.cnpg.io - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - scheduledbackups - sideEffects: None diff --git a/infrastructure/databases/base/upstream/plugin-barman-cloud-0.16.0.yaml b/infrastructure/databases/base/upstream/plugin-barman-cloud-0.16.0.yaml deleted file mode 100644 index 707fa7f..0000000 --- a/infrastructure/databases/base/upstream/plugin-barman-cloud-0.16.0.yaml +++ /dev/null @@ -1,1157 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.23.0 - name: objectstores.barmancloud.cnpg.io -spec: - group: barmancloud.cnpg.io - names: - kind: ObjectStore - listKind: ObjectStoreList - plural: objectstores - singular: objectstore - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - description: ObjectStore is the Schema for the objectstores API. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: |- - Specification of the desired behavior of the ObjectStore. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - configuration: - description: The configuration for the barman-cloud tool suite - properties: - azureCredentials: - description: The credentials to use to upload data to Azure Blob - Storage - properties: - connectionString: - description: The connection string to be used - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - inheritFromAzureAD: - description: Use the Azure AD based authentication without - providing explicitly the keys. - type: boolean - storageAccount: - description: The storage account where to upload data - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - storageKey: - description: |- - The storage account key to be used in conjunction - with the storage account name - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - storageSasToken: - description: |- - A shared-access-signature to be used in conjunction with - the storage account name - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - useDefaultAzureCredentials: - description: |- - Use the default Azure authentication flow, which includes DefaultAzureCredential. - This allows authentication using environment variables and managed identities. - type: boolean - type: object - data: - description: |- - The configuration to be used to backup the data files - When not defined, base backups files will be stored uncompressed and may - be unencrypted in the object store, according to the bucket default - policy. - properties: - additionalCommandArgs: - description: |- - AdditionalCommandArgs represents additional arguments that can be appended - to the 'barman-cloud-backup' command-line invocation. These arguments - provide flexibility to customize the backup process further according to - specific requirements or configurations. - - Example: - In a scenario where specialized backup options are required, such as setting - a specific timeout or defining custom behavior, users can use this field - to specify additional command arguments. - - Note: - It's essential to ensure that the provided arguments are valid and supported - by the 'barman-cloud-backup' command, to avoid potential errors or unintended - behavior during execution. - items: - type: string - type: array - compression: - description: |- - Compress a backup file (a tar file per tablespace) while streaming it - to the object store. Available options are empty string (no - compression, default), `gzip`, `bzip2`, `lz4`, `snappy`, and `zstd`. - enum: - - bzip2 - - gzip - - lz4 - - snappy - - zstd - type: string - encryption: - description: |- - Whenever to force the encryption of files (if the bucket is - not already configured for that). - Allowed options are empty string (use the bucket policy, default), - `AES256` and `aws:kms` - enum: - - AES256 - - aws:kms - type: string - immediateCheckpoint: - description: |- - Control whether the I/O workload for the backup initial checkpoint will - be limited, according to the `checkpoint_completion_target` setting on - the PostgreSQL server. If set to true, an immediate checkpoint will be - used, meaning PostgreSQL will complete the checkpoint as soon as - possible. `false` by default. - type: boolean - jobs: - description: |- - The number of parallel jobs to be used to upload the backup, defaults - to 2 - format: int32 - minimum: 1 - type: integer - restoreAdditionalCommandArgs: - description: |- - Additional arguments that can be appended to the 'barman-cloud-restore' - command-line invocation. These arguments provide flexibility to customize - the data restore process further, according to specific requirements or - configurations. - - Example: - In a scenario where specialized restore options are required, such as setting - a specific read timeout or defining custom behavior, users can use this field - to specify additional command arguments. - - Note: - It's essential to ensure that the provided arguments are valid and supported - by the 'barman-cloud-restore' command, to avoid potential errors or unintended - behavior during execution. - items: - type: string - type: array - type: object - destinationPath: - description: |- - The path where to store the backup (i.e. s3://bucket/path/to/folder) - this path, with different destination folders, will be used for WALs - and for data - minLength: 1 - type: string - endpointCA: - description: |- - EndpointCA store the CA bundle of the barman endpoint. - Useful when using self-signed certificates to avoid - errors with certificate issuer and barman-cloud-wal-archive - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - endpointURL: - description: |- - Endpoint to be used to upload data to the cloud, - overriding the automatic endpoint discovery - type: string - googleCredentials: - description: The credentials to use to upload data to Google Cloud - Storage - properties: - applicationCredentials: - description: The secret containing the Google Cloud Storage - JSON file with the credentials - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - gkeEnvironment: - description: |- - If set to true, will presume that it's running inside a GKE environment, - default to false. - type: boolean - type: object - historyTags: - additionalProperties: - type: string - description: |- - HistoryTags is a list of key value pairs that will be passed to the - Barman --history-tags option. - type: object - s3AddressingStyle: - description: |- - How bucket names appear in S3 requests: `virtual` (bucket.endpoint/key), - `path` (endpoint/bucket/key) or `auto` (boto3 decides, same as unset). - Requires s3Credentials and Barman 3.18 or later. - enum: - - auto - - virtual - - path - type: string - s3Credentials: - description: The credentials to use to upload data to S3 - properties: - accessKeyId: - description: The reference to the access key id - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - inheritFromIAMRole: - description: Use the role based authentication without providing - explicitly the keys. - type: boolean - region: - description: The reference to the secret containing the region - name - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - secretAccessKey: - description: The reference to the secret access key - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - sessionToken: - description: The references to the session key - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - sseCustomerKey: - description: |- - Reference to the secret holding the key for Server-Side Encryption with - Customer-provided keys (SSE-C): a base64-encoded 256-bit AES key. - barman-cloud uses it to encrypt the objects it uploads and to read them - back. Meant for S3-compatible providers that only support SSE-C - (e.g. Hetzner Object Storage). Cannot be combined with `encryption`. - Works with any authentication method. Changing the key makes the - existing objects unreadable: use a new `destinationPath` or `serverName`. - properties: - key: - description: The key to select - type: string - name: - description: Name of the referent. - type: string - required: - - key - - name - type: object - type: object - serverName: - description: |- - The server name on S3, the cluster name is used if this - parameter is omitted - type: string - tags: - additionalProperties: - type: string - description: |- - Tags is a list of key value pairs that will be passed to the - Barman --tags option. - type: object - wal: - description: |- - The configuration for the backup of the WAL stream. - When not defined, WAL files will be stored uncompressed and may be - unencrypted in the object store, according to the bucket default policy. - properties: - archiveAdditionalCommandArgs: - description: |- - Additional arguments that can be appended to the 'barman-cloud-wal-archive' - command-line invocation. These arguments provide flexibility to customize - the WAL archive process further, according to specific requirements or configurations. - - Example: - In a scenario where specialized backup options are required, such as setting - a specific timeout or defining custom behavior, users can use this field - to specify additional command arguments. - - Note: - It's essential to ensure that the provided arguments are valid and supported - by the 'barman-cloud-wal-archive' command, to avoid potential errors or unintended - behavior during execution. - items: - type: string - type: array - compression: - description: |- - Compress a WAL file before sending it to the object store. Available - options are empty string (no compression, default), `gzip`, `bzip2`, - `lz4`, `snappy`, `xz`, and `zstd`. - enum: - - bzip2 - - gzip - - lz4 - - snappy - - xz - - zstd - type: string - encryption: - description: |- - Whenever to force the encryption of files (if the bucket is - not already configured for that). - Allowed options are empty string (use the bucket policy, default), - `AES256` and `aws:kms` - enum: - - AES256 - - aws:kms - type: string - maxParallel: - description: |- - Number of WAL files to be either archived in parallel (when the - PostgreSQL instance is archiving to a backup object store) or - restored in parallel (when a PostgreSQL standby is fetching WAL - files from a recovery object store). If not specified, WAL files - will be processed one at a time. It accepts a positive integer as a - value - with 1 being the minimum accepted value. - minimum: 1 - type: integer - restoreAdditionalCommandArgs: - description: |- - Additional arguments that can be appended to the 'barman-cloud-wal-restore' - command-line invocation. These arguments provide flexibility to customize - the WAL restore process further, according to specific requirements or configurations. - - Example: - In a scenario where specialized backup options are required, such as setting - a specific timeout or defining custom behavior, users can use this field - to specify additional command arguments. - - Note: - It's essential to ensure that the provided arguments are valid and supported - by the 'barman-cloud-wal-restore' command, to avoid potential errors or unintended - behavior during execution. - items: - type: string - type: array - type: object - required: - - destinationPath - type: object - x-kubernetes-validations: - - fieldPath: .serverName - message: use the 'serverName' plugin parameter in the Cluster resource - reason: FieldValueForbidden - rule: '!has(self.serverName)' - - fieldPath: .data.encryption - message: cannot be used together with s3Credentials.sseCustomerKey - reason: FieldValueForbidden - rule: '!has(self.s3Credentials) || !has(self.s3Credentials.sseCustomerKey) - || !has(self.data) || !has(self.data.encryption)' - - fieldPath: .wal.encryption - message: cannot be used together with s3Credentials.sseCustomerKey - reason: FieldValueForbidden - rule: '!has(self.s3Credentials) || !has(self.s3Credentials.sseCustomerKey) - || !has(self.wal) || !has(self.wal.encryption)' - - fieldPath: .s3AddressingStyle - message: s3AddressingStyle requires s3Credentials - reason: FieldValueForbidden - rule: '!has(self.s3AddressingStyle) || has(self.s3Credentials)' - instanceSidecarConfiguration: - description: The configuration for the sidecar that runs in the instance - pods - properties: - additionalContainerArgs: - description: |- - AdditionalContainerArgs is an optional list of command-line arguments - to be passed to the sidecar container when it starts. - The provided arguments are appended to the container’s default arguments. - items: - type: string - type: array - x-kubernetes-validations: - - message: do not set --log-level in additionalContainerArgs; - use spec.instanceSidecarConfiguration.logLevel - reason: FieldValueForbidden - rule: '!self.exists(a, a.startsWith(''--log-level''))' - env: - description: The environment to be explicitly passed to the sidecar - items: - description: EnvVar represents an environment variable present - in a Container. - properties: - name: - description: |- - Name of the environment variable. - May consist of any printable ASCII characters except '='. - type: string - value: - description: |- - Variable references $(VAR_NAME) are expanded - using the previously defined environment variables in the container and - any service environment variables. If a variable cannot be resolved, - the reference in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. - "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". - Escaped references will never be expanded, regardless of whether the variable - exists or not. - Defaults to "". - type: string - valueFrom: - description: Source for the environment variable's value. - Cannot be used if value is not empty. - properties: - configMapKeyRef: - description: Selects a key of a ConfigMap. - properties: - key: - description: |- - The key to select from the ConfigMap's Data field. - Keys in the BinaryData field are not currently propagated to container env vars. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the ConfigMap or its - key must be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - fieldRef: - description: |- - Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, - spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. - properties: - apiVersion: - description: Version of the schema the FieldPath - is written in terms of, defaults to "v1". - type: string - fieldPath: - description: Path of the field to select in the - specified API version. - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - fileKeyRef: - description: |- - FileKeyRef selects a key of the env file. - Requires the EnvFiles feature gate to be enabled. - properties: - key: - description: |- - The key within the env file. An invalid key will prevent the pod from starting. - The keys defined within a source may consist of any printable ASCII characters except '='. - During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters. - type: string - optional: - default: false - description: |- - Specify whether the file or its key must be defined. If the file or key - does not exist, then the env var is not published. - If optional is set to true and the specified key does not exist, - the environment variable will not be set in the Pod's containers. - - If optional is set to false and the specified key does not exist, - an error will be returned during Pod creation. - type: boolean - path: - description: |- - The path within the volume from which to select the file. - Must be relative and may not contain the '..' path or start with '..'. - type: string - volumeName: - description: The name of the volume mount containing - the env file. - type: string - required: - - key - - path - - volumeName - type: object - x-kubernetes-map-type: atomic - resourceFieldRef: - description: |- - Selects a resource of the container: only resources limits and requests - (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. - properties: - containerName: - description: 'Container name: required for volumes, - optional for env vars' - type: string - divisor: - anyOf: - - type: integer - - type: string - description: Specifies the output format of the - exposed resources, defaults to "1" - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - description: 'Required: resource to select' - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - secretKeyRef: - description: Selects a key of a secret in the pod's - namespace - properties: - key: - description: The key of the secret to select from. Must - be a valid secret key. - type: string - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - optional: - description: Specify whether the Secret or its key - must be defined - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - type: object - required: - - name - type: object - type: array - logLevel: - default: info - description: 'The log level for PostgreSQL instances. Valid values - are: `error`, `warning`, `info` (default), `debug`, `trace`' - enum: - - error - - warning - - info - - debug - - trace - type: string - resources: - description: Resources define cpu/memory requests and limits for - the sidecar that runs in the instance pods. - properties: - claims: - description: |- - Claims lists the names of resources, defined in spec.resourceClaims, - that are used by this container. - - This field depends on the - DynamicResourceAllocation feature gate. - - This field is immutable. It can only be set for containers. - items: - description: ResourceClaim references one entry in PodSpec.ResourceClaims. - properties: - name: - description: |- - Name must match the name of one entry in pod.spec.resourceClaims of - the Pod where this field is used. It makes that resource available - inside a container. - type: string - request: - description: |- - Request is the name chosen for a request in the referenced claim. - If empty, everything from the claim is made available, otherwise - only the result of this request. - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Limits describes the maximum amount of compute resources allowed. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Requests describes the minimum amount of compute resources required. - If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. Requests cannot exceed Limits. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - type: object - retentionPolicyIntervalSeconds: - default: 1800 - description: |- - The retentionCheckInterval defines the frequency at which the - system checks and enforces retention policies. - type: integer - type: object - retentionPolicy: - description: |- - RetentionPolicy is the retention policy to be used for backups - and WALs (i.e. '60d'). The retention policy is expressed in the form - of `XXu` where `XX` is a positive integer and `u` is in `[dwm]` - - days, weeks, months. - pattern: ^[1-9][0-9]*[dwm]$ - type: string - required: - - configuration - type: object - status: - description: |- - Most recently observed status of the ObjectStore. This data may not be up to - date. Populated by the system. Read-only. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - properties: - serverRecoveryWindow: - additionalProperties: - description: |- - RecoveryWindow represents the time span between the first - recoverability point and the last successful backup of a PostgreSQL - server, defining the period during which data can be restored. - properties: - firstRecoverabilityPoint: - description: |- - The first recoverability point in a PostgreSQL server refers to - the earliest point in time to which the database can be - restored. - format: date-time - type: string - lastFailedBackupTime: - description: The last failed backup time - format: date-time - type: string - lastSuccessfulBackupTime: - description: The last successful backup time - format: date-time - type: string - type: object - description: ServerRecoveryWindow maps each server to its recovery - window - type: object - type: object - required: - - metadata - - spec - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: plugin-barman-cloud - name: plugin-barman-cloud - namespace: cnpg-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: plugin-barman-cloud - name: barman-plugin-leader-election-role - namespace: cnpg-system -rules: -- apiGroups: - - "" - resources: - - configmaps - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: barman-plugin-metrics-auth-role -rules: -- apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: barman-plugin-metrics-reader -rules: -- nonResourceURLs: - - /metrics - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: plugin-barman-cloud - name: barman-plugin-objectstore-editor-role -rules: -- apiGroups: - - barmancloud.cnpg.io - resources: - - objectstores - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - barmancloud.cnpg.io - resources: - - objectstores/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: plugin-barman-cloud - name: barman-plugin-objectstore-viewer-role -rules: -- apiGroups: - - barmancloud.cnpg.io - resources: - - objectstores - verbs: - - get - - list - - watch -- apiGroups: - - barmancloud.cnpg.io - resources: - - objectstores/status - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: plugin-barman-cloud -rules: -- apiGroups: - - "" - resources: - - secrets - verbs: - - create - - delete - - get - - list - - watch -- apiGroups: - - barmancloud.cnpg.io - resources: - - objectstores - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - barmancloud.cnpg.io - resources: - - objectstores/finalizers - verbs: - - update -- apiGroups: - - barmancloud.cnpg.io - resources: - - objectstores/status - verbs: - - get - - patch - - update -- apiGroups: - - postgresql.cnpg.io - resources: - - backups - verbs: - - get - - list - - watch -- apiGroups: - - postgresql.cnpg.io - resources: - - clusters/finalizers - verbs: - - update -- apiGroups: - - rbac.authorization.k8s.io - resources: - - rolebindings - - roles - verbs: - - create - - get - - list - - patch - - update - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: plugin-barman-cloud - name: barman-plugin-leader-election-rolebinding - namespace: cnpg-system -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: barman-plugin-leader-election-role -subjects: -- kind: ServiceAccount - name: plugin-barman-cloud - namespace: cnpg-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: barman-plugin-metrics-auth-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: barman-plugin-metrics-auth-role -subjects: -- kind: ServiceAccount - name: plugin-barman-cloud - namespace: cnpg-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: plugin-barman-cloud - name: plugin-barman-cloud-binding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: plugin-barman-cloud -subjects: -- kind: ServiceAccount - name: plugin-barman-cloud - namespace: cnpg-system ---- -apiVersion: v1 -data: - SIDECAR_IMAGE: | - Z2hjci5pby9jbG91ZG5hdGl2ZS1wZy9wbHVnaW4tYmFybWFuLWNsb3VkLXNpZGVjYXI6dj - AuMTYuMA== -kind: Secret -metadata: - name: plugin-barman-cloud-5kkd8f288d - namespace: cnpg-system -type: Opaque ---- -apiVersion: v1 -kind: Service -metadata: - annotations: - cnpg.io/pluginClientSecret: barman-cloud-client-tls - cnpg.io/pluginPort: "9090" - cnpg.io/pluginServerSecret: barman-cloud-server-tls - labels: - app: barman-cloud - cnpg.io/pluginName: barman-cloud.cloudnative-pg.io - name: barman-cloud - namespace: cnpg-system -spec: - ports: - - port: 9090 - protocol: TCP - targetPort: 9090 - selector: - app: barman-cloud ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app: barman-cloud - name: barman-cloud - namespace: cnpg-system -spec: - replicas: 1 - selector: - matchLabels: - app: barman-cloud - strategy: - type: Recreate - template: - metadata: - labels: - app: barman-cloud - spec: - containers: - - args: - - operator - - --server-cert=/server/tls.crt - - --server-key=/server/tls.key - - --client-cert=/client/tls.crt - - --server-address=:9090 - - --leader-elect - - --log-level=debug - env: - - name: SIDECAR_IMAGE - valueFrom: - secretKeyRef: - key: SIDECAR_IMAGE - name: plugin-barman-cloud-5kkd8f288d - image: ghcr.io/cloudnative-pg/plugin-barman-cloud:v0.16.0 - name: barman-cloud - ports: - - containerPort: 9090 - protocol: TCP - readinessProbe: - initialDelaySeconds: 10 - periodSeconds: 10 - tcpSocket: - port: 9090 - resources: {} - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - readOnlyRootFilesystem: true - runAsGroup: 10001 - runAsUser: 10001 - seccompProfile: - type: RuntimeDefault - volumeMounts: - - mountPath: /server - name: server - - mountPath: /client - name: client - securityContext: - runAsNonRoot: true - seccompProfile: - type: RuntimeDefault - serviceAccountName: plugin-barman-cloud - volumes: - - name: server - secret: - secretName: barman-cloud-server-tls - - name: client - secret: - secretName: barman-cloud-client-tls ---- -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - name: barman-cloud-client - namespace: cnpg-system -spec: - commonName: barman-cloud-client - duration: 2160h - isCA: false - issuerRef: - group: cert-manager.io - kind: Issuer - name: selfsigned-issuer - renewBefore: 360h - secretName: barman-cloud-client-tls - usages: - - client auth ---- -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - name: barman-cloud-server - namespace: cnpg-system -spec: - commonName: barman-cloud - dnsNames: - - barman-cloud - duration: 2160h - isCA: false - issuerRef: - group: cert-manager.io - kind: Issuer - name: selfsigned-issuer - renewBefore: 360h - secretName: barman-cloud-server-tls - usages: - - server auth ---- -apiVersion: cert-manager.io/v1 -kind: Issuer -metadata: - name: selfsigned-issuer - namespace: cnpg-system -spec: - selfSigned: {} diff --git a/infrastructure/garage-linode/README.md b/infrastructure/garage-linode/README.md deleted file mode 100644 index 6ee6737..0000000 --- a/infrastructure/garage-linode/README.md +++ /dev/null @@ -1,157 +0,0 @@ -# Garage on the Linode — the CloudNativePG WAL archive - -A **second, independent** single-node Garage on the Linode VPS. It holds one -bucket, `pg-wal-archive`, and its only consumer is the **CNPG-I Barman Cloud -plugin** archiving for `sirius-growth/portal` (continuous WAL archiving + daily -base backups → point-in-time recovery). - -It is **not** the Pi's Garage (`infrastructure/garage/`, node -`d053db4dfc97bf78`). Different host, different `node_key`, different metadata -dir, no RPC peering, nothing shared. That is the whole point: - -> The CNPG primary runs on `siriussec` in the same building, on the same power -> domain and the same uplink as the Pi. A WAL archive on the Pi would be a second -> copy of the same failure. The archive has to be off-site; the Linode is the -> only off-site box in this estate. - -## What runs - -| | | -|---|---| -| Host | Linode VPS, Kubernetes node `linode`, WireGuard `10.10.0.5` (`dummy-k8s`), hub `10.20.0.1` on `wg0` | -| Runtime | **podman 5.4** + a quadlet unit. This host is a kubelet node: installing `dockerd` next to the kubelet's containerd would add a second container runtime for no benefit, so the Pi's compose file cannot be reused verbatim | -| Unit | `/etc/containers/systemd/garage.container` → generated `garage.service` (`Restart=always`) | -| Image | `dxflrs/garage:v1.1.0` (same pinned tag as the Pi) | -| Config | `/etc/garage/garage.toml` (installed from this directory) | -| RPC secret | `/etc/garage/garage.env` → `GARAGE_RPC_SECRET`, `0600 root:root`, **not in git** | -| State | `/var/lib/garage/meta` (metadata, `node_key`) and `/var/lib/garage/data` (objects) | -| Node | `994fd2f42ae72da6`, zone `dc1`, capacity **20 GB**, `replication_factor = 1` | -| Bucket | `pg-wal-archive` — private, `Website access: false` | - -## Exposure — WireGuard only, twice - -1. `garage.toml` binds `10.10.0.5:3900` (S3) and `10.10.0.5:3903` (admin/metrics) - explicitly. There is no `0.0.0.0` listener and `eth0` (the public IP) is never - bound, so `ss -ltn` is proof by itself. -2. `host/wal-archive-firewall.nft` is an nftables table in **PREROUTING priority - -140** that accepts 3900/3903 only from `lo`/`wg0` (plus source - `10.244.0.0/16` for pods on this node) and **drops** everything else, with - counters on every rule. podman with `Network=host` does not need DNAT, but - the table keeps a future port mapping from reopening the path — and ufw alone - would not cover a container publish, exactly as on the Pi. - -Measured (2026-11-19), from the laptop **straight to the Linode's public IP with -no VPN in the path**: 3900 and 3903 both `filtered`, and -`nft list table inet wal_archive_guard` shows the drop counter incrementing. -Anonymous `GET http://10.10.0.5:3900/pg-wal-archive/` → **403 AccessDenied**. - -## Install / re-install - -```bash -# on the Linode, from a checkout of sirius/homek8s -cd infrastructure/garage-linode -sudo ./install.sh -``` - -`install.sh` is idempotent: it installs podman if missing, writes -`/etc/garage/{garage.toml,garage.env}` (generating the RPC secret once), installs -the quadlet unit and the nft guard **before** starting the container, then -assigns the layout capacity on first run (`layout assign -z dc1 -c 20G`) and -prints `garage status` + the listener set. - -Verify (all four must hold): - -```bash -systemctl status garage.service --no-pager | head -3 -ss -ltnH 'sport = :3900 or sport = :3903' # only 10.10.0.5, never 0.0.0.0 -podman exec garage /garage -c /etc/garage.toml status # node 994fd2f42ae72da6, HEALTHY -nft list table inet wal_archive_guard # counters on accept and drop -``` - -## Bucket and key - -```bash -G() { podman exec garage /garage -c /etc/garage.toml "$@"; } -G bucket create pg-wal-archive -G key create cnpg-portal-wal # prints the secret once — capture it -G bucket allow --read --write pg-wal-archive --key cnpg-portal-wal -G bucket info pg-wal-archive # Website access: false -``` - -Key ID `GK7f2b4bb1fc9abaec50fde37b` (`cnpg-portal-wal`), scope **read+write on -`pg-wal-archive` only** — no bucket-create, no other bucket, not an admin key. -The secret lives in the cluster as Secret `sirius-growth/portal-wal-s3` -(`ACCESS_KEY_ID`, `ACCESS_SECRET_KEY`, `REGION=garage`), created out of band and -**never committed**. Garage v1.1 has no `--yes` on `key create`; the secret is -printed exactly once, so redirect it to a `0600` root file and read it from there. - -## Disk sizing and retention - -Measured 2026-11-19: - -| | | -|---|---| -| Linode `/` | 79 GB, 29 GB used, **46 GB free** | -| Garage capacity | **20 GB** (layout), i.e. the store stops accepting before the disk does | -| First base backup + 7 WAL segments | **4.9 MB** in 8 bucket objects (`/var/lib/garage/data` 9.3 MB including Garage's block-store overhead, `meta` 4.6 MB) | -| `archive_timeout` / `wal_segment_size` on the primary | 5 min / 16 MB → at most 288 segments/day | -| Observed compressed segment | 16–25 KB when the portal is quiet | -| Steady state (quiet) | ~6 MB WAL/day + 4.5 MB base backup/day ≈ **150 MB per 14-day window** | -| Worst case (every segment full, 3–5× gzip) | ~1.5 GB/day ≈ 21 GB per 14 days — would hit the cap | - -Retention is `spec.retentionPolicy: "14d"` on the `ObjectStore` (`portal-wal` in -`sirius-growth`), enforced by the plugin's instance sidecar (every 30 min), not -by the Cluster. The 20 GB cap is deliberate: when it is -reached Garage returns `507 InsufficientStorage` and the `Backup` / -`ScheduledBackup` goes red — a visible failure instead of a full Linode disk. -The response to that is to lower the retention policy to `7d`, or to grow the -Linode disk; never to delete WALs by hand (that breaks the archive's -continuity and every PITR target that depends on the deleted segment). - -## How the archive is laid out - -`destinationPath: s3://pg-wal-archive` (bucket root) with the barman server name -explicitly set to the cluster name (`Cluster.spec.plugins[].parameters.serverName: -portal`), so: - -``` -pg-wal-archive/portal/base/20261119T223452/{backup.info,data.tar.gz} -pg-wal-archive/portal/wals/0000000100000000/00000001000000000000005A.gz -``` - -That is one prefix per cluster, which is what lets `forgejo/pg` share this bucket -later without colliding. Listing it (the postgres container has no credentials in -its own environment; the Secret does): - -```bash -kubectl -n sirius-growth run wal-list --rm -it --restart=Never \ - --image=public.ecr.aws/aws-cli/aws-cli:2.15.30 \ - --overrides='{"spec":{"containers":[{"name":"aws","image":"public.ecr.aws/aws-cli/aws-cli:2.15.30", - "envFrom":[{"secretRef":{"name":"portal-wal-s3"}}], - "command":["sh","-c","export AWS_ACCESS_KEY_ID=$ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$ACCESS_SECRET_KEY AWS_DEFAULT_REGION=$REGION; aws --endpoint-url http://10.10.0.5:3900 s3 ls --recursive --human-readable s3://pg-wal-archive/"]}]}}' -``` - -## Restore - -Point-in-time recovery is a **cluster restore**, not a file copy. The full -rehearsed recipe (marker → restore to `targetTime` → verify) is §8.3 of -`docs/cluster-overview.md`; `pitr-restore.md` in this directory is the -self-contained version with the commands and the acceptance output. - -Short form: a throwaway `Cluster` with `bootstrap.recovery.source` pointing at an -`externalClusters` entry (`serverName: portal`, the same bucket and Secret) and -`recoveryTarget.targetTime`, then promote/cut over. Recovery needs the **base -backup** plus every WAL segment up to the target — one missing segment is a -failed restore, which is why the archive is never pruned by hand. - -## What this store is *not* - -- **Not a cluster peer of the Pi's Garage.** No `[rpc]` peering, no shared - `rpc_secret`, no replicated data. Two independent single-node stores. -- **Not Flux-managed.** Flux watches `./clusters/homek8s`; nothing there - references this directory. A push changes nothing on the Linode until - `install.sh` runs. -- **Not a general-purpose bucket host.** One bucket, one key, one consumer. Put - application media on the Pi's store; this one exists to be off-site. -- **Not exposed to the LAN or the internet**, and no Cloudflare tunnel, DNS - record or public bucket will be added to it. diff --git a/infrastructure/garage-linode/garage.container b/infrastructure/garage-linode/garage.container deleted file mode 100644 index 08435d3..0000000 --- a/infrastructure/garage-linode/garage.container +++ /dev/null @@ -1,38 +0,0 @@ -# Quadlet unit — Garage WAL archive on the Linode hub (10.10.0.5). -# -# Installed to /etc/containers/systemd/garage.container by install.sh; the -# podman systemd generator turns it into `garage.service` on the next -# `systemctl daemon-reload`. There is no docker on this host (it is a kubelet -# node — installing dockerd here would add a second container runtime next to -# the kubelet's containerd for no reason), so the Pi's compose file cannot be -# reused verbatim. Quadlet is the podman-native equivalent: one declarative -# file, systemd owns the lifecycle, no daemon of its own. -# -# Network=host on purpose: the container binds 10.10.0.5:3900 from garage.toml -# directly, so the published addresses are visible in `ss -lnt` on the host and -# no podman port-forwarding rules are injected into the node's netfilter state. - -[Unit] -Description=Garage S3 — CloudNativePG WAL archive (WireGuard-only) -Documentation=file:///etc/garage/README.md -After=network-online.target -Wants=network-online.target - -[Container] -ContainerName=garage -Image=docker.io/dxflrs/garage:v1.1.0 -Network=host -EnvironmentFile=/etc/garage/garage.env -Volume=/etc/garage/garage.toml:/etc/garage.toml:ro -Volume=/var/lib/garage/meta:/data/meta -Volume=/var/lib/garage/data:/data/data -Exec=/garage -c /etc/garage.toml server -LogDriver=journald - -[Service] -Restart=always -TimeoutStartSec=120 -TimeoutStopSec=60 - -[Install] -WantedBy=multi-user.target diff --git a/infrastructure/garage-linode/garage.toml b/infrastructure/garage-linode/garage.toml deleted file mode 100644 index 169602b..0000000 --- a/infrastructure/garage-linode/garage.toml +++ /dev/null @@ -1,47 +0,0 @@ -# Garage v1.1.0 — WAL archive for CloudNativePG, on the Linode hub. -# -# Installed to /etc/garage/garage.toml (root:root 0644) by install.sh. -# -# This is a SECOND, independent Garage node — not a cluster peer of the Pi's -# node `d053db4dfc97bf78`. It exists because a WAL archive must live off-site: -# the Pi and the CNPG primary (siriussec) share a building, power domain and -# internet uplink, so archiving WALs there is a second copy of the same -# failure. Different node_key, different metadata dir, `replication_factor = 1`, -# nothing shared with the Pi's store. -# -# Listeners are bound to explicit addresses here AND the ports are guarded by -# host/wal-archive-firewall.nft before Docker-style DNAT could ever matter. -# `10.10.0.5` is the Linode worker's WireGuard-mesh InternalIP (dummy-k8s) — -# the only address any cluster pod can reach this on. eth0 (50.116.38.217) is -# not bound at all, so an off-mesh scan sees a filtered port, not a listener. -# -# rpc_secret is NOT in this file: GARAGE_RPC_SECRET comes from -# /etc/garage/garage.env (0600, out of git), same as the Pi's node. - -metadata_dir = "/data/meta" -data_dir = "/data/data" -db_engine = "sqlite" -replication_factor = 1 - -# Single node: nothing outside the container speaks RPC. Garage still needs the -# listener for its own CLI-over-loopback calls (`garage status`, `garage key`). -rpc_bind_addr = "127.0.0.1:3901" -rpc_public_addr = "127.0.0.1:3901" - -[s3_api] -s3_region = "garage" -# WireGuard address only. An empty/i.e. 0.0.0.0 bind here would put barman's -# archive on the Linode's public interface. -api_bind_addr = "10.10.0.5:3900" - -# Admin API + Prometheus metrics, mesh-only. No metrics_token: the port does not -# leave the WireGuard mesh. Add one here (and a bearer token in the scrape -# config) if 3903 is ever exposed beyond it. Not scraped today — the archive's -# growth is asserted from the filesystem in the backup README instead. -[admin] -api_bind_addr = "10.10.0.5:3903" - -# node_key is generated on first start and lives in metadata_dir (/data/meta). -# It is part of /root/garage-backup for the Pi's node; this node's meta/ is -# covered by the cluster-backup mirror on the same host. Restore meta/ before -# data/ or the layout no longer names this node and every bucket is orphaned. diff --git a/infrastructure/garage-linode/host/install-wal-archive-firewall.sh b/infrastructure/garage-linode/host/install-wal-archive-firewall.sh deleted file mode 100755 index d21731c..0000000 --- a/infrastructure/garage-linode/host/install-wal-archive-firewall.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# Install the WAL-archive inbound guard on the Linode hub. Idempotent. -# -# sudo ./install-wal-archive-firewall.sh -# -# Verifies the table afterwards instead of trusting `systemctl start`'s exit 0. -set -euo pipefail - -here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) - -install -D -m 0644 "$here/wal-archive-firewall.nft" /etc/nftables.d/wal_archive_guard.nft -install -D -m 0644 "$here/wal-archive-firewall.service" /etc/systemd/system/wal-archive-firewall.service - -systemctl daemon-reload -systemctl enable --now wal-archive-firewall.service - -nft list table inet wal_archive_guard >/dev/null -nft list table inet wal_archive_guard | grep -q 'dport { 3900, 3903 }' -echo "OK: wal_archive_guard loaded" -nft list table inet wal_archive_guard diff --git a/infrastructure/garage-linode/host/wal-archive-firewall.nft b/infrastructure/garage-linode/host/wal-archive-firewall.nft deleted file mode 100644 index 1bb10eb..0000000 --- a/infrastructure/garage-linode/host/wal-archive-firewall.nft +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/sbin/nft -f -# WAL-archive inbound guard — defence in depth for Garage on the Linode hub. -# -# WHY THIS EXISTS AND WHY UFW ALONE IS NOT ENOUGH: -# On the Pi the risk is docker's DNAT bypassing ufw's INPUT chain. Here the -# store runs under podman with Network=host, so there is no DNAT to bypass — -# but the same rule shape is kept anyway, because the next person who adds a -# port mapping (or a second container that proxies this one) must not be able -# to reach 3900 from eth0 by accident. This table is evaluated in PREROUTING -# at priority -140, before any DNAT, so it binds the exposure to the transport -# rather than to how the listener was published. -# -# Effective policy for 3900 (S3 API) and 3903 (metrics/admin): -# accept from WireGuard (wg0) and loopback — incl. pod traffic arriving from -# the mesh with a 10.244.x source — drop everything else (eth0, LAN, public). -# DROP not REJECT: an off-mesh scan sees `filtered` and learns nothing. -# -# Note this is *in addition to* ufw, which on this host allows 22 from -# 10.20.0.0/24 and any from 10.10.0.0/24 / 10.244.0.0/16. ufw's own default is -# deny incoming, so the LAN path is already closed; this table keeps it closed -# even if someone later opens ufw wider for a different service. -# -# `destroy` (not `delete`) so re-running the unit replaces the table instead of -# appending a duplicate, and does not fail on first install. - -destroy table inet wal_archive_guard -table inet wal_archive_guard { - chain prerouting { - type filter hook prerouting priority -140; policy accept; - - # WireGuard mesh + hub link, and loopback (the garage CLI talks to - # 127.0.0.1:3901 inside this host namespace). - iifname { "lo", "wg0" } tcp dport { 3900, 3903 } counter accept - - # Pods on this node reach the dummy-k8s address from the pod network. - ip saddr 10.244.0.0/16 tcp dport { 3900, 3903 } counter accept - - # Everything else — eth0/public, any future interface nobody added above. - tcp dport { 3900, 3903 } counter drop - } -} diff --git a/infrastructure/garage-linode/host/wal-archive-firewall.service b/infrastructure/garage-linode/host/wal-archive-firewall.service deleted file mode 100644 index 938760e..0000000 --- a/infrastructure/garage-linode/host/wal-archive-firewall.service +++ /dev/null @@ -1,22 +0,0 @@ -# /etc/systemd/system/wal-archive-firewall.service (linode) -# -# Host unit, installed by hand (not Flux-managed) — the file lives in git at -# infrastructure/garage-linode/host/. Same shape as garage-firewall.service on -# the Pi and k8s-api-firewall.service on siriussec. -# -# No Requires= on wg-quick@wg0: the tunnel is enabled at boot on this host but a -# hard dependency would turn a transient tunnel failure into "store unguarded -# and unit failed". The table only filters; it can load before the interface -# exists. -[Unit] -Description=Drop off-WireGuard inbound to the Garage WAL archive (3900/3903) -After=network-online.target -Wants=network-online.target - -[Service] -Type=oneshot -ExecStart=/usr/sbin/nft -f /etc/nftables.d/wal_archive_guard.nft -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target diff --git a/infrastructure/garage-linode/install.sh b/infrastructure/garage-linode/install.sh deleted file mode 100755 index d22f189..0000000 --- a/infrastructure/garage-linode/install.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env bash -# Install the Garage WAL archive on the Linode hub (10.10.0.5). Idempotent. -# -# sudo ./install.sh -# -# Installs: podman (if missing), /etc/garage/{garage.toml,garage.env}, -# /etc/containers/systemd/garage.container, the nft guard, and the state dirs. -# Then starts the unit and assigns the node's layout capacity on first run. -# -# The RPC secret is generated once and never printed. Rewriting it on an -# existing install is harmless for a single-node store, but the copy in -# /root/garage-backup is what a rebuild should reuse. -set -euo pipefail - -here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) - -command -v podman >/dev/null || { - export DEBIAN_FRONTEND=noninteractive - apt-get update -qq - apt-get install -y podman -} - -install -d -m 0755 /etc/garage /etc/containers/systemd /etc/nftables.d -install -d -m 0700 /var/lib/garage/meta /var/lib/garage/data - -install -m 0644 "$here/garage.toml" /etc/garage/garage.toml -install -m 0644 "$here/garage.container" /etc/containers/systemd/garage.container - -if [ ! -s /etc/garage/garage.env ]; then - umask 077 - printf 'GARAGE_RPC_SECRET=%s\n' "$(openssl rand -hex 32)" > /etc/garage/garage.env -fi -chmod 0600 /etc/garage/garage.env - -# Guard first: the listener must never exist unguarded, not even for the -# seconds between `compose/quadlet up` and a firewall install. -"$here/host/install-wal-archive-firewall.sh" >/dev/null - -systemctl daemon-reload -systemctl start garage.service - -# First run only: this Garage node needs a layout entry before it accepts -# writes. Capacity 20 GB against a 79 GB disk holding 29 GB of other data — -# see README "Disk sizing". -for _ in $(seq 1 30); do - garage_status=$(podman exec garage /garage -c /etc/garage.toml status 2>&1 || true) - grep -q 'NO ROLE' <<<"$garage_status" && break - sleep 2 -done - -if grep -q 'NO ROLE' <<<"$garage_status"; then - node_id=$(awk '/NO ROLE/{print $1}' <<<"$garage_status" | head -1) - podman exec garage /garage -c /etc/garage.toml layout assign -z dc1 -c 20G "$node_id" - podman exec garage /garage -c /etc/garage.toml layout apply --version 1 -fi - -# Verify rather than assume. -podman exec garage /garage -c /etc/garage.toml status -ss -ltnH 'sport = :3900 or sport = :3903' -nft list table inet wal_archive_guard >/dev/null && echo "OK: wal_archive_guard loaded" diff --git a/infrastructure/garage-linode/pitr-restore.md b/infrastructure/garage-linode/pitr-restore.md deleted file mode 100644 index f78add0..0000000 --- a/infrastructure/garage-linode/pitr-restore.md +++ /dev/null @@ -1,210 +0,0 @@ -# Restore notes — point-in-time recovery for `sirius-growth/portal` - -Rehearsed end to end on **2026-11-19** against the live archive, twice: once with -the in-tree barman-cloud archiver (kanban `t_ce7d6772`) and once **after the -migration to the CNPG-I Barman Cloud plugin** (kanban `t_5df331de`). This file -records the commands and the actual output of the plugin rehearsal, so the next -person restores from a transcript instead of a hope. - -The archive: Garage on the Linode, bucket `pg-wal-archive`, `http://10.10.0.5:3900` -over the WireGuard mesh, credentials in Secret `sirius-growth/portal-wal-s3`. -Producer: the **Barman Cloud plugin** — `ObjectStore sirius-growth/portal-wal` -(store + `retentionPolicy: 14d`), `Cluster portal` `spec.plugins` -(`isWALArchiver: true`, `serverName: portal`) and `ScheduledBackup portal-daily` -at 03:20 UTC with `method: plugin`. WAL archiving is continuous; base backups are -daily plus on demand. - -## 0. Is the archive actually healthy? - -```bash -kubectl -n sirius-growth exec portal-1 -c postgres -- \ - psql -U postgres -tAc "select last_archived_wal, last_archived_time, failed_count from pg_stat_archiver" -# 000000010000000000000063|2026-11-19 23:05:16.834323+00|6 -``` - -`last_archived_time` must be minutes old and the WAL name must advance when you -force a segment (`select pg_switch_wal()`). A `targetTime` after the last -archived WAL cannot be reached — recovery stops at the last segment it can fetch. - -`failed_count` is **cumulative for the life of the instance**, not a "current -health" gauge: the 6 recorded here are from the pre-migration in-tree archiver -and the primary restart during the switch. What matters is that it does not -*increase* while you watch — check it before and after a forced segment. - -What actually wrote the last segment is visible in the sidecar log, which names -barman's own arguments (server name `portal`, bucket root `s3://pg-wal-archive`): - -```bash -kubectl -n sirius-growth logs portal-1 -c plugin-barman-cloud --tail=20 -# {"msg":"Executing barman-cloud-wal-archive", ... "options":["--gzip","--endpoint-url","http://10.10.0.5:3900", -# "--cloud-provider","aws-s3","s3://pg-wal-archive","portal","/var/lib/postgresql/data/pgdata/pg_wal/"]} -# {"msg":"Archived WAL file","walName":"...","elapsedWalTime":0.586...} -``` - -```bash -kubectl -n sirius-growth get backup -o wide # newest Backup: METHOD plugin, PHASE completed -kubectl -n sirius-growth get scheduledbackup # portal-daily, method plugin, LAST BACKUP set -``` - -## 1. Prove the marker, then make the mistake - -```bash -q() { kubectl -n sirius-growth exec portal-1 -c postgres -- psql -U postgres -d portal -tAc "$1"; } -q "create table if not exists pitr_probe(id bigserial primary key, note text, at timestamptz default now())" -q "insert into pitr_probe(note) values ('MARKER-plugin-before-target') returning id, at" -# 1|2026-11-19 23:04:53.072104+00 -q "select pg_switch_wal()" ; sleep 12 -q "select last_archived_wal, last_archived_time, failed_count from pg_stat_archiver" -# 000000010000000000000062|2026-11-19 23:04:54.052315+00|6 -sleep 10 -q "insert into pitr_probe(note) values ('POISON-plugin-after-target') returning id, at" -# 2|2026-11-19 23:05:15.798408+00 -q "select pg_switch_wal()" ; sleep 12 -q "select last_archived_wal, last_archived_time, failed_count from pg_stat_archiver" -# 000000010000000000000063|2026-11-19 23:05:16.834323+00|6 -``` - -The target is therefore **`2026-11-19T23:05:00Z`** — 7 s after the marker, 15 s -before the row that must be lost. Note that WAL `…063` (which contains the poison -row) *is* in the archive: the restore has to choose to stop, it is not starved of -data. - -## 2. Restore into a throwaway cluster - -Never restore over the live `portal` cluster while it is serving. - -```yaml -apiVersion: postgresql.cnpg.io/v1 -kind: Cluster -metadata: - name: portal-pitr-test - namespace: sirius-growth - labels: {purpose: pitr-acceptance-test} -spec: - instances: 1 - imageName: ghcr.io/cloudnative-pg/postgresql:16 - storage: {size: 5Gi, storageClass: local-path} - affinity: {nodeSelector: {kubernetes.io/hostname: siriussec}} - resources: - requests: {cpu: 100m, memory: 256Mi} - limits: {memory: 1Gi} - bootstrap: - recovery: - source: portal-wal - recoveryTarget: - targetTime: "2026-11-19T23:05:00Z" - externalClusters: - - name: portal-wal - plugin: # was barmanObjectStore before the plugin migration - name: barman-cloud.cloudnative-pg.io - parameters: - barmanObjectName: portal-wal # ObjectStore in THIS namespace - serverName: portal # MUST be the *source* Cluster name -``` - -`serverName` is not optional: it is the barman prefix (`portal/base`, -`portal/wals`). Omit it and the plugin falls back to the *restoring* cluster's -name (`portal-pitr-test`) and finds an empty history. `targetTime` is UTC -RFC3339 — a wrong timezone silently restores the wrong hour. The ObjectStore's -own `spec.configuration.serverName` must stay empty (its CRD rejects anything -else); the prefix always comes from this plugin parameter. - -The operator restores the base backup, replays WAL, stops at the target and -promotes: - -``` -ready=False phase=Setting up primary -ready=False phase=Waiting for the instances to become active -ready=True phase=Cluster in healthy state -portal-pitr-test 1 1 Cluster in healthy state portal-pitr-test-1 -``` - -## 3. The acceptance evidence - -``` -$ kubectl -n sirius-growth exec portal-pitr-test-1 -c postgres -- \ - psql -U postgres -d portal -c "select id, note, at from pitr_probe order by id" - id | note | at -----+-----------------------------+------------------------------- - 1 | MARKER-plugin-before-target | 2026-11-19 23:04:53.072104+00 -(1 row) - -$ ... -tAc "select count(*) from pitr_probe where note like 'POISON%'" -0 -``` - -Marker present, post-target row gone. The rest of the database came back with it -(physical restore, all databases, no `pg_restore` ordering games), e.g. -`clients 4 = 4`, `calendar_tokens 3 = 3`, `applications 1 = 1` against the -primary at that moment. - -```bash -$ ... -tAc "select pg_is_in_recovery()" -f # replay finished, instance promoted -``` - -`pg_is_in_recovery() = f` is expected here and is **not** a failure: a CNPG -recovery cluster with `instances: 1` promotes itself once it hits the target. It -is writable from that moment — which is why the test cluster must be deleted, and -why nothing may point application traffic at it before you decide to. - -```bash -kubectl -n sirius-growth delete cluster portal-pitr-test -kubectl -n sirius-growth delete pvc -l cnpg.io/cluster=portal-pitr-test -kubectl -n sirius-growth exec portal-1 -c postgres -- psql -U postgres -d portal -tAc "drop table if exists pitr_probe" -``` - -## 4. Making the restored data the real data - -Two shapes, both legitimate: - -1. **Cut over (preferred, reversible).** Point the app at - `portal-pitr-test-rw` (`POSTGRES_HOST` in the API/portal Deployments — through - git, not `kubectl set env`), verify, then drop the old cluster only after the - app has been confirmed on the restored copy. -2. **In place.** Keep `portal`, stop its instances, and swap the PVC content from - the recovered data directory. Slower, destructive, and easy to get wrong — - only with the app scaled to zero. - -Either way, take a fresh base backup once the decision is made (a `Backup` CR with -`method: plugin`, or `kubectl cnpg backup -n sirius-growth portal --method=plugin ---plugin-name=barman-cloud.cloudnative-pg.io`) so the archive has a post-recovery -base rather than one from before the incident. - -## Gotchas that cost time - -- **Flux owns `apps/base/sirius-growth/`.** A hand `kubectl apply` of the Cluster, - the ObjectStore or the ScheduledBackup is reverted by the `apps` Kustomization - within its 1 min interval. Config changes belong in the branch/PR. (`Cluster` - and `Backup` objects created by hand for a rehearsal are not in the - Kustomization inventory, so they are not pruned — but the objects Flux *does* - own are reverted.) -- **`ScheduledBackup.spec.schedule` is six-field cron, seconds first.** `0 20 3 - * * *` = 03:20:00 UTC. Copying a five-field crontab string silently means - "every minute" in the first field. -- **Two different `serverName`s exist and only one may be set.** On the - `ObjectStore` it must be absent (CRD CEL rule); on the Cluster's - `spec.plugins[].parameters` / `externalClusters[].plugin.parameters` it is the - prefix. Set the wrong one and archiving writes to `portal-/`, which - silently abandons the existing 14-day window. -- **The bucket prefix is `portal/portal/…` only if you get `destinationPath` - wrong.** Use `s3://pg-wal-archive` for the bucket root; the server name is - appended. -- **Plugin, not in-tree.** The operator's in-tree barman-cloud support is - deprecated in 1.30 and removed in 1.31; `spec.backup.barmanObjectStore` on a - 1.31 operator would leave the cluster with no archiver at all. Restore config - is `externalClusters[].plugin` + `parameters.barmanObjectName`, and the store - itself is an `ObjectStore` CR in the cluster's namespace. -- **Retention moved.** `retentionPolicy` lives on the `ObjectStore` now, enforced - by the plugin sidecar every 30 min — not on the Cluster, and not "at backup - time". -- **Backup metrics changed family.** `barman_cloud_cloudnative_pg_io_last_available_backup_timestamp` - replaces `cnpg_collector_last_available_backup_timestamp`. The old series for - `portal` still shows the pre-migration timestamp, so alert/dashboard queries - must prefer the new one (see `monitoring/controllers/home/dashboards/build.py`). -- **If archiving has failed** (`pg_stat_archiver.failed_count` increasing), fix it - and let a fresh base backup complete before trusting any recent `targetTime`. -- **Fallback when the archive is unusable:** the nightly `pg_dump` in - `forgejo/cluster-backup` (`db/sirius-growth-portal-.dump`, 14 retained, - §8.2 step 2 of `docs/cluster-overview.md`). 24 h RPO, logical, independent of - barman and of the Linode Garage node. diff --git a/infrastructure/garage/README.md b/infrastructure/garage/README.md deleted file mode 100644 index 90868ce..0000000 --- a/infrastructure/garage/README.md +++ /dev/null @@ -1,239 +0,0 @@ -# Garage — the private object store (rpi, outside the cluster) - -Garage is a single-node S3-compatible object store running as a Docker -container on **`rpi`** (the WireGuard hub, `10.10.0.1`). It is deliberately -**not** a Kubernetes workload: a storage service should not be a pod on a -three-node homelab where rebooting the control plane is routine. - -Its only network path is the WireGuard mesh. There is no public hostname, no -Cloudflare tunnel, no DNS record, no website listener, and no public bucket. - -## This directory is NOT applied by Flux - -Flux watches `./clusters/homek8s` of `sirius/homek8s`. Nothing in that path -references this directory, and that is intentional — Flux manages the cluster, -not the Pi's host containers. **A push here changes nothing on the Pi.** - -It is committed for one reason: reproducibility. A rebuilt Pi comes back from -this directory plus one backup of `meta/` and `data/`. Before 2026-11-19 the -Garage config existed only at `/home/sirius/websites/garage/garage.toml` on the -host, in no git repository anywhere — the only piece of the platform that -neither Flux nor a repo could rebuild. - -## What runs - -| | | -|---|---| -| Container | `garage`, image `dxflrs/garage:v1.1.0` (pinned tag, never `:latest`) | -| Compose file | `/etc/garage/docker-compose.yml` (installed from here) | -| Config | `/etc/garage/garage.toml` (installed from `garage.toml` here) | -| RPC secret | `/etc/garage/garage.env` → `GARAGE_RPC_SECRET`, `0600 root:root`, **not in git** | -| State | `/home/sirius/websites/garage/meta/` (metadata) and `.../data/` (objects) | -| Node | `d053db4dfc97bf78`, zone `dc1`, capacity 100 GB, `replication_factor = 1` | - -State paths were kept at the historical locations on purpose, so switching to -this compose file moved no data. - -## Ports — every publish is an explicit address - -| Host address | Port | Purpose | -|---|---|---| -| `10.10.0.1` | 3900 | S3 API — the only endpoint the cluster consumes | -| `10.10.0.1` | 3903 | `/metrics` for Prometheus | -| `127.0.0.1` | 3900 | host-local S3, for backup verification on the Pi | - -There is **no `0.0.0.0` publish** and no `3901`/`3902` publish at all -(see "Removed" below). Docker scopes a specific-IP publish to that destination, -so `192.168.1.125:3900` and any public address are closed. - -## Defence in depth (this is the load-bearing part) - -`host/garage-firewall.nft` is an nftables table in **PREROUTING priority --140**, i.e. *before* Docker's DNAT (-100). ufw cannot do this job: Docker's -port publishing bypasses ufw's INPUT chain entirely, so a compose typo that -published `0.0.0.0:3900` would be reachable with ufw still reporting -"default deny (incoming)". The nft table drops 3900-3903 from everything that -is not `wg0`/`wg-remote`/`lo`, whatever address Docker asked for. - -```bash -sudo ./host/install-garage-firewall.sh # idempotent; loads + verifies -nft list table inet garage_guard # counters prove traffic hit the guard -``` - -The Pi's ufw stays as-is (default deny incoming). Do **not** fold this table -into a general host firewall — the Pi's ufw owns that, and moving k8s/wgportal/ -DNS traffic here strands the cluster. - -## Apply / re-apply - -Files installed, then compose up: - -```bash -# on the Pi, from a checkout of sirius/homek8s -cd infrastructure/garage -sudo install -d -m 0755 /etc/garage -sudo install -m 0644 garage.toml /etc/garage/garage.toml -sudo install -m 0644 docker-compose.yml /etc/garage/docker-compose.yml - -# one-time: the RPC secret is not in git -printf 'GARAGE_RPC_SECRET=%s\n' "$(openssl rand -hex 32)" | sudo tee /etc/garage/garage.env -sudo chmod 0600 /etc/garage/garage.env - -cd /etc/garage && sudo docker compose up -d -``` - -`docker compose up -d` recreates the container in place; `meta/` and `data/` -are bind mounts, so the node identity and every bucket survive. - -Verify (all three must hold): - -```bash -ss -ltnp | grep -E '390[0-3]' # only 10.10.0.1 + 127.0.0.1, never 0.0.0.0 -sudo docker exec garage /garage -c /etc/garage.toml status # same node ID, HEALTHY -curl -s -o /dev/null -w '%{http_code}\n' http://10.10.0.1:3900/ # 403 (auth enforced) -curl -s -o /dev/null -w '%{http_code}\n' http://10.10.0.1:3903/metrics # 200 -``` - -The RPC secret is safe to regenerate on a fresh host: with a single node there -is no peer to authenticate against. If the node is ever joined to a second one, -the secret must match on both and must come from the backup, not from git. - -## Keys — one per consumer - -Key material is never committed and never printed. Key **IDs** and scopes: - -| Key ID | Name | Scope | Consumer | -|---|---|---|---| -| `GK751dab7d7d535f49d060adfb` | `ci-push` | **W** on `siriusdevops-media` | `sirius/siriusdevops` CI media upload (Forgejo secrets `GARAGE_ACCESS_KEY` / `GARAGE_SECRET_KEY`) | -| `GK633f87c796ae91585cca2303` | `site-fetch` | **R** on `siriusdevops-media` | `siriusdevops-site` initContainer (Secret `siriusdevops/garage-media-s3`) | -| `GK0e3b3c6f07813bc3002adb94` | `sirius-growth-blog` | RW `sirius-growth-blog-media` | blog pipeline | -| `GK50cccc3f680384d1d8d2db50` | `sirius-growth-ci` | RWO `sirius-growth-photos`, RW `siriusdevops-media` | `sirius-growth` `deploy-site.yml` photo sync (Forgejo secrets, repointed 2026-11-19) | -| `GKb7800d139463b4190b28bde8` | `sirius-growth-portal` | RW `sirius-growth-client-files` | portal client files | - -The legacy shared key `ci-key` (`GKddc329c08c30d1332e109fd4`) was **deleted** -2026-11-19, not rotated. It held RWO on `sirius-growth-photos`, -RWO on `piedmont-photos` and RW on `siriusdevops-media`, and it was the key the -site initContainer was reading media with. Rotating in place would have meant -deleting and re-creating the same over-broad grant, and a fresh credential with -no consumer is just a live secret nobody uses. Its media grant is replaced by -`ci-push` / `site-fetch`, its photos grant by `sirius-growth-ci`; **no workflow -in any repo still references `piedmont-photos`**, so that grant was dropped -rather than preserved. If something does turn out to need `piedmont-photos`, -mint a scoped key (`key create` + `bucket allow --read|--write`) instead of -resurrecting a shared one. - -`ci-push` is `W` only, which is why the site repo's media step is -`aws s3 cp --recursive`, **not** `aws s3 sync`: `sync` calls `ListObjectsV2` -and Garage answers `403 Forbidden: Operation is not allowed for this key` -without `R`. A write-only key that can secretly read is not write-only. - -Create a key and grant exactly one bucket: - -```bash -sudo docker exec garage /garage -c /etc/garage.toml key create site-fetch --yes -sudo docker exec garage /garage -c /etc/garage.toml bucket allow --read siriusdevops-media --key site-fetch -sudo docker exec garage /garage -c /etc/garage.toml key info site-fetch # confirm scope -``` - -## Removed: what and why - -- **`[s3_web]` / port 3902 (static website mode)** — removed 2026-11-19. It was - published on `127.0.0.1` only, so a pod could never reach it (a pod's - `127.0.0.1` is its own netns); public site serving is the Cilium Gateway on - siriussec. Its only remaining effect was to tempt bucket publicity, which is - what pushed `sirius-growth` to bake photos into the image. The initContainer - sync replaced that need. Re-adding it means publishing a port and re-deciding - bucket publicity — don't do that casually. -- **port 3901 (RPC) publish** — removed. Single node: nothing outside the - container speaks RPC. Garage's own CLI still uses loopback *inside* the - container namespace. -- **`rpc_secret` in the config file** — moved to `GARAGE_RPC_SECRET` in - `/etc/garage/garage.env` so the committed config carries no credential. - -## Backup — nightly off the Pi - -`backup/garage-backup.sh meta|data`, driven by two systemd timers: - -| Unit | Schedule | What | -|---|---|---| -| `garage-meta-backup.{service,timer}` | hourly (+≤5 min jitter) | `garage meta snapshot` (consistent copy of `db.sqlite` while running) + `cluster_layout`, `data_layout`, `node_key`, `garage.toml`, `garage.env` | -| `garage-data-backup.{service,timer}` | nightly 03:30 (+≤10 min jitter) | `rsync -a --delete` of `data/` | - -Destination is **`root@10.20.0.1:/root/garage-backup/`** — the Linode VPS, -reached over the `wg-remote` tunnel with the Pi's `~/.ssh/linode_admin` key. -It is off the Pi, in another power and internet domain. A bucket that backs up -into itself is not a backup. - -```bash -sudo install -m 0755 backup/garage-backup.sh /usr/local/sbin/garage-backup.sh -sudo install -m 0644 backup/garage-meta-backup.service backup/garage-meta-backup.timer \ - backup/garage-data-backup.service backup/garage-data-backup.timer \ - /etc/systemd/system/ -sudo systemctl daemon-reload -sudo systemctl enable --now garage-meta-backup.timer garage-data-backup.timer -sudo systemctl start garage-meta-backup.service # prove it once by hand -journalctl -u garage-meta-backup.service -n 30 --no-pager -``` - -**What is *not* covered by any other job:** nothing in this cluster backs up -Forgejo or the Postgres PVCs today — there is no backup CronJob in -`apps/base/forgejo/`, only the nightly *prune*. So Garage's backup is not -"added to" an existing one; it is the first backup job the platform has, and -Forgejo/PG remain uncovered (a separate card). - -## Restore - -Rebuilding the Pi, or recovering from a lost `meta/`: - -```bash -# 1. get the tree back -sudo install -d -m 0755 /etc/garage -sudo install -d /home/sirius/websites/garage/{meta,data} -sudo rsync -a root@10.20.0.1:/root/garage-backup/meta/ /home/sirius/websites/garage/meta/ -sudo rsync -a root@10.20.0.1:/root/garage-backup/data/ /home/sirius/websites/garage/data/ - -# 2. newest consistent metadata snapshot becomes the live db -sudo cp /home/sirius/websites/garage/meta/snapshots//db.sqlite \ - /home/sirius/websites/garage/meta/db.sqlite -sudo rm -f /home/sirius/websites/garage/meta/db.sqlite-shm \ - /home/sirius/websites/garage/meta/db.sqlite-wal -sudo chown -R root:root /home/sirius/websites/garage/meta - -# 3. restore config + secret (both are in the backup) -sudo install -m 0644 /root/garage-backup/meta/garage.toml /etc/garage/garage.toml -sudo install -m 0600 /root/garage-backup/meta/garage.env /etc/garage/garage.env -sudo install -m 0644 docker-compose.yml /etc/garage/docker-compose.yml - -# 4. bring it up and verify -cd /etc/garage && sudo docker compose up -d -sudo docker exec garage /garage -c /etc/garage.toml status # node ID must match d053db4dfc97bf78 -sudo docker exec garage /garage -c /etc/garage.toml bucket list -``` - -`meta/` is the piece that orphans `data/`: the object bytes are useless without -the metadata DB that maps keys to block refs. Losing `data/` alone loses objects -but leaves a consistent store. `node_key` must be restored with `meta/` or the -node comes back with a new identity and the layout no longer matches. - -**Key material is not in the backup.** S3 keys live only in Garage's metadata -(`meta/`), so a restore that keeps `meta/` keeps the existing keys — no secret -re-issue needed. A restore that rebuilds `meta/` from scratch must recreate -`ci-push` / `site-fetch` and update the k8s Secret and the Forgejo secrets. - -## Metrics - -`/metrics` is served by the admin API and published on `10.10.0.1:3903` only -(no `metrics_token` — the port does not leave the mesh). Scrape config, the -`garage` Service/EndpointSlice and the alert rules live in -`monitoring/controllers/home/garage.yaml` (that one **is** GitOps, via Flux). - -Alerts: `GarageDown`, `GarageClusterUnhealthy`, `GarageDiskFillingUp` (>80%), -`GarageMetadataGcBacklog`, `GarageResyncErroredBlocks`. There is no Alertmanager -in this stack — they surface in Prometheus → `/alerts` and Grafana → Alerting. - -## Guardrails - -- Never make a bucket public. Never add a Cloudflare tunnel or DNS record. -- Never publish the website listener. -- Never publish a port on `0.0.0.0` "because it's only temporary". -- Do not migrate Garage into Kubernetes on a hardening pass — see the top. diff --git a/infrastructure/garage/backup/garage-backup.sh b/infrastructure/garage/backup/garage-backup.sh deleted file mode 100644 index ea8688f..0000000 --- a/infrastructure/garage/backup/garage-backup.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env bash -# Garage backup — meta (frequent) and data (nightly), copied OFF the Pi. -# -# garage-backup.sh meta # consistent metadata snapshot + layout + rpc env -# garage-backup.sh data # object data tree -# -# Destination is the Linode VPS (10.20.0.1) over the wg-remote tunnel, NOT the -# Pi and NOT a bucket in Garage. A bucket that backs up into itself is not a -# backup: losing meta/ or the disk loses the "backup" with it. -# -# Run as root (systemd unit does): node_key is 0600 root:root, and rsync needs -# to read the whole meta tree. The SSH key is the sirius user's linode_admin, -# readable by root. -# -# Restore procedure: see ../README.md. Exit code is the truth — the units are -# oneshot and `systemctl status garage-*-backup.service` shows the last result. -set -euo pipefail - -mode=${1:-} -case "$mode" in - meta|data) ;; - *) echo "usage: $0 meta|data" >&2; exit 2 ;; -esac - -GARAGE_DIR=/home/sirius/websites/garage -KEY=/home/sirius/.ssh/linode_admin -REMOTE=root@10.20.0.1 -DEST=/root/garage-backup -KEEP_LOCAL_SNAPSHOTS=14 - -# Host key: the Pi's root has no known_hosts entry for the VPN peer, and a -# rebuilt Pi would not have one either. accept-new pins it on first contact and -# still fails loudly if the key later changes. The transport is the WireGuard -# tunnel, so first contact is already authenticated at the network layer. -export RSYNC_RSH="ssh -i $KEY -o IdentitiesOnly=yes -o BatchMode=yes -o StrictHostKeyChecking=accept-new -o ConnectTimeout=20" - -log() { printf '%s %s\n' "$(date -u +%FT%TZ)" "$*"; } - -# Fail loudly and early if the tunnel/target is not there. A silent "backup ok" -# with the VPS unreachable is the failure mode this whole file exists to avoid. -log "target check: $(ssh -i "$KEY" -o IdentitiesOnly=yes -o BatchMode=yes -o StrictHostKeyChecking=accept-new -o ConnectTimeout=20 "$REMOTE" 'hostname; df -h / | tail -1')" - -# rsync will not create the parent of a --delete target, so make the tree first. -ssh -i "$KEY" -o IdentitiesOnly=yes -o BatchMode=yes -o StrictHostKeyChecking=accept-new "$REMOTE" \ - "install -d -m 0700 $DEST $DEST/meta $DEST/meta/snapshots $DEST/data" - -case "$mode" in - meta) - # `meta snapshot` is Garage's supported consistent copy of db.sqlite while - # the server keeps running. Never rsync a live db.sqlite+wal by hand. - log "taking metadata snapshot" - docker exec garage /garage -c /etc/garage.toml meta snapshot --all - - # Prune local snapshots so /home does not fill with dailies. - mapfile -t snaps < <(find "$GARAGE_DIR/meta/snapshots" -mindepth 1 -maxdepth 1 -type d -printf '%T@ %p\n' \ - | sort -rn | awk '{print $2}') - if (( ${#snaps[@]} > KEEP_LOCAL_SNAPSHOTS )); then - log "pruning $(( ${#snaps[@]} - KEEP_LOCAL_SNAPSHOTS )) old local snapshot(s)" - printf '%s\0' "${snaps[@]:$KEEP_LOCAL_SNAPSHOTS}" | xargs -0 -r rm -rf - fi - - log "syncing metadata to $REMOTE:$DEST/meta" - rsync -a --delete "$GARAGE_DIR/meta/snapshots/" "$REMOTE:$DEST/meta/snapshots/" - # Layout + node identity + the RPC secret. Without node_key the restored - # node gets a new identity and meta/data no longer agree. - rsync -a "$GARAGE_DIR/meta/cluster_layout" \ - "$GARAGE_DIR/meta/data_layout" \ - "$GARAGE_DIR/meta/node_key" \ - "$REMOTE:$DEST/meta/" - install -d -m 0700 /etc/garage - rsync -a /etc/garage/garage.toml /etc/garage/garage.env "$REMOTE:$DEST/meta/" - ssh -i "$KEY" -o IdentitiesOnly=yes -o BatchMode=yes -o StrictHostKeyChecking=accept-new "$REMOTE" \ - "chmod 600 $DEST/meta/garage.env $DEST/meta/node_key" - ;; - - data) - log "syncing object data to $REMOTE:$DEST/data" - # --delete keeps the remote an exact mirror (deleted objects stay deleted). - # multipart/ is in-flight upload scratch and is deliberately not mirrored. - rsync -a --delete --exclude '/multipart/' \ - "$GARAGE_DIR/data/" "$REMOTE:$DEST/data/" - ;; -esac - -log "remote state after $mode backup:" -ssh -i "$KEY" -o IdentitiesOnly=yes -o BatchMode=yes -o StrictHostKeyChecking=accept-new "$REMOTE" \ - "du -sh $DEST/* 2>/dev/null; echo '--- newest meta snapshot ---'; ls -1dt $DEST/meta/snapshots/*/ 2>/dev/null | head -3" -log "OK" diff --git a/infrastructure/garage/backup/garage-data-backup.service b/infrastructure/garage/backup/garage-data-backup.service deleted file mode 100644 index 320e316..0000000 --- a/infrastructure/garage/backup/garage-data-backup.service +++ /dev/null @@ -1,17 +0,0 @@ -# /etc/systemd/system/garage-data-backup.service (rpi) -# -# Object data is 36 MB today; a nightly full rsync costs seconds. If that ever -# stops being true, switch to `rsync -a --delete` with a bandwidth cap rather -# than moving to incremental tooling — the tree is content-addressed and rsync -# already only transfers changed blocks. -[Unit] -Description=Garage object data -> Linode VPS (off the Pi) -After=docker.service network-online.target -Wants=network-online.target - -[Service] -Type=oneshot -ExecStart=/usr/local/sbin/garage-backup.sh data -TimeoutStartSec=2h -Nice=15 -IOSchedulingClass=idle diff --git a/infrastructure/garage/backup/garage-data-backup.timer b/infrastructure/garage/backup/garage-data-backup.timer deleted file mode 100644 index d6b35a4..0000000 --- a/infrastructure/garage/backup/garage-data-backup.timer +++ /dev/null @@ -1,12 +0,0 @@ -# /etc/systemd/system/garage-data-backup.timer (rpi) -[Unit] -Description=Nightly Garage object-data backup - -[Timer] -OnCalendar=*-*-* 03:30:00 -RandomizedDelaySec=600 -Persistent=true -Unit=garage-data-backup.service - -[Install] -WantedBy=timers.target diff --git a/infrastructure/garage/backup/garage-meta-backup.service b/infrastructure/garage/backup/garage-meta-backup.service deleted file mode 100644 index 6ef30a5..0000000 --- a/infrastructure/garage/backup/garage-meta-backup.service +++ /dev/null @@ -1,15 +0,0 @@ -# /etc/systemd/system/garage-meta-backup.service (rpi) -# -# Metadata is the piece that orphans data/ if lost, and it changes on every -# upload/key/bucket change — hence hourly, not nightly. -[Unit] -Description=Garage metadata snapshot -> Linode VPS (off the Pi) -After=docker.service network-online.target -Wants=network-online.target - -[Service] -Type=oneshot -ExecStart=/usr/local/sbin/garage-backup.sh meta -# Slow tunnel is not a reason to retry a 5-minute job forever. -TimeoutStartSec=15min -Nice=10 diff --git a/infrastructure/garage/backup/garage-meta-backup.timer b/infrastructure/garage/backup/garage-meta-backup.timer deleted file mode 100644 index c7a43aa..0000000 --- a/infrastructure/garage/backup/garage-meta-backup.timer +++ /dev/null @@ -1,13 +0,0 @@ -# /etc/systemd/system/garage-meta-backup.timer (rpi) -[Unit] -Description=Hourly Garage metadata backup - -[Timer] -OnCalendar=hourly -# Spread off the hour so it does not race the Forgejo/registry work on the same box. -RandomizedDelaySec=300 -Persistent=true -Unit=garage-meta-backup.service - -[Install] -WantedBy=timers.target diff --git a/infrastructure/garage/docker-compose.yml b/infrastructure/garage/docker-compose.yml deleted file mode 100644 index e8cff27..0000000 --- a/infrastructure/garage/docker-compose.yml +++ /dev/null @@ -1,53 +0,0 @@ -# Garage — private object store on the Pi -# -# NOT Flux-managed. Flux watches ./clusters/homek8s and none of it references -# this directory; the container is applied on rpi by hand (see README.md). -# The point of committing it is reproducibility: a rebuilt Pi comes back from -# this directory plus a backup. -# -# Installed to /etc/garage/docker-compose.yml (root:root 0644). State stays on -# the existing bind mounts under /home/sirius/websites/garage/ so this file can -# replace the old in-place definition without moving a byte of data. -# -# Exposure rule: every port is published on an EXPLICIT address. There is no -# 0.0.0.0 publish anywhere. 10.10.0.1 is the WireGuard hub address (the mesh), -# 127.0.0.1 is the Pi itself. Docker scopes a specific-IP publish to that -# destination only, so the LAN (192.168.1.125) and anything public stay closed -# even before the host firewall in host/garage-firewall.nft is considered. - -name: garage - -services: - garage: - image: dxflrs/garage:v1.1.0 - container_name: garage - restart: unless-stopped - - # GARAGE_RPC_SECRET. 0640 root:root, never in git. Single node: the value - # only authenticates RPC between Garage nodes, and there are none — a fresh - # `openssl rand -hex 32` is a valid restore value. - env_file: - - /etc/garage/garage.env - - command: ["/garage", "-c", "/etc/garage.toml", "server"] - - ports: - # S3 API over the WireGuard mesh. This is the only endpoint anything in - # the cluster uses (site media sync in, CI sync out). - - "10.10.0.1:3900:3900" - # Prometheus /metrics over the mesh (see monitoring/controllers/home/garage.yaml). - - "10.10.0.1:3903:3903" - # Host-local S3 for backup verification / manual `garage` CLI work on the - # Pi itself. Loopback only. - - "127.0.0.1:3900:3900" - - volumes: - - /etc/garage/garage.toml:/etc/garage.toml:ro - - /home/sirius/websites/garage/meta:/data/meta - - /home/sirius/websites/garage/data:/data/data - - logging: - driver: json-file - options: - max-size: "10m" - max-file: "3" diff --git a/infrastructure/garage/garage.toml b/infrastructure/garage/garage.toml deleted file mode 100644 index 93f202a..0000000 --- a/infrastructure/garage/garage.toml +++ /dev/null @@ -1,42 +0,0 @@ -# Garage v1.1.0 configuration — single node, rpi (10.10.0.1 on the WG mesh). -# -# Installed to /etc/garage/garage.toml (root:root 0644). -# -# Addresses here are INSIDE the container network namespace. What the host -# actually exposes is decided by docker-compose.yml (explicit 10.10.0.1 / 127.0.0.1 -# publishes), and enforced a second time by host/garage-firewall.nft. A 0.0.0.0 -# listener in this file is therefore not a public exposure. -# -# rpc_secret is NOT in this file: it is supplied as GARAGE_RPC_SECRET from -# /etc/garage/garage.env (0600, out of git). Verified on Garage v1.1.0 — -# the env var overrides the missing config key and the node starts normally. - -metadata_dir = "/data/meta" -data_dir = "/data/data" -db_engine = "sqlite" -replication_factor = 1 - -# RPC. Single node: nothing connects from outside the container, so the host -# publishes nothing for 3901. Garage still needs the listener for its own -# CLI-over-loopback calls (`garage status`, `garage key ...`). -rpc_bind_addr = "0.0.0.0:3901" -rpc_public_addr = "127.0.0.1:3901" - -[s3_api] -s3_region = "garage" -api_bind_addr = "0.0.0.0:3900" - -# Admin API + Prometheus metrics. Published on 10.10.0.1:3903 only. -# No metrics_token: the listener is WireGuard-only, and Prometheus runs in the -# cluster on the far side of the mesh. Add `metrics_token` here (and a matching -# bearer token in the ServiceMonitor) if 3903 ever leaves the mesh. -[admin] -api_bind_addr = "0.0.0.0:3903" - -# [s3_web] REMOVED 2026-11-19 (port 3902, static website mode). -# Nothing consumed it: a pod's 127.0.0.1 is its own netns, so 127.0.0.1:3902 was -# unreachable from the cluster, and public website serving is Cilium Gateway on -# siriussec (10.10.0.2:8080). The site now pulls media from the private bucket -# with an initContainer (`aws s3 sync` -> /media), so the web listener had no -# remaining consumer. Re-adding it means publishing a port and re-deciding -# bucket publicity — do not do that casually. diff --git a/infrastructure/garage/host/garage-firewall.nft b/infrastructure/garage/host/garage-firewall.nft deleted file mode 100644 index 4f8cc61..0000000 --- a/infrastructure/garage/host/garage-firewall.nft +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/sbin/nft -f -# Garage inbound guard — defence in depth for the S3/metrics listeners. -# -# WHY THIS EXISTS AND WHY IT IS NOT JUST ufw: -# Docker publishes container ports through a DNAT rule in the `nat` -# PREROUTING chain. That traversal never reaches ufw's INPUT chain, so a -# compose typo that publishes `0.0.0.0:3900:3900` would be reachable from the -# LAN and (worse) from anywhere the router forwards, with ufw still reporting -# "default deny (incoming)". This table sits in PREROUTING at priority -140 — -# after mangle (-150), before DNAT (-100) — so it drops the packet BEFORE -# Docker can rewrite it, whatever address compose asked for. -# -# Effective policy for 3900-3903: accept from WireGuard (wg0, the remote hub -# link wg-remote) and loopback, drop everything else (LAN eth0/wlan0, tailscale, -# public). DROP rather than REJECT so an off-mesh scan sees a filtered port and -# learns nothing. -# -# Scope is deliberately narrow: only Garage's ports. Do not widen this table -# into a general host firewall — the Pi's ufw already owns that, and moving -# k8s/wgportal/DNS traffic here would strand the cluster. -# -# Loaded by garage-firewall.service. `destroy` (not `delete`) so re-running the -# unit replaces the table instead of appending a duplicate copy, and does not -# fail on first install. -# -# Changing Garage's ports means changing this set AND docker-compose.yml AND -# the rpi ufw rules in one go; a port in one place only is how you get a -# listener that answers on the LAN. -destroy table inet garage_guard -table inet garage_guard { - chain prerouting { - type filter hook prerouting priority -140; policy accept; - - # WireGuard only: the mesh hub link and loopback. - iifname { "lo", "wg0", "wg-remote" } tcp dport { 3900, 3901, 3902, 3903 } counter accept - - # Anything else — LAN, tailscale, public, or a future interface that - # nobody remembered to add above. - tcp dport { 3900, 3901, 3902, 3903 } counter drop - } -} diff --git a/infrastructure/garage/host/garage-firewall.service b/infrastructure/garage/host/garage-firewall.service deleted file mode 100644 index 3f9ce7e..0000000 --- a/infrastructure/garage/host/garage-firewall.service +++ /dev/null @@ -1,25 +0,0 @@ -# /etc/systemd/system/garage-firewall.service (rpi) -# -# Host unit, installed by hand (not Flux-managed) — the file lives in git at -# infrastructure/garage/host/. Same shape as k8s-api-firewall.service and -# internal-gw-firewall.service on siriussec. -# -# Ordering note: no Requires= on wg-quick@wg0. The Pi's wg0 is normally brought -# up by hand / by wgportal and the template unit can be inactive; a hard -# dependency would make this unit fail outright and silently leave Garage -# unguarded. Ordering against docker is deliberately absent: this table sits at -# PREROUTING priority -140 so it is evaluated before Docker's DNAT (-100) -# regardless of which of the two loaded first — and `After=docker.service` -# together with a `Before=` on the same unit would be an ordering cycle. -[Unit] -Description=Drop off-WireGuard inbound to Garage (3900-3903) before Docker DNAT -After=network-online.target -Wants=network-online.target - -[Service] -Type=oneshot -ExecStart=/usr/sbin/nft -f /etc/nftables.d/garage_guard.nft -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target diff --git a/infrastructure/garage/host/install-garage-firewall.sh b/infrastructure/garage/host/install-garage-firewall.sh deleted file mode 100644 index 7f41779..0000000 --- a/infrastructure/garage/host/install-garage-firewall.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -# Install the Garage inbound guard on rpi. Idempotent; safe to re-run. -# -# sudo ./install-garage-firewall.sh -# -# Verifies the table afterwards instead of trusting `systemctl start`'s exit 0. -set -euo pipefail - -here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) - -install -D -m 0644 "$here/garage-firewall.nft" /etc/nftables.d/garage_guard.nft -install -D -m 0644 "$here/garage-firewall.service" /etc/systemd/system/garage-firewall.service - -systemctl daemon-reload -systemctl enable --now garage-firewall.service - -# Prove it loaded rather than assuming: the table must exist and carry both the -# accept and the drop rule. -nft list table inet garage_guard >/dev/null -nft list table inet garage_guard | grep -q 'dport { 3900, 3901, 3902, 3903 }' -echo "OK: garage_guard loaded" -nft list table inet garage_guard diff --git a/infrastructure/home/kustomization.yaml b/infrastructure/home/kustomization.yaml index a91ca5f..3f64703 100644 --- a/infrastructure/home/kustomization.yaml +++ b/infrastructure/home/kustomization.yaml @@ -5,4 +5,3 @@ resources: - ../networking/gateway - ../networking/internal - ../networking/cilium - - ../node-io diff --git a/infrastructure/networking/cilium/hubble-ui-httproute.yaml b/infrastructure/networking/cilium/hubble-ui-httproute.yaml deleted file mode 100644 index 8aa152d..0000000 --- a/infrastructure/networking/cilium/hubble-ui-httproute.yaml +++ /dev/null @@ -1,28 +0,0 @@ -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: hubble-ui - namespace: kube-system - labels: - app.kubernetes.io/name: hubble-ui - app.kubernetes.io/part-of: cilium -spec: - parentRefs: - # Dedicated Gateway on port 8084 — deliberately NOT the shared `internal` - # gateway. There is no `hostnames` field here on purpose: the route must - # match a request whose Host header is the bare IP (10.10.0.2:8084), which - # is the only form a phone can use. Cilium merges hostname-less routes that - # share a Gateway into one 50/50 weighted route, so a bare-IP service needs - # its own Gateway as well as its own port. - - name: hubble-ui - namespace: internal - sectionName: http-internal - rules: - - matches: - - path: - type: PathPrefix - value: / - backendRefs: - # hubble-ui Service (frontend nginx, which proxies /api to the backend) - - name: hubble-ui - port: 80 diff --git a/infrastructure/networking/cilium/kustomization.yaml b/infrastructure/networking/cilium/kustomization.yaml index df3c83d..1c91239 100644 --- a/infrastructure/networking/cilium/kustomization.yaml +++ b/infrastructure/networking/cilium/kustomization.yaml @@ -4,7 +4,6 @@ namespace: kube-system resources: - repository.yaml - release.yaml - - hubble-ui-httproute.yaml configMapGenerator: - name: cilium-values files: diff --git a/infrastructure/networking/cilium/values.yaml b/infrastructure/networking/cilium/values.yaml index 5005c97..0fcb1b3 100644 --- a/infrastructure/networking/cilium/values.yaml +++ b/infrastructure/networking/cilium/values.yaml @@ -31,102 +31,6 @@ operator: replicas: 1 nodeSelector: kubernetes.io/hostname: siriussec - # Single-node etcd on the T480's PM991 NVMe sees multi-second WAL fsync stalls - # during heavy dind builds (158 samples >8s / 41d). The default 10s renew - # deadline makes the operator fatal ("Leader election lost") on every stall. - # Ride out up to ~45s of apiserver unavailability instead of restarting. - extraArgs: - - --leader-election-lease-duration=60s - - --leader-election-renew-deadline=45s - - --leader-election-resource-lock-timeout=20s - # Scrape the operator (:9963). Enabling the ServiceMonitor also renders the - # `cilium-operator` Service that backs it. The `release` label is what the - # kube-prometheus-stack Prometheus CR selects on (serviceMonitorSelector). - prometheus: - enabled: true - serviceMonitor: - enabled: true - labels: - release: kube-prometheus-stack - -# The ServiceMonitors below are rendered from this chart (hubble + operator). -# The chart refuses to render them unless either the monitoring.coreos.com/v1 -# CRDs are detected at install time or this flag is set; the CRDs come from the -# `monitoring` Flux Kustomization, which is a separate release with its own -# ordering, so assert them rather than depend on reconcile order. -prometheus: - serviceMonitor: - trustCRDsExist: true - -hubble: - # Flow/Forensics UI is reachable over WireGuard only, by bare IP on the - # dedicated `internal/hubble-ui` gateway: http://10.10.0.2:8084/ (port 8084, - # its own Gateway because Cilium merges hostname-less routes that share one). - # See docs/internal-wireguard-services.md. - # Neither relay nor UI gets a public hostname or a tunnel ingress entry. - relay: - enabled: true - replicas: 1 - nodeSelector: - kubernetes.io/hostname: siriussec - resources: - requests: - cpu: 25m - memory: 64Mi - limits: - cpu: 200m - memory: 256Mi - prometheus: - enabled: true - serviceMonitor: - enabled: true - labels: - release: kube-prometheus-stack - ui: - enabled: true - replicas: 1 - nodeSelector: - kubernetes.io/hostname: siriussec - backend: - resources: - requests: - cpu: 10m - memory: 32Mi - limits: - cpu: 100m - memory: 128Mi - frontend: - resources: - requests: - cpu: 10m - memory: 32Mi - limits: - cpu: 100m - memory: 128Mi - metrics: - # Agent-side hubble_* counters on :9965. `enabled` is a LIST in the 1.20 - # chart schema (not a boolean): the metric names to enable. flow/drop carry - # the policy-verdict labels because hubble-network-policy-correlation is on. - # hostPort on every node — metrics only, no UI. - enabled: - - flow - - drop - - tcp - - port-distribution - - icmp - - httpV2 - - dns - serviceMonitor: - enabled: true - labels: - release: kube-prometheus-stack - dashboards: - # Chart's own "Hubble Metrics and Monitoring" dashboard (38 panels: - # flows, drops, policy verdicts, TCP, DNS). Loaded by the Grafana - # dashboard sidecar (NAMESPACE=ALL, label grafana_dashboard). - enabled: true - label: grafana_dashboard - labelValue: "1" ipam: mode: cluster-pool diff --git a/infrastructure/networking/internal/dns/README.md b/infrastructure/networking/internal/dns/README.md deleted file mode 100644 index 621bcd1..0000000 --- a/infrastructure/networking/internal/dns/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# `lab.internal` resolver (WireGuard only) - -Authoritative for the `lab.internal` zone and a forwarder for everything else, -running as **dnsmasq on rpi** (the WireGuard hub) at `10.10.0.1:53` and -`10.20.0.2:53`. It is a **host** service, not a cluster object — deliberately -not behind Cilium's internal Gateway, so it cannot inherit the Envoy -listener flapping (`t_e9564aa3`). - -Full write-up, client instructions and rollback: `docs/internal-wireguard-services.md` §11. - -## Files - -| File | Installed to | Purpose | -|---|---|---| -| `lab-internal.conf` | `/etc/dnsmasq.d/lab-internal.conf` | zone authority (`local=/lab.internal/`), records file, bind list | -| `lab-internal.hosts` | `/etc/dnsmasq-lab-internal.hosts` | records, hosts(5) syntax — one line per name | -| `rpi-ufw-dns.sh` | — | ufw: allow 53 from mesh/hub-spokes/pods, deny everything else (inserted above the LAN catch-all) | -| `install-rpi-dns.sh` | — | installs everything, restarts dnsmasq, prints the bind view | - -`lab-internal.hosts` is installed **outside** `/etc/dnsmasq.d` because the -systemd unit parses every file in that directory as config (`-7 -/etc/dnsmasq.d`); a hosts file there aborts the start with `bad option`. - -## Install / update (root on rpi) - -```bash -bash install-rpi-dns.sh -``` - -## Add a record - -```bash -# 1. edit lab-internal.hosts in git and commit, then on rpi: -sudo install -m 0644 lab-internal.hosts /etc/dnsmasq-lab-internal.hosts -sudo systemctl reload dnsmasq # re-reads addn-hosts, no restart -dig +short grafana.lab.internal @10.10.0.1 -``` - -## Verify - -```bash -sudo ss -lntuH 'sport = :53' # 127.0.0.1, 10.10.0.1, 10.20.0.2, [::1] only -sudo iptables -L ufw-user-input -n -v | grep dpt:53 -# from a WireGuard client (not on the LAN): -dig +short grafana.lab.internal @10.10.0.1 # 10.10.0.2 -dig +short example.com @10.10.0.1 # forwards, public answer -# negative, from the LAN: must time out (DROP) -dig +time=3 grafana.lab.internal @192.168.1.125 -``` - -## Why the client must use `10.10.0.1` as its DNS - -Android/iOS apply the tunnel's DNS as the resolver for the **whole device** -while the tunnel is up — there is no per-domain split. This resolver therefore -answers `lab.internal` locally and forwards everything else upstream, so public -DNS keeps working. Clearing the field in the WireGuard app is the rollback. diff --git a/infrastructure/networking/internal/dns/install-rpi-dns.sh b/infrastructure/networking/internal/dns/install-rpi-dns.sh deleted file mode 100755 index 0007e91..0000000 --- a/infrastructure/networking/internal/dns/install-rpi-dns.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# Install the lab.internal resolver on rpi (the WireGuard hub). -# Run as root from a checkout of sirius/homek8s: -# bash infrastructure/networking/internal/dns/install-rpi-dns.sh -# -# Re-run after a Pi reinstall or after editing the records. Idempotent. -set -euo pipefail -cd "$(dirname "$0")" - -install -m 0644 lab-internal.conf /etc/dnsmasq.d/lab-internal.conf -install -m 0644 lab-internal.hosts /etc/dnsmasq-lab-internal.hosts - -bash rpi-ufw-dns.sh - -# dnsmasq is already enabled at boot on rpi; make that explicit, not assumed. -systemctl enable dnsmasq -systemctl restart dnsmasq - -sleep 1 -systemctl is-active dnsmasq -ss -lntup | grep ':53 ' || true diff --git a/infrastructure/networking/internal/dns/lab-internal.conf b/infrastructure/networking/internal/dns/lab-internal.conf deleted file mode 100644 index 59785d8..0000000 --- a/infrastructure/networking/internal/dns/lab-internal.conf +++ /dev/null @@ -1,35 +0,0 @@ -# dnsmasq drop-in for the WireGuard-only resolver on rpi (the WG hub). -# Installed as /etc/dnsmasq.d/lab-internal.conf by install-rpi-dns.sh. -# -# WHY: WireGuard clients (Android/iOS especially) apply the tunnel's DNS as the -# resolver for the WHOLE device while the tunnel is up -- there is no per-domain -# split on the client. So this server must answer the internal zone itself and -# FORWARD everything else upstream, otherwise turning it on breaks public DNS. -# -# Zone: lab.internal only. Never squat .internal bare or home.arpa. - -# Authoritative for lab.internal: never forward it upstream, answer from the -# records below and NXDOMAIN for anything else in the zone. -local=/lab.internal/ - -# Records live in a plain hosts(5) file -- add a service by adding one line -# there (infrastructure/networking/internal/dns/lab-internal.hosts). -addn-hosts=/etc/dnsmasq-lab-internal.hosts - -# Listen ONLY on loopback and the two WireGuard interfaces. bind-dynamic lets a -# missing/down WireGuard interface come and go without restarting dnsmasq. -# The hub's LAN address (192.168.1.125) must NOT serve DNS; ufw enforces that -# too, but not binding it at all is the first line. -bind-dynamic -interface=lo -interface=wg0 -interface=wg-remote - -# Forwarding: inherited from /etc/resolv.conf, which on rpi is generated by -# tailscale (100.100.100.100 = MagicDNS, which forwards to the DHCP resolvers). -# Do not hardcode a public resolver here. - -# Don't forward single-label names or reverse-lookups for RFC1918 we own; keeps -# LAN/mDNS noise off the upstream and out of the public root. -domain-needed -bogus-priv diff --git a/infrastructure/networking/internal/dns/lab-internal.hosts b/infrastructure/networking/internal/dns/lab-internal.hosts deleted file mode 100644 index bc37122..0000000 --- a/infrastructure/networking/internal/dns/lab-internal.hosts +++ /dev/null @@ -1,10 +0,0 @@ -# lab.internal zone records -- hosts(5) syntax:
[aliases] -# Installed as /etc/dnsmasq.d/lab-internal.hosts, read by dnsmasq via -# addn-hosts=. Adding a service = adding a line here + `systemctl reload dnsmasq` -# on rpi (a reload re-reads addn-hosts; no restart needed). -# -# 10.10.0.2 is siriussec, which serves both internal dashboards today (Cilium -# ingress Envoy is only on siriussec; 10.10.0.1/rpi does not front them). If -# the gateway ever moves to rpi, change the address here only. -10.10.0.2 grafana.lab.internal -10.10.0.2 hubble.lab.internal diff --git a/infrastructure/networking/internal/dns/rpi-ufw-dns.sh b/infrastructure/networking/internal/dns/rpi-ufw-dns.sh deleted file mode 100755 index 02380f3..0000000 --- a/infrastructure/networking/internal/dns/rpi-ufw-dns.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# rpi: keep the WireGuard resolver CLOSED to everything but the VPN. -# -# dnsmasq is already the Pi's resolver service (it also serves the .rpi.local -# alias), and ufw on rpi has `allow from 192.168.1.0/24` (any port), so a plain -# `ufw deny 53` would append BELOW that catch-all and never match. Everything -# here is `ufw insert`, which puts the rule at the top of the user chain. -# -# Final order: allow from the mesh (10.10.0.0/24), the remote hub -# (10.20.0.0/24) and the pod CIDR; then deny 53 for everyone else. Loopback is -# already accepted by ufw's before-input chain, and lab-internal.conf binds -# only lo/wg0/wg-remote anyway -- this is the belt to that braces. -# -# Run as root on rpi (192.168.1.125). Idempotent: re-running only adds missing -# rules. -set -euo pipefail - -if ufw status | grep -q 'wg-dns'; then - echo "dns rules already present:" - ufw status | grep -E '53/(udp|tcp)' - exit 0 -fi - -# Denies first, then the allows are inserted above them. -ufw insert 1 deny 53/udp comment 'wg-dns: resolver is VPN only' -ufw insert 1 deny 53/tcp comment 'wg-dns: resolver is VPN only' - -for proto in udp tcp; do - ufw insert 1 allow from 10.10.0.0/24 to any port 53 proto "$proto" comment 'wg-dns (mesh)' - ufw insert 1 allow from 10.20.0.0/24 to any port 53 proto "$proto" comment 'wg-dns (remote hub)' - ufw insert 1 allow from 10.244.0.0/16 to any port 53 proto "$proto" comment 'wg-dns (pods)' -done - -echo "dns rules installed:" -ufw status | grep -E '53/(udp|tcp)' || true diff --git a/infrastructure/networking/internal/gateway-customer1-metabase.yaml b/infrastructure/networking/internal/gateway-customer1-metabase.yaml deleted file mode 100644 index 9c8ece1..0000000 --- a/infrastructure/networking/internal/gateway-customer1-metabase.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# Own Gateway for the Customer 1 lab Metabase (:8087) — see -# gateway-customer1-odoo.yaml for why one bare-IP service per Gateway. -# -# This is NOT the evaluation instance in namespace `metabase` (:8085). Same -# reasoning applies to the port choice: one listener port carries exactly one -# internal service, so its route can never compete with another one. -apiVersion: gateway.networking.k8s.io/v1 -kind: Gateway -metadata: - name: customer1-metabase - namespace: internal - labels: - dedicated: network - annotations: - sirius.dev/purpose: bare-IP listener for the Customer 1 lab Metabase (WireGuard only) -spec: - gatewayClassName: cilium - listeners: - - name: http-internal - protocol: HTTP - # Verified free 2026-11-22: `ss -lntH "sport = :8087" | wc -l` = 0 on - # siriussec. - port: 8087 - allowedRoutes: - namespaces: - from: All diff --git a/infrastructure/networking/internal/gateway-customer1-odoo.yaml b/infrastructure/networking/internal/gateway-customer1-odoo.yaml deleted file mode 100644 index d0d5315..0000000 --- a/infrastructure/networking/internal/gateway-customer1-odoo.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# Own Gateway for Odoo because each bare-IP (hostname-less) service needs its own -# RouteConfiguration: Cilium renders one per Gateway and merges all hostname-less -# routes inside it into a single weighted route. Sharing a Gateway with Grafana -# (8081) / Hubble (8084) / Metabase (8085) or with the sibling :8087 listener -# here would make both ports answer for a random backend. -# -# Port 8086 must be free on EVERY node running cilium-envoy (siriussec 10.10.0.2 -# is the only `gateway=true` node). Envoy binds 0.0.0.0: hostNetwork, so -# the host firewall (infrastructure/networking/internal/host-firewall/) must be -# installed BEFORE this is pushed; otherwise the listener is open on the LAN the -# moment it is programmed. -apiVersion: gateway.networking.k8s.io/v1 -kind: Gateway -metadata: - name: customer1-odoo - namespace: internal - labels: - dedicated: network - annotations: - sirius.dev/purpose: bare-IP listener for the Customer 1 lab Odoo (WireGuard only) -spec: - gatewayClassName: cilium - listeners: - - name: http-internal - protocol: HTTP - # Verified free 2026-11-22: `ss -lntH "sport = :8086" | wc -l` = 0 on - # siriussec. Taken: 8080 public, 8081 Grafana, 8084 Hubble, 8085 Metabase. - port: 8086 - allowedRoutes: - namespaces: - from: All diff --git a/infrastructure/networking/internal/gateway-hubble-ui.yaml b/infrastructure/networking/internal/gateway-hubble-ui.yaml deleted file mode 100644 index c549f62..0000000 --- a/infrastructure/networking/internal/gateway-hubble-ui.yaml +++ /dev/null @@ -1,33 +0,0 @@ -apiVersion: gateway.networking.k8s.io/v1 -kind: Gateway -metadata: - name: hubble-ui - namespace: internal - labels: - dedicated: network - annotations: - # Why a second Gateway instead of a second listener on `internal`: - # Cilium renders one RouteConfiguration per Gateway shared by all its - # listeners, so a hostname-less route on any listener of `internal` would - # merge with Grafana's into one 50/50 weighted route. Its own Gateway gives - # it its own RouteConfiguration. - sirius.dev/purpose: bare-IP listener for the Hubble UI (WireGuard only) -spec: - gatewayClassName: cilium - listeners: - - name: http-internal - protocol: HTTP - # PORT MUST BE FREE ON *EVERY* NODE THAT RUNS cilium-envoy (rpi 10.10.0.1 and - # siriussec 10.10.0.2 — `kubectl -n kube-system get pods -l - # k8s-app=cilium-envoy -o wide`). Cilium binds 0.0.0.0: hostNetwork on - # all of them, so a port already held by anything else on ANY gateway node - # makes xDS reject the listener there ("cannot bind '0.0.0.0:': - # Address already in use") and restart-loops that node's Envoy — which - # fronts the public ingress. The Pi still runs leftover Docker site containers: - # handyman-site holds 127.0.0.1:8082 and its nginx holds 127.0.0.1:8083, so - # both are unusable here (a 127.0.0.1 bind still conflicts with 0.0.0.0). - # Check per node before choosing: `ss -lntH "sport = :" | wc -l` = 0. - port: 8084 - allowedRoutes: - namespaces: - from: All diff --git a/infrastructure/networking/internal/gateway-metabase.yaml b/infrastructure/networking/internal/gateway-metabase.yaml deleted file mode 100644 index 1eedd8b..0000000 --- a/infrastructure/networking/internal/gateway-metabase.yaml +++ /dev/null @@ -1,31 +0,0 @@ -apiVersion: gateway.networking.k8s.io/v1 -kind: Gateway -metadata: - name: metabase - namespace: internal - labels: - dedicated: network - annotations: - # Why a second Gateway instead of a second listener on `internal`: - # Cilium renders one RouteConfiguration per Gateway shared by all its - # listeners, so a hostname-less route on any listener of `internal` would - # merge with Grafana's into one 50/50 weighted route. Its own Gateway gives - # it its own RouteConfiguration. - sirius.dev/purpose: bare-IP listener for Metabase (WireGuard only) -spec: - gatewayClassName: cilium - listeners: - - name: http-internal - protocol: HTTP - # PORT MUST BE FREE ON *EVERY* NODE THAT RUNS cilium-envoy (siriussec - # 10.10.0.2 is the only `gateway=true` node today). Cilium binds - # 0.0.0.0: hostNetwork, so a port held by anything else on a gateway - # node makes xDS reject the listener there ("cannot bind '0.0.0.0:': - # Address already in use") and restart-loops that node's Envoy — which - # fronts the public ingress. Verified free 2026-11-22: - # `ss -lntH "sport = :8085" | wc -l` = 0 on siriussec. - # 8080 (public), 8081 (Grafana), 8084 (Hubble UI) are taken. - port: 8085 - allowedRoutes: - namespaces: - from: All diff --git a/infrastructure/networking/internal/gateway.yaml b/infrastructure/networking/internal/gateway.yaml index f8888b8..cc2beef 100644 --- a/infrastructure/networking/internal/gateway.yaml +++ b/infrastructure/networking/internal/gateway.yaml @@ -11,21 +11,6 @@ spec: - name: http-internal protocol: HTTP port: 8081 - # Any namespace may attach a route: the security boundary for this listener - # is the HOST firewall (only 10.10.0.0/24 + pod CIDR may reach :8081), not - # the namespace. allowedRoutes: namespaces: - from: All - # NOTE (2026-10-27): do NOT add another hostname-less route here, and do not - # add a second listener for one. Cilium 1.20 renders ONE RouteConfiguration - # per Gateway (`listener-insecure`) shared by all of that Gateway's - # listeners, so two routes that both match `Prefix: /` with no hostnames are - # merged into a single route with `weightedClusters` weight 1/1 — every - # request then lands on a random backend, on every port of the gateway. - # Proven live: http://10.10.0.2:8081/ and :8084/ each served Grafana ~58% and - # Hubble UI ~42% of the time once Hubble's bare route existed here. - # - # A service that must answer on its bare IP therefore gets its OWN Gateway - # object, which gets its own Envoy RouteConfiguration — see - # `gateway-hubble-ui.yaml` (port 8084). One bare-IP service per Gateway. + from: Same diff --git a/infrastructure/networking/internal/host-firewall/README.md b/infrastructure/networking/internal/host-firewall/README.md deleted file mode 100644 index e03fd2e..0000000 --- a/infrastructure/networking/internal/host-firewall/README.md +++ /dev/null @@ -1,74 +0,0 @@ -# Internal Gateway host firewall - -Cilium programs every Gateway listener on **all** nodes carrying -`node-role.kubernetes.io/gateway=true` and its Envoy binds -`0.0.0.0:` in the host network namespace. So -`gateway-system/public` on 8080 and `internal/internal` on 8081 are *both* -listening on the LAN interfaces; the Gateway API object cannot say -"WireGuard only". The host firewall is the enforcement point. - -**Since 2026-10-27 that label is on `siriussec` (10.10.0.2) only.** rpi used to -carry it as well; its Envoy bound the same ports but could never finish a -request to a backend pod on siriussec (TCP completes, no ACK on -`reserved:ingress`), so `10.10.0.1:8080/:8081/:8084` answered **503 after -exactly 5 s** for everything — even from rpi's own `127.0.0.1`. Clients that -tried either address saw the dashboards flap. One gateway node, one serving -address: `kubectl get nodes -l node-role.kubernetes.io/gateway=true` must return -exactly one node. - -| Host | Mechanism | Artifact | -|------|-----------|----------| -| siriussec (10.10.0.2) — **load bearing** | nftables table `inet internal_gw`, loaded by a oneshot unit (same pattern as `k8s-api-firewall.service`) | `siriussec-internal-gw.nft`, `internal-gw-firewall.service` | -| rpi (10.10.0.1) — **inert guard** | ufw rules inserted above the `allow from 192.168.1.0/24` catch-all | `rpi-ufw-internal-gw.sh` | - -Effective policy for `:8081` (Grafana), `:8084` (Hubble UI) and `:8085` -(Metabase): -**accept from 10.10.0.0/24 and 10.244.0.0/16, accept on lo, drop everything -else** (LAN, tailscale, public). Envoy binds every listener on `0.0.0.0`, so a -new internal listener port is a LAN exposure until it is added here. The -accept rules carry `counter`s: `nft list table inet internal_gw` shows packets -that reached the host and were allowed, which is the only way to tell "the -firewall accepted it and Envoy answered" from "the client never got there" — -rpi's ufw accept rules read 0 packets while requests to `10.10.0.1:8081` were -in fact reaching Envoy. - -Nothing binds these ports on rpi any more, so its ufw rules no longer protect -anything; they are kept so a future `gateway=true` relabel does not silently -expose 8081/8084 on the Pi's LAN address. A stale client pointed at -`10.10.0.1:8081` therefore times out (ufw DROP) instead of being refused. - -These are host units, not Flux objects — a node reinstall has to re-apply them. -Install: - -```bash -# siriussec, as root -install -m 0644 siriussec-internal-gw.nft /etc/nftables.d/internal-gw.nft -install -m 0644 internal-gw-firewall.service /etc/systemd/system/ -systemctl daemon-reload && systemctl enable --now internal-gw-firewall.service - -# rpi, as root -bash rpi-ufw-internal-gw.sh -``` - -Verify: - -```bash -# siriussec — accept counters must be non-zero after a mesh/pod request, -# the drop counter non-zero after a LAN request -nft list table inet internal_gw -# rpi -ufw status | grep -E '8081|8084|8085' -``` - -Negative test from the LAN must be a timeout (DROP), never 200: - -```bash -curl -m 3 -sS -o /dev/null -w '%{http_code}\n' http://192.168.1.179:8081/ # empty/000 -curl -m 3 -sS -o /dev/null -w '%{http_code}\n' http://192.168.1.125:8081/ # empty/000 -``` - -When a new internal listener port is added, add it to the `tcp dport { … }` set -in `siriussec-internal-gw.nft` and to `PORTS` in `rpi-ufw-internal-gw.sh` (which -inserts one deny for the port plus mesh and pod-CIDR allows above the LAN -catch-all), then reinstall both and re-run the two negative tests above with the -new port. \ No newline at end of file diff --git a/infrastructure/networking/internal/host-firewall/internal-gw-firewall.service b/infrastructure/networking/internal/host-firewall/internal-gw-firewall.service deleted file mode 100644 index c46890b..0000000 --- a/infrastructure/networking/internal/host-firewall/internal-gw-firewall.service +++ /dev/null @@ -1,17 +0,0 @@ -# /etc/systemd/system/internal-gw-firewall.service (siriussec) -# -# Same shape as k8s-api-firewall.service. Installed by hand (host unit, not -# Flux-managed); the file lives in git at -# infrastructure/networking/internal/host-firewall/. -[Unit] -Description=Restrict the internal Gateway listeners (8081, 8084, 8085) to WireGuard -After=network-online.target -Wants=network-online.target - -[Service] -Type=oneshot -ExecStart=/usr/sbin/nft -f /etc/nftables.d/internal-gw.nft -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/infrastructure/networking/internal/host-firewall/rpi-ufw-internal-gw.sh b/infrastructure/networking/internal/host-firewall/rpi-ufw-internal-gw.sh deleted file mode 100644 index f20e0f8..0000000 --- a/infrastructure/networking/internal/host-firewall/rpi-ufw-internal-gw.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# rpi: restrict the internal Gateway listeners to WireGuard + pods. -# -# ufw on rpi already has `allow from 192.168.1.0/24` (any port), so the deny has -# to sit ABOVE it — hence `ufw insert`, not `ufw allow/deny` (which appends). -# Final order per port: allow 10.10.0.0/24, allow 10.244.0.0/16, deny the rest. -# -# Ports: 8081 = Grafana (`internal` Gateway listener http-internal), -# 8084 = Hubble UI (`internal` Gateway listener hubble-ui), -# 8085 = Metabase (`metabase` Gateway listener http-internal), -# 8086 = Customer 1 lab Odoo (`customer1-odoo` Gateway), -# 8087 = Customer 1 lab Metabase (`customer1-metabase` Gateway). -# Add a new internal listener port to PORTS; the loop is idempotent, so -# re-running after a port is already firewalled only adds what is missing. -# -# Run as root on rpi (192.168.1.125). -set -euo pipefail - -PORTS="${PORTS:-8081 8084 8085 8086 8087}" - -for port in $PORTS; do - if ufw status | grep -q "${port}/tcp"; then - echo "$port rules already present:" - ufw status | grep "${port}/tcp" - continue - fi - - ufw insert 1 deny to any port "$port" proto tcp comment 'internal gateway: wg only' - ufw insert 1 allow from 10.10.0.0/24 to any port "$port" proto tcp comment 'internal gateway (wg mesh)' - ufw insert 2 allow from 10.244.0.0/16 to any port "$port" proto tcp comment 'internal gateway (pods)' - - echo "$port rules installed:" - ufw status | grep "${port}/tcp" || true -done \ No newline at end of file diff --git a/infrastructure/networking/internal/host-firewall/siriussec-internal-gw.nft b/infrastructure/networking/internal/host-firewall/siriussec-internal-gw.nft deleted file mode 100644 index 6f07915..0000000 --- a/infrastructure/networking/internal/host-firewall/siriussec-internal-gw.nft +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/sbin/nft -f -# Internal (WireGuard-only) gateway listeners: TCP 8081 (Grafana), 8084 -# (Hubble UI), 8085 (Metabase) and 8086/8087 (Customer 1 lab replica: Odoo, -# Metabase). -# -# Cilium's hostNetwork Envoy binds every Gateway listener on 0.0.0.0, so the -# internal listeners are open on the LAN interface the moment the Gateway is -# programmed. This table makes them answer only from the WireGuard mesh and the -# pod network. DROP (not reject) so a LAN scan sees a timeout, not a port that -# tells you something is listening. -# -# Adding an internal service: add its listener port to the set in all three -# rules below, reinstall this file, then -# `systemctl reload-or-restart internal-gw-firewall.service`. The same list -# must also be added to the rpi ufw rules (rpi-ufw-internal-gw.sh). -# -# Loaded by internal-gw-firewall.service on siriussec. `destroy` (not `delete`) -# so re-running the unit REPLACES the table instead of appending a second copy -# of the rules, and does not fail when the table does not exist yet. -destroy table inet internal_gw -table inet internal_gw { - chain input { - type filter hook input priority filter; policy accept; - - # local process / kubelet probes - tcp dport { 8081, 8084, 8085, 8086, 8087 } iifname "lo" counter accept - - # WireGuard mesh (Legion = 10.10.0.3, nodes, remote hub spokes) - # and the pod network (in-cluster scrapers, probes) - tcp dport { 8081, 8084, 8085, 8086, 8087 } ip saddr { 10.10.0.0/24, 10.244.0.0/16 } counter accept - - # everything else: LAN, tailscale, public - tcp dport { 8081, 8084, 8085, 8086, 8087 } counter drop - } -} \ No newline at end of file diff --git a/infrastructure/networking/internal/kustomization.yaml b/infrastructure/networking/internal/kustomization.yaml index a0c4937..a64a0c8 100644 --- a/infrastructure/networking/internal/kustomization.yaml +++ b/infrastructure/networking/internal/kustomization.yaml @@ -3,7 +3,3 @@ kind: Kustomization resources: - namespace.yaml - gateway.yaml - - gateway-hubble-ui.yaml - - gateway-metabase.yaml - - gateway-customer1-odoo.yaml - - gateway-customer1-metabase.yaml diff --git a/infrastructure/node-io/README.md b/infrastructure/node-io/README.md deleted file mode 100644 index 7af6ff4..0000000 --- a/infrastructure/node-io/README.md +++ /dev/null @@ -1,101 +0,0 @@ -# node-io — protecting etcd's WAL fsync from the dind runner - -`etcd-io-guard` is a one-node DaemonSet (siriussec) that stops the amd64 Forgejo -runner (`forgejo-runner-amd64`, privileged `docker:dind`) from starving etcd on -the shared PM991 NVMe (`/dev/nvme0n1p3`). The etcd WAL, the dind data-root, -`forgejo-data` and the CNPG PVCs all live on that one device. - -## The fault (measured 2026-10-26) - -| observation | evidence | -|---|---| -| etcd fsync tail is extreme but rare | `etcd_disk_wal_fsync_duration_seconds`: 14.8 M samples over 45 d, 99.9 % ≤ 32 ms, **158 samples > 8.192 s**, worst logged `slow fdatasync` 10.39 s | -| the tail is not a per-cgroup *queueing* problem | during an unmitigated burst the dind cgroup moved ~41–48 MB/s at ~35 IOPS with `ios in progress` 0 — the device queue was nearly empty while etcd fsyncs took seconds | -| bulk dirty data is what causes it | the same load with only fsync/metadata writers (no bulk streams): 422 etcd fsyncs, **0 above 1 s**, p99 512 ms | -| per-cgroup `io.latency` cannot fix it | cgroup-v2 applies latency targets **only between peers of the same parent** (`block/blk-iolatency.c`: a miss is recorded in the missing group's *parent* `child_lat`). kubelet gives every pod its own slice, so etcd's leaf and the dind leaf never influence each other. Setting `259:0 target=50000` on etcd's leaf is accepted, but during load the dind cgroup's `io.stat` still read `depth=max` — never throttled — and the stall count did not move | -| an unmitigated burst takes the control plane down | 4×1 GiB `dd conv=fsync` on the same device: etcd `slow fdatasync` **68.9 s, 26.6 s, 17.6 s**; `kube-apiserver` restarted, `kube-controller-manager` and `kube-scheduler` logged `Failed to renew lease` → `leaderelection lost/stopped` | - -Mechanism in one sentence: an `fdatasync` completes only once the device has made -everything already submitted durable, so an etcd WAL commit queues behind whatever -the runner has pushed into the page cache and writeback — and on the default -`vm.dirty_ratio=20` (≈3 GB of a 15 GB box) that backlog is seconds of I/O. - -## What the guard does (two layers, re-applied every 30 s) - -1. **Bounds the host writeback backlog** — writes `vm.dirty_bytes=64 MiB` and - `vm.dirty_background_bytes=16 MiB` into the host `/proc/sys/vm`. -2. **Caps the dind container's dispatch rate** — `io.max` `wbps=40 MiB/s` on the - cgroup of the container whose main process is `dockerd`. This is *not* the - peer-scoped `io.latency` controller: `io.max` is an absolute per-cgroup cap, so - dind can only keep a bounded number of requests in the device queue and etcd's - tiny WAL writes find free slots. - -The dind cgroup path changes on every pod recreation, so layer 2 re-discovers it -by scanning `kubepods.slice/**/cri-containerd-*.scope` for `dockerd` on each -tick. Nothing is written to `kubepods-burstable.slice` or `kubepods.slice` — etcd -lives in that slice. - -## Measured result (same load before/after) - -Load: 4 concurrent writers, 128 MiB per `dd conv=fsync`, 150 s, executed **inside -the dind container** so the I/O is charged to the dind cgroup. - -| metric | no mitigation | guard (64 MiB + 40 MiB/s) | -|---|---|---| -| worst `slow fdatasync` | 68.9 s (burst run) | **1.40 s** | -| `slow fdatasync` lines | 11 | **1** | -| etcd fsyncs > 8.192 s | 5 | **0** | -| etcd fsyncs > 2.048 s | 39 (dirty-limit only) | **1** | -| control-plane restarts during run | apiserver 1, KCM/scheduler leases lost | **none** | -| dind write volume | ~8 GiB / 178 s (~46 MB/s) | exactly 6.0 GiB / 157 s (**41 MB/s — the cap binds**) | - -## Verify - -```bash -kubectl -n node-io get ds,po -kubectl -n node-io logs ds/etcd-io-guard --tail=6 # "start" + "applied io.max ..." per pod - -# host agrees with the ConfigMap (0 ratio => the byte limits are in force) -ssh -i ~/.ssh/lancelot_priv Lancelot@192.168.1.179 \ - 'sysctl vm.dirty_bytes vm.dirty_background_bytes vm.dirty_ratio vm.dirty_background_ratio' -# expect 67108864 / 16777216 / 0 / 0 - -# the cap is on the current dind (dockerd) cgroup, not on a slice -ssh -i ~/.ssh/lancelot_priv Lancelot@192.168.1.179 \ - 'for d in $(sudo find /sys/fs/cgroup/kubepods.slice -name io.max -path "*cri-containerd-*"); do \ - grep -q . /dev/null; sudo cat $d | grep -q wbps=41943040 && echo "$d"; done' - -# etcd tail -kubectl -n kube-system logs etcd-siriussec --since=1h | grep 'slow fdatasync' -``` - -Self-healing is proven by deleting the runner pod: the replacement gets a new -cgroup path and the guard applies `io.max` to it within one 30 s tick. - -## Tuning and trade-offs - -- Knobs live in `configmap.yaml` (`dirty-bytes`, `dirty-background-bytes`, - `dind-wbps`); change, push, Flux applies, the guard rewrites within 30 s. -- 64 MiB is aggressive (≈0.4 % of a 15 GB box) and the 40 MiB/s cap costs ~11 % - of dind write bandwidth (46 → 41 MB/s). Both were chosen for the etcd tail; - raise them if CI wall time regresses more than ~20 %. -- The dirty limits are host-global: they bind every writer on siriussec, not just - the runner. The kernel has no per-cgroup dirty limit that binds a different pod. -- `io.cost`/`io.weight` would be the better tool (it can reserve latency rather - than bandwidth) but this kernel exposes no `/sys/block/nvme0n1/queue/io.cost.*`, - so `io.max` is the available lever. -- Not touched here: the dind data-root is still on the etcd device. Moving it to - its own disk removes the contention entirely and is the only change that lets - these limits go back to default. - -## Node-level step that is not GitOps - -Periodic TRIM is **not** covered by this directory. `fstrim.timer` was disabled -while `/dev/nvme0n1` reports `DISC-MAX 2T`; enable it once (it survives reboots): - -```bash -sudo systemctl enable --now fstrim.timer -``` - -Hygiene against write amplification/GC on a heavily churned SSD, not a measured -tail-latency fix. diff --git a/infrastructure/node-io/configmap.yaml b/infrastructure/node-io/configmap.yaml deleted file mode 100644 index 42e7d9c..0000000 --- a/infrastructure/node-io/configmap.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: etcd-io-guard-config - namespace: node-io -data: - # Bounded writeback backlog. Measured on 2026-10-26 (see README.md): - # default vm.dirty_ratio=20 (3 GB on this 15 GB box) lets the amd64 dind - # runner queue 1-3 GB of dirty pages; an etcd WAL fdatasync has to wait for - # the device to flush everything already submitted, which is where the - # multi-second slow fdatasync comes from. 64 MiB / 16 MiB removed every - # sample above 8 s and cut the median fsync from 512 ms to ~10 ms at a ~17 % - # dind write-throughput cost. Raise both together if CI throughput matters - # more than the etcd tail; keep background <= bytes. - dirty-bytes: "67108864" - dirty-background-bytes: "16777216" - # blk-throttle cap on the dind container's own cgroup (bytes/s write). - # dirty_bytes bounds the backlog; this bounds how much of the device queue - # dind may occupy, so etcd's tiny WAL writes find a free slot. - dind-wbps: "41943040" diff --git a/infrastructure/node-io/etcd-io-guard.yaml b/infrastructure/node-io/etcd-io-guard.yaml deleted file mode 100644 index afa09af..0000000 --- a/infrastructure/node-io/etcd-io-guard.yaml +++ /dev/null @@ -1,87 +0,0 @@ -apiVersion: apps/v1 -kind: DaemonSet -metadata: - name: etcd-io-guard - namespace: node-io - labels: - app: etcd-io-guard -spec: - selector: - matchLabels: - app: etcd-io-guard - updateStrategy: - type: RollingUpdate - template: - metadata: - labels: - app: etcd-io-guard - spec: - # siriussec is the only node that hosts the etcd data dir and the dind - # runner data-root on the same NVMe. - nodeSelector: - kubernetes.io/hostname: siriussec - tolerations: - - operator: Exists - hostPID: true - priorityClassName: system-node-critical - containers: - - name: guard - image: busybox:1.36 - imagePullPolicy: IfNotPresent - # ConfigMap keys are the source filenames, so the mounted path is - # /opt/guard/guard-script.sh (NOT guard.sh - that typo kept the - # guard in CrashLoopBackOff and the limits unapplied). - command: ["/bin/sh", "/opt/guard/guard-script.sh"] - env: - - name: DIRTY_BYTES - valueFrom: - configMapKeyRef: - name: etcd-io-guard-config - key: dirty-bytes - - name: DIRTY_BACKGROUND_BYTES - valueFrom: - configMapKeyRef: - name: etcd-io-guard-config - key: dirty-background-bytes - - name: DIND_WBPS - valueFrom: - configMapKeyRef: - name: etcd-io-guard-config - key: dind-wbps - securityContext: - privileged: true - resources: - requests: - cpu: 5m - memory: 8Mi - limits: - cpu: 50m - memory: 32Mi - volumeMounts: - - name: host-proc-sys - mountPath: /host/proc/sys/vm - - name: host-proc - mountPath: /host/proc - readOnly: true - - name: host-cgroup - mountPath: /host/sys/fs/cgroup - - name: script - mountPath: /opt/guard - readOnly: true - volumes: - - name: host-proc-sys - hostPath: - path: /proc/sys/vm - type: Directory - - name: host-proc - hostPath: - path: /proc - type: Directory - - name: host-cgroup - hostPath: - path: /sys/fs/cgroup - type: Directory - - name: script - configMap: - name: etcd-io-guard-script - defaultMode: 0755 diff --git a/infrastructure/node-io/guard-script.sh b/infrastructure/node-io/guard-script.sh deleted file mode 100644 index 1aa599f..0000000 --- a/infrastructure/node-io/guard-script.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/sh -# etcd-io-guard: keep etcd's WAL fdatasync tail short while the amd64 dind -# runner hammers the same PM991 NVMe (/dev/nvme0n1p3). -# -# Two layers, both re-applied on drift every 30 s: -# -# 1. Bound the host writeback backlog (vm.dirty_bytes / dirty_background_bytes). -# On the default vm.dirty_ratio=20 a 15 GB box allows ~3 GB of dirty pages, -# so an etcd WAL commit queues behind seconds of dind writeback. 64/16 MiB -# removes the multi-second (>8 s) stalls but, measured 2026-10-26, still -# leaves 1-4 s fdatasyncs and lets kube-controller-manager / kube-scheduler -# lose their leases, because 64 MiB at this device's throttled drain rate is -# still ~1.4 s of queue. -# -# 2. Cap the dind container's dispatch rate with blk-throttle io.max. This is -# NOT the peer-scoped io.latency controller (which cannot reach across -# kubelet's per-pod slices and was measured to do nothing): io.max is an -# absolute per-cgroup cap, so the dind cgroup can only keep N requests in -# the device queue and etcd's small WAL writes find free slots. -# -# The dind container's cgroup path changes on every pod restart, so layer 2 -# re-discovers the scope by looking for the container whose main process is -# dockerd. Nothing here targets kubepods-burstable.slice (etcd lives in it). -set -u - -DB="${DIRTY_BYTES:-67108864}" -DBG="${DIRTY_BACKGROUND_BYTES:-16777216}" -WMAX="${DIND_WBPS:-41943040}" # 40 MiB/s write bandwidth cap for dind -CGROOT="${CGROUP_ROOT:-/host/sys/fs/cgroup}" -PROCROOT="${PROC_ROOT:-/host/proc}" - -log() { echo "$(date -u +%FT%TZ) $*"; } - -apply_writeback_limits() { - cur_bg="$(cat /host/proc/sys/vm/dirty_background_bytes 2>/dev/null || echo read-error)" - if [ "${cur_bg}" != "${DBG}" ]; then - if echo "${DBG}" > /host/proc/sys/vm/dirty_background_bytes 2>/dev/null; then - log "applied vm.dirty_background_bytes=${DBG} (was ${cur_bg})" - else - log "FAILED to write vm.dirty_background_bytes" - fi - fi - cur_db="$(cat /host/proc/sys/vm/dirty_bytes 2>/dev/null || echo read-error)" - if [ "${cur_db}" != "${DB}" ]; then - if echo "${DB}" > /host/proc/sys/vm/dirty_bytes 2>/dev/null; then - log "applied vm.dirty_bytes=${DB} (was ${cur_db})" - else - log "FAILED to write vm.dirty_bytes" - fi - fi -} - -# Echo the cgroup directory of the dind container, or nothing. -find_dind_cgroup() { - for procs in "${CGROOT}"/kubepods.slice/kubepods-*.slice/kubepods-*-pod*.slice/cri-containerd-*.scope/cgroup.procs; do - [ -f "${procs}" ] || continue - dir="${procs%/cgroup.procs}" - while read -r pid; do - [ -n "${pid}" ] || continue - comm="$(cat "${PROCROOT}/${pid}/comm" 2>/dev/null || true)" - if [ "${comm}" = "dockerd" ]; then - echo "${dir}" - return 0 - fi - done < "${procs}" - done - return 1 -} - -apply_io_max() { - dir="$(find_dind_cgroup)" || return 1 - want="259:0 wbps=${WMAX}" - cur="$(cat "${dir}/io.max" 2>/dev/null || true)" - # blk-throttle reads back all four fields ("259:0 rbps=max wbps=40M ..."), - # so match on the wbps field alone, not on the exact written string. - case "${cur}" in - *"wbps=${WMAX}"*) : ;; - *) - if echo "${want}" > "${dir}/io.max" 2>/dev/null; then - log "applied io.max '${want}' to ${dir#"${CGROOT}"} (was '${cur}')" - else - log "FAILED to write io.max to ${dir#"${CGROOT}"}" - fi - ;; - esac -} - -log "start dirty_bytes=${DB} dirty_background_bytes=${DBG} dind_wbps=${WMAX}" -while true; do - apply_writeback_limits - if ! apply_io_max; then - log "no dockerd cgroup found yet (runner pod down?)" - fi - sleep 30 -done diff --git a/infrastructure/node-io/kustomization.yaml b/infrastructure/node-io/kustomization.yaml deleted file mode 100644 index 4e4a7c2..0000000 --- a/infrastructure/node-io/kustomization.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - namespace.yaml - - configmap.yaml - - etcd-io-guard.yaml -configMapGenerator: - - name: etcd-io-guard-script - namespace: node-io - files: - - guard-script.sh -generatorOptions: - disableNameSuffixHash: false diff --git a/infrastructure/node-io/namespace.yaml b/infrastructure/node-io/namespace.yaml deleted file mode 100644 index f678859..0000000 --- a/infrastructure/node-io/namespace.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: node-io diff --git a/infrastructure/storage/kustomization.yaml b/infrastructure/storage/kustomization.yaml index 6a6e563..e317fb0 100644 --- a/infrastructure/storage/kustomization.yaml +++ b/infrastructure/storage/kustomization.yaml @@ -2,4 +2,3 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - local-path-storage.yaml - - local-path-linode.yaml diff --git a/infrastructure/storage/local-path-linode.yaml b/infrastructure/storage/local-path-linode.yaml deleted file mode 100644 index f432cbd..0000000 --- a/infrastructure/storage/local-path-linode.yaml +++ /dev/null @@ -1,122 +0,0 @@ -# Second local-path provisioner, pinned to the `linode` worker. -# -# The original `local-path` StorageClass keeps its single-replica provisioner on -# siriussec (and its helper pod pinned there), so a PVC consumed by a pod on -# linode would have its directory created on the ThinkPad's disk. This file adds -# an independent provisioner + StorageClass whose volumes live on linode's own -# disk. `local-path` remains the cluster default; nothing here touches it. -# -# Volumes land under /opt/local-path-provisioner/pvc-__ on linode. ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: local-path-config-linode - namespace: local-path-storage -data: - config.json: |- - { - "nodePathMap":[ - { - "node":"DEFAULT_PATH_FOR_NON_LISTED_NODES", - "paths":["/opt/local-path-provisioner"] - }, - { - "node":"linode", - "paths":["/opt/local-path-provisioner"] - } - ] - } - setup: |- - #!/bin/sh - set -eu - mkdir -m 0777 -p "$VOL_DIR" - teardown: |- - #!/bin/sh - set -eu - rm -rf "$VOL_DIR" - helperPod.yaml: |- - apiVersion: v1 - kind: Pod - metadata: - name: helper-pod - spec: - priorityClassName: system-node-critical - nodeSelector: - kubernetes.io/hostname: linode - tolerations: - - key: node.kubernetes.io/disk-pressure - operator: Exists - effect: NoSchedule - - key: dedicated - operator: Equal - value: network - effect: PreferNoSchedule - containers: - - name: helper-pod - image: busybox - imagePullPolicy: IfNotPresent ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: local-path-provisioner-linode - namespace: local-path-storage -spec: - replicas: 1 - selector: - matchLabels: - app: local-path-provisioner-linode - template: - metadata: - labels: - app: local-path-provisioner-linode - spec: - serviceAccountName: local-path-provisioner-service-account - nodeSelector: - kubernetes.io/hostname: linode - tolerations: - - key: dedicated - operator: Equal - value: network - effect: PreferNoSchedule - containers: - - name: local-path-provisioner - image: rancher/local-path-provisioner:v0.0.31 - imagePullPolicy: IfNotPresent - command: - - local-path-provisioner - - --debug - - start - - --config - - /etc/config/config.json - - --provisioner-name - - rancher.io/local-path-linode - - --configmap-name - - local-path-config-linode - volumeMounts: - - name: config-volume - mountPath: /etc/config/ - env: - - name: POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: CONFIG_MOUNT_PATH - value: /etc/config/ - - name: KUBERNETES_SERVICE_HOST - value: "10.10.0.2" - - name: KUBERNETES_SERVICE_PORT - value: "6443" - volumes: - - name: config-volume - configMap: - name: local-path-config-linode ---- -apiVersion: storage.k8s.io/v1 -kind: StorageClass -metadata: - name: local-path-linode -provisioner: rancher.io/local-path-linode -volumeBindingMode: WaitForFirstConsumer -reclaimPolicy: Delete diff --git a/infrastructure/wireguard/backup/README.md b/infrastructure/wireguard/backup/README.md deleted file mode 100644 index 3e04dac..0000000 --- a/infrastructure/wireguard/backup/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# WireGuard hub state — backup of `/etc/wireguard` + the wgportal peer database - -The Pi (`rpi`, `10.10.0.1`) is the WireGuard **hub** of the mesh *and* a spoke -of the Linode hub (`10.20.0.1`). Two files there are unrebuildable: - -| Path | What it is | -|---|---| -| `/etc/wireguard/wg0.conf` | wgportal-autogenerated hub config: wg0 server key, every peer, every `AllowedIPs` | -| `/etc/wireguard/wg-remote.conf` | the Pi→Linode spoke (key + endpoint) | -| `/opt/wgportal/data/sqlite.db` | wgportal's peer database (identifiers, keys, allowed IPs, display names) | - -A rebuilt Pi comes back from git + Garage's own backup — but the peer set and -the hub key would be gone, and with them every remote-access path. This -directory mirrors `infrastructure/garage/backup/`: a small script plus a -systemd timer that copies the state **off the Pi** to -`root@10.20.0.1:/root/pihost-backup/`. - -## This directory is NOT applied by Flux - -Flux only reconciles `./clusters/homek8s`. Install these by hand (they are host -units, not cluster objects): - -```bash -# from the repo checkout on the Pi (or scp the three files over) -sudo install -m 0755 wireguard-backup.sh /usr/local/sbin/wireguard-backup.sh -sudo install -m 0644 wireguard-backup.service wireguard-backup.timer /etc/systemd/system/ -sudo systemctl daemon-reload -sudo systemctl enable --now wireguard-backup.timer - -# one hand-fired run, and read the result (exit code is the truth) -sudo systemctl start wireguard-backup.service -systemctl status wireguard-backup.service --no-pager -journalctl -u wireguard-backup.service -n 40 --no-pager -``` - -Re-run the install after a Pi reinstall — the units do not survive a reimage. - -## What lands on the Linode - -``` -/root/pihost-backup/wireguard/wireguard-.tar.gz mode 0600 -/root/pihost-backup/manifests/.txt sizes + sha256 -``` - -- One tarball per run (`/etc/wireguard/` verbatim, including the `.bak` peer - history, plus `wgportal-sqlite.db`). Retention: **14** tarballs + 14 - manifests, enforced by the script. -- The sqlite copy is taken with the **sqlite backup API** (python3 stdlib — - there is no `sqlite3` CLI on the Pi), not `cp`: a live `cp` can capture a - half-written page. The script runs `PRAGMA integrity_check` on the copy and - fails the unit if it is not `ok`. -- The tarball is checksummed on both sides before the `.part` file is renamed. -- Transport is the `wg-remote` tunnel using the existing `sirius` user key - (`/home/sirius/.ssh/linode_admin`). Never the Linode public IP. - -## Restore - -The tarball contains private keys — treat it as a secret, not an archive. - -```bash -# pull the newest tarball and inspect it WITHOUT writing to /etc -ssh -i /home/sirius/.ssh/linode_admin root@10.20.0.1 \ - 'ls -1t /root/pihost-backup/wireguard/*.tar.gz | head -1' # pick a stamp -ssh -i /home/sirius/.ssh/linode_admin root@10.20.0.1 \ - 'cat /root/pihost-backup/wireguard/wireguard-.tar.gz' \ - | tar -tzf - - -# restore onto a rebuilt Pi (stop the interfaces first so a running wg-quick -# does not rewrite wg0.conf with SaveConfig = true) -sudo systemctl stop wg-quick@wg-remote || true -sudo wg-quick down wg0 || true -ssh ... 'cat /root/pihost-backup/wireguard/wireguard-.tar.gz' | sudo tar -xzf - -C / -sudo install -m 0600 -o root -g root /dev/null /dev/null # no-op, permissions come from the archive -sudo systemctl start wg-quick@wg0 && sudo systemctl start wg-quick@wg-remote -sudo wg show -``` - -If only wgportal lost its database: extract `wgportal-sqlite.db` from the -tarball, run `PRAGMA integrity_check` on it, and copy it over -`/opt/wgportal/data/sqlite.db` while the wgportal container is stopped — a -portal restart rewrites peers from live `wg set` state, so stop/start it -deliberately rather than leaving it running mid-restore. diff --git a/infrastructure/wireguard/backup/wireguard-backup.service b/infrastructure/wireguard/backup/wireguard-backup.service deleted file mode 100644 index 701c661..0000000 --- a/infrastructure/wireguard/backup/wireguard-backup.service +++ /dev/null @@ -1,18 +0,0 @@ -# /etc/systemd/system/wireguard-backup.service (rpi) -# -# Hub state -> Linode VPS. The peer set and the wg0 server key are the one -# thing on the Pi that neither Flux nor a git repo can rebuild; a Pi disk loss -# would otherwise take remote access with it. -[Unit] -Description=WireGuard hub state (etc/wireguard + wgportal sqlite) -> Linode VPS -After=network-online.target docker.service -Wants=network-online.target - -[Service] -Type=oneshot -ExecStart=/usr/local/sbin/wireguard-backup.sh -# A slow tunnel is not a reason to retry a small job forever. -TimeoutStartSec=10min -Nice=10 -# The tarball is an archive of private keys. -UMask=0077 diff --git a/infrastructure/wireguard/backup/wireguard-backup.sh b/infrastructure/wireguard/backup/wireguard-backup.sh deleted file mode 100644 index a2092eb..0000000 --- a/infrastructure/wireguard/backup/wireguard-backup.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env bash -# WireGuard hub-state backup — /etc/wireguard + the wgportal peer database, -# copied OFF the Pi to the Linode VPS over the wg-remote tunnel. -# -# Why this exists: the Pi is the WireGuard *hub*. Its /etc/wireguard carries the -# wg0 server key and every peer's public key/allowed-ips, and wgportal's sqlite -# is the peer database the UI renders. Losing the Pi's disk would take the whole -# remote-access path with it — including the tunnel you would need to fix it. -# -# Destination is 10.20.0.1 (the hub's VPN address), never the public IP, and -# never the Pi itself: a backup on the machine it protects is not a backup. -# Mirrors infrastructure/garage/backup/ in shape (same key, same host, same -# timer/oneshot style). Not managed by Flux — install it with the steps in -# ./README.md. -# -# Run as root (systemd does): /etc/wireguard is 0600 root:root and -# /opt/wgportal/data is 0700 root:root. -# -# Exit code is the truth: the unit is oneshot, so -# `systemctl status wireguard-backup.service` shows the last result. -set -euo pipefail - -KEY=/home/sirius/.ssh/linode_admin -REMOTE=root@10.20.0.1 -DEST=/root/pihost-backup -KEEP=14 -STAGE=/var/lib/pihost-backup -STAMP=${STAMP:-$(date -u +%Y%m%dT%H%M%SZ)} - -# Host key: root on the Pi has no known_hosts entry for the VPN peer and a -# rebuilt Pi would not have one either. accept-new pins it on first contact and -# still fails loudly if it later changes; the transport is already an -# authenticated WireGuard tunnel. -SSH="ssh -i $KEY -o IdentitiesOnly=yes -o BatchMode=yes -o StrictHostKeyChecking=accept-new -o ConnectTimeout=20" -log() { printf '%s %s\n' "$(date -u +%FT%TZ)" "$*"; } - -log "target check: $($SSH "$REMOTE" 'hostname; df -h / | tail -1')" -$SSH "$REMOTE" "install -d -m 0700 '$DEST' '$DEST/wireguard' '$DEST/manifests'" - -install -d -m 0700 "$STAGE" -work="$STAGE/$STAMP" -rm -rf "$work"; install -d -m 0700 "$work" -trap 'rm -rf "$work"' EXIT - -log "collecting /etc/wireguard" -# Whole directory including the wgportal-autogenerated wg0.conf, wg-remote.conf -# and their .bak history (the .bak files are how old peer sets survive a bad -# SaveConfig rewrite). -cp -a /etc/wireguard "$work/wireguard" - -if [ -f /opt/wgportal/data/sqlite.db ]; then - log "consistent copy of wgportal sqlite" - # A plain cp of a live sqlite file can capture a half-written page; the - # backup API takes a read transaction instead. python3 is on the Pi, there is - # no sqlite3 CLI. - python3 - "$work/wgportal-sqlite.db" <<'PY' -import sqlite3, sys -src = sqlite3.connect("/opt/wgportal/data/sqlite.db", timeout=30) -src.execute("PRAGMA busy_timeout=30000") -dst = sqlite3.connect(sys.argv[1]) -src.backup(dst) -dst.close() -src.close() -chk = sqlite3.connect(sys.argv[1]) -verdict = chk.execute("PRAGMA integrity_check").fetchone()[0] -peers = chk.execute("SELECT count(*) FROM peers").fetchone()[0] -chk.close() -print(" integrity_check=%s peers=%s" % (verdict, peers)) -if verdict != "ok": - sys.exit("FAIL: wgportal sqlite integrity_check returned %r" % verdict) -PY -else - log "WARN: /opt/wgportal/data/sqlite.db missing — backing up /etc/wireguard only" -fi - -log "manifest" -( cd "$work" && find . -type f -printf '%s %p\n' | sort -k2 | sed 's| \./| |' > MANIFEST.sizes - find . -type f ! -name MANIFEST.sha256 -print0 | sort -z | xargs -0 -r sha256sum > MANIFEST.sha256 ) -manifest_text=$(cat "$work/MANIFEST.sizes") - -tarfile="$STAGE/wireguard-$STAMP.tar.gz" -tar -C "$work" -czf "$tarfile" . -local_sha=$(sha256sum "$tarfile" | awk '{print $1}') -local_size=$(wc -c < "$tarfile") -log "shipping $local_size bytes sha256=$local_sha" - -$SSH "$REMOTE" "cat > '$DEST/wireguard/wireguard-$STAMP.tar.gz.part'" < "$tarfile" -remote_sha=$($SSH "$REMOTE" "sha256sum '$DEST/wireguard/wireguard-$STAMP.tar.gz.part' | awk '{print \$1}'") -if [ "$local_sha" != "${remote_sha:-none}" ]; then - echo "FAIL: sha256 mismatch (local=$local_sha remote=${remote_sha:-none})" - $SSH "$REMOTE" "rm -f '$DEST/wireguard/wireguard-$STAMP.tar.gz.part'" - exit 1 -fi -$SSH "$REMOTE" "mv '$DEST/wireguard/wireguard-$STAMP.tar.gz.part' '$DEST/wireguard/wireguard-$STAMP.tar.gz' && \ - chmod 600 '$DEST/wireguard/wireguard-$STAMP.tar.gz'" - -# Remote manifest: sizes + checksums, the same evidence habit as the cluster -# backup job (/root/cluster-backup/manifests/.txt). -{ - printf 'stamp %s\nhost %s\n' "$STAMP" "$(hostname -s)" - printf -- '--- tarball\n%s %s bytes wireguard-%s.tar.gz\n' "$local_sha" "$local_size" "$STAMP" - printf -- '--- contents\n%s\n' "$manifest_text" -} | $SSH "$REMOTE" "cat > '$DEST/manifests/$STAMP.txt'" - -log "retention: last $KEEP tarballs" -$SSH "$REMOTE" "cd '$DEST/wireguard' && ls -1t *.tar.gz 2>/dev/null | tail -n +$((KEEP + 1)) | xargs -r rm -f" -$SSH "$REMOTE" "cd '$DEST/manifests' && ls -1t *.txt 2>/dev/null | tail -n +$((KEEP + 1)) | xargs -r rm -f" -$SSH "$REMOTE" "ls -l '$DEST/wireguard/wireguard-$STAMP.tar.gz'; df -h '$DEST' | tail -1" - -log "RESULT=success stamp=$STAMP" diff --git a/infrastructure/wireguard/backup/wireguard-backup.timer b/infrastructure/wireguard/backup/wireguard-backup.timer deleted file mode 100644 index c67f423..0000000 --- a/infrastructure/wireguard/backup/wireguard-backup.timer +++ /dev/null @@ -1,13 +0,0 @@ -# /etc/systemd/system/wireguard-backup.timer (rpi) -[Unit] -Description=Nightly WireGuard hub-state backup - -[Timer] -# 04:13 local time, jittered so it does not race the 03:36 garage-data run. -OnCalendar=*-*-* 04:13:00 -RandomizedDelaySec=600 -Persistent=true -Unit=wireguard-backup.service - -[Install] -WantedBy=timers.target diff --git a/monitoring/controllers/home/dashboards/build.py b/monitoring/controllers/home/dashboards/build.py deleted file mode 100644 index fe46072..0000000 --- a/monitoring/controllers/home/dashboards/build.py +++ /dev/null @@ -1,438 +0,0 @@ -#!/usr/bin/env python3 -"""Build the three homelab Grafana dashboards as provisioned ConfigMaps. - -Emits monitoring/controllers/home/dashboards/*.yaml in ~/Projects/homek8s. -The JSON dashboard lives inside the ConfigMap under a `.json` key, which is what -the kube-prometheus-stack grafana dashboard sidecar (LABEL=grafana_dashboard, -LABEL_VALUE=1, NAMESPACE=ALL) mounts. - -Kept as a script so panel edits are reviewable and the validation step -(validate_panels.py) can re-read the same JSON from the emitted YAML. -""" -import json -import os -import sys - -OUT_DIR = sys.argv[1] if len(sys.argv) > 1 else os.path.expanduser( - "~/Projects/homek8s/monitoring/controllers/home/dashboards") - -DS = {"type": "prometheus", "uid": "prometheus"} -CLUSTER_NS = 'namespace=~"$namespace"' - -_next_id = [0] - - -def pid(): - _next_id[0] += 1 - return _next_id[0] - - -def target(expr, legend=None, ref="A", instant=False, fmt="time_series"): - t = {"datasource": DS, "expr": expr, "refId": ref, - "editorMode": "code", "range": not instant, "instant": instant} - if legend: - t["legendFormat"] = legend - return t - - -def ts(title, targets, grid, unit=None, desc="", stack=False, fill=0, overrides=None, - w=12, h=8): - p = { - "id": pid(), "type": "timeseries", "title": title, "description": desc, - "datasource": DS, "gridPos": grid, "targets": targets, - "fieldConfig": {"defaults": {"custom": {"lineWidth": 1, "fillOpacity": fill, - "showPoints": "never"}, - "color": {"mode": "palette-classic"}}, - "overrides": overrides or []}, - "options": {"legend": {"displayMode": "list", "placement": "bottom", - "calcs": ["lastNotNull"]}, - "tooltip": {"mode": "multi", "sort": "desc"}}, - } - if unit: - p["fieldConfig"]["defaults"]["unit"] = unit - if stack: - p["fieldConfig"]["defaults"]["custom"]["stacking"] = {"mode": "normal"} - return p - - -def stat(title, targets, grid, unit=None, desc="", text_size=32, reducer="lastNotNull", - thresholds=None, w=4, h=5, decimals=None): - p = { - "id": pid(), "type": "stat", "title": title, "description": desc, - "datasource": DS, "gridPos": grid, "targets": targets, - "fieldConfig": {"defaults": { - "color": {"mode": "thresholds"}, - "mappings": [], - "thresholds": {"mode": "absolute", "steps": thresholds or [ - {"color": "red", "value": None}, - {"color": "green", "value": 1}]}, - }, "overrides": []}, - "options": {"colorMode": "value", "graphMode": "area", - "reduceOptions": {"calcs": [reducer], "fields": "", "values": False}, - "textMode": "auto", "justifyMode": "auto"}, - } - if unit: - p["fieldConfig"]["defaults"]["unit"] = unit - if decimals is not None: - p["fieldConfig"]["defaults"]["decimals"] = decimals - return p - - -def bargauge(title, targets, grid, unit=None, desc="", w=8, h=8): - return { - "id": pid(), "type": "bargauge", "title": title, "description": desc, - "datasource": DS, "gridPos": grid, "targets": targets, - "fieldConfig": {"defaults": {"unit": unit or "short", "min": 0, - "color": {"mode": "palette-classic"}, - "mappings": []}, "overrides": []}, - "options": {"displayMode": "gradient", "orientation": "horizontal", - "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": False}, - "showUnfilled": True, "valueMode": "color"}, - } - - -def note(title, md, grid, h=6): - return { - "id": pid(), "type": "text", "title": title, "gridPos": grid, - "options": {"mode": "markdown", "code": {"language": "plaintext", "showLineNumbers": False, - "showMiniMap": False}, - "content": md}, - } - - -def row(title, y): - return {"id": pid(), "type": "row", "title": title, "collapsed": False, - "gridPos": {"h": 1, "w": 24, "x": 0, "y": y}, "panels": []} - - -def dashboard(uid, title, tags, panels, description, variables=None): - return { - "uid": uid, "title": title, "description": description, "tags": tags, - "timezone": "browser", "editable": True, "graphTooltip": 1, - "schemaVersion": 39, "version": 1, "refresh": "30s", - "time": {"from": "now-6h", "to": "now"}, - "annotations": {"list": [{"builtIn": 1, "datasource": {"type": "grafana", "uid": "-- Grafana --"}, - "enable": True, "hide": True, "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", "type": "dashboard"}]}, - "links": [], - "templating": {"list": variables or []}, - "panels": panels, - } - - -def ns_variable(): - return { - "name": "namespace", "label": "Postgres cluster (namespace)", "type": "query", - "datasource": DS, "refresh": 1, "includeAll": True, "multi": True, - "allValue": ".*", "current": {"selected": True, "text": ["All"], "value": ["$__all"]}, - "options": [], - "query": {"query": "label_values(cnpg_collector_up, namespace)", "refId": "PromQLNamespace"}, - } - - -# ---------------------------------------------------------------- runners ----- -# Only the three runner Deployments' pods. `forgejo-runner-.*` also matches the -# `forgejo-runner-prune-*` CronJob pods, which are Completed and permanently -# "not Ready" — that turned a 0 into a 3 on the not-Ready stat. -RUN = 'namespace="forgejo",pod=~"forgejo-runner-(amd64|arm64|deploy-arm64)-.*"' -SIRIUSSEC_FS = 'instance="10.10.0.2:9100",mountpoint="/"' -RPI_FS = 'instance="10.10.0.1:9100",mountpoint="/"' - -runners = [ - row("Runners & queue", 0), - stat("Runner pods Ready", [target('sum(kube_deployment_status_replicas_ready{namespace="forgejo",deployment=~"forgejo-runner-.*"}) or vector(0)')], - {"h": 5, "w": 4, "x": 0, "y": 1}, desc="replicas_ready summed across the three runner Deployments. Expected 3.", - thresholds=[{"color": "red", "value": None}, {"color": "yellow", "value": 2}, {"color": "green", "value": 3}]), - stat("Runner pods not Ready", [target('sum(kube_pod_status_ready{%s,condition="false"} == 1) or vector(0)' % RUN)], - {"h": 5, "w": 4, "x": 4, "y": 1}, desc="Running-but-not-Ready runner pods (crashloop, failing probe).", - thresholds=[{"color": "green", "value": None}, {"color": "red", "value": 1}], reducer="lastNotNull"), - stat("Last runner poll age", [target('max(cnpg_actions_runners_last_online_seconds{namespace="forgejo"})')], - {"h": 5, "w": 4, "x": 8, "y": 1}, unit="s", - desc="Worst of the three runners, from Forgejo's action_runner.last_online. A Running pod whose poll age climbs is a runner that cannot reach the forge.", - thresholds=[{"color": "green", "value": None}, {"color": "yellow", "value": 90}, {"color": "red", "value": 300}]), - stat("Queue depth", [target('max(cnpg_actions_queue_depth{namespace="forgejo"})')], - {"h": 5, "w": 4, "x": 12, "y": 1}, - desc="Jobs assigned to a runner that have not started (action_run_job: started=0, stopped=0, status<>4).", - thresholds=[{"color": "green", "value": None}, {"color": "yellow", "value": 1}, {"color": "red", "value": 3}]), - stat("Running now", [target('max(cnpg_actions_running_total{namespace="forgejo"})')], - {"h": 5, "w": 4, "x": 16, "y": 1}, - desc="Jobs currently executing. capacity=1 per runner, so >3 here means something is stuck."), - stat("Queue while running = contention", [target('max((cnpg_actions_queue_depth{namespace="forgejo"} > bool 0) * (cnpg_actions_running_total{namespace="forgejo"} > bool 0))')], - {"h": 5, "w": 4, "x": 20, "y": 1}, - desc="1 = jobs are queued while another job runs, i.e. the single-slot runners are the bottleneck (this is why capacity stays 1: two concurrent jobs clobbered the shared docker volumes).", - thresholds=[{"color": "green", "value": None}, {"color": "orange", "value": 1}]), - - row("Action throughput & outcomes", 6), - ts("Jobs finished, by status (24h window)", - [target('cnpg_actions_jobs_window_total{namespace="forgejo",window="24h"}', "status {{status}}")], - {"h": 8, "w": 8, "x": 0, "y": 7}, unit="short", - desc="Rolling 24h count of action_run_job rows with stopped in the window. status 1=success 2=failure 3=cancelled 4=skipped (codes validated against /api/v1 .../actions/runs)."), - ts("Successes / hour and failures / hour", - [target('max(cnpg_actions_jobs_window_total{namespace="forgejo",window="1h",status="1"})', "success, last 60m"), - target('max(cnpg_actions_jobs_window_total{namespace="forgejo",window="1h",status="2"})', "failure, last 60m", ref="B")], - {"h": 8, "w": 8, "x": 8, "y": 7}, unit="short", - desc="Jobs that finished inside the last rolling hour. A true rolling count, not rate() over a row count — Forgejo prunes rows, so rate() would drift."), - ts("Oldest not-yet-started job age", - [target('cnpg_actions_queue_oldest_pending_seconds{namespace="forgejo"}')], - {"h": 8, "w": 8, "x": 16, "y": 7}, unit="s", - desc="How long the oldest queued job has been waiting. Flat 0 = nothing queued."), - - row("Runner pods", 15), - ts("Runner pod restarts (24h)", [target('sum by (pod, container) (increase(kube_pod_container_status_restarts_total{%s}[24h]))' % RUN, "{{pod}} / {{container}}")], - {"h": 8, "w": 8, "x": 0, "y": 16}, unit="short", - desc="increase() over 24h from kube-state-metrics. The history behind this board: the amd64 runner crashlooped on dind socket permissions."), - ts("CPU usage per runner pod", [target('sum by (pod) (rate(container_cpu_usage_seconds_total{%s,container!=""}[5m]))' % RUN, "{{pod}}")], - {"h": 8, "w": 8, "x": 8, "y": 16}, unit="cores", - desc="cAdvisor CPU per runner pod. The dind sidecar of forgejo-runner-amd64 does the actual build work."), - ts("Memory working set per runner pod", [target('sum by (pod) (container_memory_working_set_bytes{%s,container!=""})' % RUN, "{{pod}}")], - {"h": 8, "w": 8, "x": 16, "y": 16}, unit="bytes", - desc="cAdvisor working set. Note the amd64 runner's dind keeps a 1Gi memory limit — a build that OOMs shows here first."), - - row("Disk — the one that actually bites", 24), - ts("Runner pod network I/O", [target('sum by (pod) (rate(container_network_receive_bytes_total{%s}[5m]))' % RUN, "{{pod}} in"), - target('sum by (pod) (rate(container_network_transmit_bytes_total{%s}[5m]))' % RUN, "{{pod}} out", ref="B")], - {"h": 8, "w": 8, "x": 0, "y": 25}, unit="Bps", desc="Image pulls and artifact traffic through the pod interface."), - stat("dind PVC nominal size", [target('max(kube_persistentvolumeclaim_resource_requests_storage_bytes{namespace="forgejo",persistentvolumeclaim="forgejo-runner-amd64"})')], - {"h": 8, "w": 4, "x": 8, "y": 25}, unit="bytes", - desc="Requested size of the forgejo-runner-amd64 PVC (docker data-root + named CI volumes). This is the ceiling, not the usage — see the note on this row."), - stat("siriussec root fs used", [target('100 * (1 - node_filesystem_avail_bytes{%s} / node_filesystem_size_bytes{%s})' % (SIRIUSSEC_FS, SIRIUSSEC_FS))], - {"h": 8, "w": 4, "x": 12, "y": 25}, unit="percent", - desc="The dind data-root lives on /opt/local-path-provisioner inside this filesystem, so this IS the number that caused the DiskPressure evictions at ~86%.", - thresholds=[{"color": "green", "value": None}, {"color": "yellow", "value": 75}, {"color": "red", "value": 85}]), - stat("siriussec days to full", [target('clamp_max(node_filesystem_avail_bytes{%s} / clamp_min(-deriv(node_filesystem_avail_bytes{%s}[1h]), 0.0000001) / 86400, 365)' % (SIRIUSSEC_FS, SIRIUSSEC_FS))], - {"h": 8, "w": 4, "x": 16, "y": 25}, unit="d", decimals=1, - desc="Linear projection from the last hour of free-space trend; 365 = not shrinking. Only meaningful after a few hours of history.", - thresholds=[{"color": "red", "value": None}, {"color": "yellow", "value": 30}, {"color": "green", "value": 90}]), - ts("rpi root fs used %", [target('100 * (1 - node_filesystem_avail_bytes{%s} / node_filesystem_size_bytes{%s})' % (RPI_FS, RPI_FS))], - {"h": 8, "w": 4, "x": 20, "y": 25}, unit="percent", - desc="The arm64 runners run their jobs as HOST docker containers on rpi, so their writes land here, not in any PVC. node-exporter on rpi is what makes this visible."), - - note("What this board can and cannot see", """\ -**Measured:** runner Deployments (kube-state-metrics), runner pods CPU/mem/net/restarts (cAdvisor), -runner liveness as *Forgejo* sees it (`action_runner.last_online`), queue depth and job outcomes -(`action_run_job` via the CNPG exporter), and the host filesystems that CI fills (node-exporter). - -**Not measurable — by design, not by omission:** - -- **Per-job breakdown on the arm64 runner.** `forgejo-runner-arm64` and - `forgejo-runner-deploy-arm64` drive the **host** Docker socket (gid 984), so their jobs are - plain host containers with no pod identity. cAdvisor/kube-state-metrics see only the runner - pod itself. There is no per-job CPU/mem/disk on rpi and there cannot be one without changing - the runner to dind — which this board deliberately does not propose. -- **Per-PV bytes for the dind PVC.** kubelet 1.34+ no longer exports the alpha - `kubelet_volume_stats_*` set at all: its `/metrics/volumes` endpoint returns 404 on every node - here (kubelet v1.36.4; upstream kubernetes/kubernetes#133847), so no scrape config can produce - those series and it is not a hostPath quirk. The usable proxy is the runner node's root - filesystem usage plus the PVC's requested size, both on this row — and the `RunnerDindDisk*` - alerts watch that same filesystem, scoped to nodes that run a runner. -""", {"h": 7, "w": 24, "x": 0, "y": 33}), -] - -# ----------------------------------------------------------------- cnpg ------- -cnpg = [ - row("Cluster health", 0), - stat("Instances up", [target('min by (namespace) (cnpg_collector_up{%s})' % CLUSTER_NS)], - {"h": 5, "w": 4, "x": 0, "y": 1}, desc="cnpg_collector_up from the instance manager (:9187) — 1 = PostgreSQL answering."), - stat("Nodes used / instances", [target('max by (namespace) (cnpg_collector_nodes_used{%s})' % CLUSTER_NS)], - {"h": 5, "w": 4, "x": 4, "y": 1}, desc="1 with instances: 1 — no HA. Documented as a known limit, not a fault."), - stat("Connections used", [target('sum by (namespace) (cnpg_backends_total{%s})' % CLUSTER_NS)], - {"h": 5, "w": 4, "x": 8, "y": 1}, desc="pg_stat_activity backends, all states."), - stat("Connections / max_connections", [target('100 * sum by (namespace) (cnpg_backends_total{%s}) / max by (namespace) (cnpg_pg_settings_setting{%s,name="max_connections"})' % (CLUSTER_NS, CLUSTER_NS))], - {"h": 5, "w": 4, "x": 12, "y": 1}, unit="percent", - desc="Used against the server's own max_connections setting, so it stays right if the setting changes.", - thresholds=[{"color": "green", "value": None}, {"color": "yellow", "value": 70}, {"color": "red", "value": 90}]), - stat("Manual switchover required", [target('max by (namespace) (cnpg_collector_manual_switchover_required{%s})' % CLUSTER_NS)], - {"h": 5, "w": 4, "x": 16, "y": 1}, - desc="1 = the operator is asking for a manual switchover (e.g. after a fencing event).", - thresholds=[{"color": "green", "value": None}, {"color": "red", "value": 1}]), - stat("Last available backup", [target('max by (namespace) (barman_cloud_cloudnative_pg_io_last_available_backup_timestamp{%s} or cnpg_collector_last_available_backup_timestamp{%s})' % (CLUSTER_NS, CLUSTER_NS))], - {"h": 5, "w": 4, "x": 20, "y": 1}, unit="dateTimeAsIso", - desc="0 = never. sirius-growth/portal archives through the CNPG-I Barman Cloud plugin, whose metric is `barman_cloud_cloudnative_pg_io_last_available_backup_timestamp`; the deprecated `cnpg_collector_*` name is the fallback for any cluster still on the in-tree path. Order matters: the legacy series is still scraped for portal and holds the PRE-migration timestamp, so it must not win the `or`.", - thresholds=[{"color": "red", "value": None}, {"color": "green", "value": 1}]), - - row("Throughput", 6), - ts("Transactions/s — commit vs rollback", - [target('sum by (namespace) (rate(cnpg_pg_stat_database_xact_commit{%s}[5m]))' % CLUSTER_NS, "{{namespace}} commit"), - target('sum by (namespace) (rate(cnpg_pg_stat_database_xact_rollback{%s}[5m]))' % CLUSTER_NS, "{{namespace}} rollback", ref="B")], - {"h": 8, "w": 12, "x": 0, "y": 7}, unit="ops", - desc="From pg_stat_database, which Forgejo's connection pool drives directly."), - ts("Commit share", [target('sum(rate(cnpg_pg_stat_database_xact_commit{%s}[5m])) / clamp_min(sum(rate(cnpg_pg_stat_database_xact_commit{%s}[5m])) + sum(rate(cnpg_pg_stat_database_xact_rollback{%s}[5m])), 0.0000001)' % (CLUSTER_NS, CLUSTER_NS, CLUSTER_NS))], - {"h": 8, "w": 6, "x": 12, "y": 7}, unit="percentunit", - desc="Commit / (commit + rollback). clamp_min keeps a quiet database from rendering NaN."), - ts("Cache hit ratio", [target('sum by (namespace) (rate(cnpg_pg_stat_database_blks_hit{%s}[5m])) / clamp_min(sum by (namespace) (rate(cnpg_pg_stat_database_blks_hit{%s}[5m])) + sum by (namespace) (rate(cnpg_pg_stat_database_blks_read{%s}[5m])), 0.0000001)' % (CLUSTER_NS, CLUSTER_NS, CLUSTER_NS), "{{namespace}}")], - {"h": 8, "w": 6, "x": 18, "y": 7}, unit="percentunit", - desc="shared_buffers hit ratio. A lab database with 256Mi request will sit high; a drop means the working set outgrew the buffers."), - - row("Errors and pressure", 15), - ts("Deadlocks (24h increase)", [target('sum by (namespace) (increase(cnpg_pg_stat_database_deadlocks{%s}[24h]))' % CLUSTER_NS, "{{namespace}}")], - {"h": 8, "w": 8, "x": 0, "y": 16}, unit="short", - desc="increase() on a counter that exists on every database, so a quiet DB renders a hard 0 rather than 'No data'."), - ts("Temp bytes/s", [target('sum by (namespace) (rate(cnpg_pg_stat_database_temp_bytes{%s}[5m]))' % CLUSTER_NS, "{{namespace}}")], - {"h": 8, "w": 8, "x": 8, "y": 16}, unit="Bps", - desc="Spill to disk from sorts/hashes that did not fit work_mem. Non-zero during Forgejo Actions index scans is expected."), - ts("Longest transaction age", [target('max by (namespace) (cnpg_backends_max_tx_duration_seconds{%s})' % CLUSTER_NS, "{{namespace}}")], - {"h": 8, "w": 8, "x": 16, "y": 16}, unit="s", - desc="Longest open transaction (pg_stat_activity.xact_start). The CNPG default query set exposes transaction age, not per-statement query age — see docs."), - - row("Size, WAL, replication", 24), - ts("Database size", [target('max by (namespace, datname) (cnpg_pg_database_size_bytes{%s,datname!~"template.*|postgres"})' % CLUSTER_NS, "{{namespace}}/{{datname}}")], - {"h": 8, "w": 8, "x": 0, "y": 25}, unit="bytes", - desc="pg_database_size. Both PVs are 10Gi (forgejo/pg) and 5Gi (sirius-growth/portal) — this is the trend that fills them."), - ts("WAL generation", [target('sum by (namespace) (rate(cnpg_collector_wal_bytes{%s}[5m]))' % CLUSTER_NS, "{{namespace}}")], - {"h": 8, "w": 8, "x": 8, "y": 25}, unit="Bps", - desc="Bytes of WAL written per second. sirius-growth/portal archives its WAL to the Linode Garage; forgejo/pg does not archive, so its WAL only ever fills the pg_wal directory."), - ts("WAL archiver failures", [target('max by (namespace) (cnpg_pg_stat_archiver_failed_count{%s})' % CLUSTER_NS, "{{namespace}}")], - {"h": 8, "w": 8, "x": 16, "y": 25}, unit="short", - desc="pg_stat_archiver.failed_count. Archiving is configured only on sirius-growth/portal (Barman Cloud plugin -> Linode Garage); forgejo/pg has no archiver, so any non-zero value is the honest signal that WAL failed to reach the archive."), - - row("Replication (single instance — panels are honest about it)", 33), - ts("Replication lag", [target('max by (namespace) (cnpg_pg_replication_lag{%s})' % CLUSTER_NS, "{{namespace}}")], - {"h": 6, "w": 8, "x": 0, "y": 34}, unit="s", - desc="0 on the primary with no standby. With instances: 1 this metric is structurally zero, not evidence that replication is healthy."), - ts("Streaming replicas / in recovery", [target('max by (namespace) (cnpg_pg_replication_streaming_replicas{%s})' % CLUSTER_NS, "{{namespace}} streaming"), - target('max by (namespace) (cnpg_pg_replication_in_recovery{%s})' % CLUSTER_NS, "{{namespace}} in recovery", ref="B")], - {"h": 6, "w": 8, "x": 8, "y": 34}, unit="short", - desc="Both clusters run instances: 1, so 0 streaming replicas and in_recovery=0 is the correct reading. A future replica would light these up with no dashboard change."), - note("Known unknowns on the CNPG board", """\ -- **Backups exist on one cluster only.** `sirius-growth/portal` archives WAL + daily base backups - through the CNPG-I Barman Cloud plugin (`ObjectStore portal-wal`) into the Linode Garage; - `forgejo/pg` has no archiver by design. The "Last available backup" stat reads 0 only if neither - the plugin's `barman_cloud_cloudnative_pg_io_last_available_backup_timestamp` nor the legacy - `cnpg_collector_last_available_backup_timestamp` series exists. -- **Single instance.** Both clusters run `instances: 1`, so replication lag / streaming replicas / - in recovery are structurally zero. The panels show the zero and say so instead of hiding them. -- **Query age vs transaction age.** CNPG's default query set exposes - `cnpg_backends_max_tx_duration_seconds` (transaction age). Per-statement `query_start` age is not in - the default set; adding it would need another custom query in the cluster's - `customQueriesConfigMap`. -- **Permissions.** Custom queries run as `cnpg_metrics_exporter`, not superuser. See - docs/monitoring-dashboards.md for the GRANT the Forgejo Actions metrics need. -""", {"h": 8, "w": 24, "x": 0, "y": 40}), -] - -# -------------------------------------------------------------- workloads ----- -workloads = [ - row("Cluster", 0), - stat("Nodes Ready", [target('count(kube_node_status_condition{condition="Ready",status="true"} == 1) or vector(0)')], - {"h": 5, "w": 4, "x": 0, "y": 1}, thresholds=[{"color": "red", "value": None}, {"color": "yellow", "value": 2}, {"color": "green", "value": 3}]), - stat("Nodes with DiskPressure", [target('sum(kube_node_status_condition{condition="DiskPressure",status="true"} == 1) or vector(0)')], - {"h": 5, "w": 4, "x": 4, "y": 1}, - desc="The taint that evicted Forgejo and pg-1 in the past. >0 here is an incident, not a warning.", - thresholds=[{"color": "green", "value": None}, {"color": "red", "value": 1}]), - stat("Pending pods", [target('sum(kube_pod_status_phase{phase="Pending"} == 1) or vector(0)')], - {"h": 5, "w": 4, "x": 8, "y": 1}, - desc="Pods that cannot be scheduled — usually an unschedulable taint or an exhausted resource request.", - thresholds=[{"color": "green", "value": None}, {"color": "red", "value": 1}]), - stat("Internal gateway probes OK", [target('sum(probe_success{job="internal-gateway"})')], - {"h": 5, "w": 4, "x": 12, "y": 1}, - desc="blackbox-exporter probes of http://10.10.0.2:8081/ and :8084/ (monitoring/controllers/home/gateway-probe.yaml). 2 = both internal services answering.", - thresholds=[{"color": "red", "value": None}, {"color": "yellow", "value": 1}, {"color": "green", "value": 2}]), - stat("PVCs bound", [target('sum(kube_persistentvolumeclaim_status_phase{phase="Bound"} == 1) or vector(0)')], - {"h": 5, "w": 4, "x": 16, "y": 1}), - stat("PVC capacity requested", [target('sum(kube_persistentvolumeclaim_resource_requests_storage_bytes)')], - {"h": 5, "w": 4, "x": 20, "y": 1}, unit="bytes", - desc="Sum of every PVC request (local-path: all on siriussec's disk). Usage per PV is not available — see the note at the bottom."), - - row("Requests vs usage", 6), - ts("CPU usage by namespace", [target('sum by (namespace) (rate(container_cpu_usage_seconds_total{container!=""}[5m]))', "{{namespace}}")], - {"h": 8, "w": 12, "x": 0, "y": 7}, unit="cores", - desc="cAdvisor, all containers including pause-less init containers. Compare with the requests panel next to it."), - ts("CPU requests by namespace", [target('sum by (namespace) (kube_pod_container_resource_requests{resource="cpu"})', "{{namespace}}")], - {"h": 8, "w": 12, "x": 12, "y": 7}, unit="cores", - desc="Scheduler-visible requests — this is what makes a pod Pending, not usage."), - ts("Memory usage by namespace", [target('sum by (namespace) (container_memory_working_set_bytes{container!=""})', "{{namespace}}")], - {"h": 8, "w": 12, "x": 0, "y": 15}, unit="bytes"), - ts("Memory requests by namespace", [target('sum by (namespace) (kube_pod_container_resource_requests{resource="memory"})', "{{namespace}}")], - {"h": 8, "w": 12, "x": 12, "y": 15}, unit="bytes"), - - row("Top pods", 23), - ts("Top 10 pods by CPU", [target('topk(10, sum by (namespace, pod) (rate(container_cpu_usage_seconds_total{container!=""}[5m])))', "{{namespace}}/{{pod}}")], - {"h": 8, "w": 12, "x": 0, "y": 24}, unit="cores"), - ts("Top 10 pods by memory", [target('topk(10, sum by (namespace, pod) (container_memory_working_set_bytes{container!=""}))', "{{namespace}}/{{pod}}")], - {"h": 8, "w": 12, "x": 12, "y": 24}, unit="bytes"), - ts("Pod restarts (24h, top 10)", [target('topk(10, sum by (namespace, pod) (increase(kube_pod_container_status_restarts_total[24h])))', "{{namespace}}/{{pod}}")], - {"h": 8, "w": 12, "x": 0, "y": 32}, unit="short", - desc="increase() over 24h. Values below 1 are container restarts that happened before the current scrape window started."), - ts("Internal gateway probe result", [target('probe_success{job="internal-gateway"}', "{{instance}}")], - {"h": 8, "w": 12, "x": 12, "y": 32}, unit="short", - desc="1 = HTTP 2xx/3xx from blackbox-exporter every 30s. There is no Alertmanager in this stack, so this panel and Prometheus /alerts are the alerting surface."), - - row("Nodes", 40), - ts("Node CPU utilisation", [target('100 * (1 - avg by (instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])))', "{{instance}}")], - {"h": 8, "w": 8, "x": 0, "y": 41}, unit="percent"), - ts("Node memory used", [target('100 * (1 - node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)', "{{instance}}")], - {"h": 8, "w": 8, "x": 8, "y": 41}, unit="percent"), - ts("Filesystem used %", - [target('100 * (1 - node_filesystem_avail_bytes{mountpoint="/",fstype!~"tmpfs|overlay"} / node_filesystem_size_bytes{mountpoint="/",fstype!~"tmpfs|overlay"})', "{{instance}} /")], - {"h": 8, "w": 8, "x": 16, "y": 41}, unit="percent", - desc="Root filesystem per node — the local-path PVs, the dind data-root and the Pi's host-docker job containers all land on these."), - - note("Known unknowns on this board", """\ -- **PVC usage is not charted, only requested capacity.** kubelet 1.34+ dropped the alpha - `kubelet_volume_stats_*` metrics (its `/metrics/volumes` endpoint 404s on every node here), so - there is nothing to chart per PV. Node filesystem usage is the honest proxy for "how full is - the disk these PVs live on". -- **Namespaces are not filtered.** With this few workloads an unfiltered board is more useful than a - variable that hides the one namespace you needed to see. -- **No Alertmanager.** Alerts from `PrometheusRule` objects are visible in Prometheus /alerts and in - Grafana → Alerting, but nothing pages. -""", {"h": 8, "w": 24, "x": 0, "y": 49}), -] - -DOCS = { - "forgejo-runners": ("Forgejo Runners", - ["homelab", "forgejo", "runners"], - "Runners, CI queue depth and job outcomes, plus the disk that CI actually fills.", - "Runner health as the cluster sees it (kube-state-metrics/cAdvisor) and as Forgejo " - "sees it (action_runner.last_online, action_run_job), plus the filesystem that the " - "dind data-root and the Pi's host-docker jobs consume."), - "cnpg-postgres": ("CNPG Postgres", - ["homelab", "postgres", "cnpg"], - "Both CloudNativePG clusters: connections, throughput, errors, size, WAL, replication.", - "Metrics come from CNPG's instance-manager exporter on :9187, scraped by the " - "per-cluster PodMonitors in apps/base/*/podmonitor.yaml."), - "home-lab-workloads": ("Home lab workloads", - ["homelab", "overview"], - "Per-namespace requests vs usage, top pods, node health and internal-service availability.", - "Cluster-wide view: who is using CPU/memory, what is Pending or restarting, how full " - "the nodes' disks are, and whether the WireGuard-only internal services answer."), -} - -PANELS = {"forgejo-runners": runners, "cnpg-postgres": cnpg, "home-lab-workloads": workloads} - -os.makedirs(OUT_DIR, exist_ok=True) -for uid, panels in PANELS.items(): - _next_id[0] = 0 - title, tags, desc, long_desc = DOCS[uid] - d = dashboard(uid, title, tags, panels, long_desc, - variables=[ns_variable()] if uid == "cnpg-postgres" else None) - doc = { - "apiVersion": "v1", - "kind": "ConfigMap", - "metadata": { - "name": "grafana-dashboard-" + uid, - "namespace": "monitoring", - "labels": {"grafana_dashboard": "1", "app.kubernetes.io/part-of": "homelab-dashboards"}, - # No grafana_folder annotation: the sidecar's API-backed import cannot - # authenticate (Grafana's live admin password is the out-of-band one, - # not monitoring/grafana-admin — that Secret is only the first-boot - # seed), so the dashboards are imported by Grafana's *file* provider, - # which ignores per-dashboard folder annotations and puts every board - # in General next to the chart's own 28. Verified in grafana.db. - "annotations": {"homelab.siriusdevops.com/managed-by": "monitoring/controllers/home/dashboards/build.py"}, - }, - "data": {uid + ".json": json.dumps(d, indent=2) + "\n"}, - } - path = os.path.join(OUT_DIR, uid + ".yaml") - with open(path, "w") as f: - f.write("# GENERATED by monitoring/controllers/home/dashboards/build.py — edit the script, not this file.\n") - f.write("# Provisioned by the kube-prometheus-stack dashboard sidecar (label grafana_dashboard=1,\n") - f.write("# NAMESPACE=ALL), so it wins over any UI edit. Dashboard uid: %s\n" % uid) - # hand-rolled YAML emitter: keeps the JSON block literal and diffable - f.write("apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: %s\n namespace: monitoring\n" % doc["metadata"]["name"]) - f.write(" labels:\n grafana_dashboard: \"1\"\n app.kubernetes.io/part-of: homelab-dashboards\n") - f.write(" annotations:\n homelab.siriusdevops.com/managed-by: monitoring/controllers/home/dashboards/build.py\n") - f.write("data:\n %s.json: |\n" % uid) - for line in doc["data"][uid + ".json"].rstrip("\n").split("\n"): - f.write(" " + line + "\n") - print("wrote", path) diff --git a/monitoring/controllers/home/dashboards/cnpg-postgres.yaml b/monitoring/controllers/home/dashboards/cnpg-postgres.yaml deleted file mode 100644 index 5b11a55..0000000 --- a/monitoring/controllers/home/dashboards/cnpg-postgres.yaml +++ /dev/null @@ -1,1210 +0,0 @@ -# GENERATED by monitoring/controllers/home/dashboards/build.py — edit the script, not this file. -# Provisioned by the kube-prometheus-stack dashboard sidecar (label grafana_dashboard=1, -# NAMESPACE=ALL), so it wins over any UI edit. Dashboard uid: cnpg-postgres -apiVersion: v1 -kind: ConfigMap -metadata: - name: grafana-dashboard-cnpg-postgres - namespace: monitoring - labels: - grafana_dashboard: "1" - app.kubernetes.io/part-of: homelab-dashboards - annotations: - homelab.siriusdevops.com/managed-by: monitoring/controllers/home/dashboards/build.py -data: - cnpg-postgres.json: | - { - "uid": "cnpg-postgres", - "title": "CNPG Postgres", - "description": "Metrics come from CNPG's instance-manager exporter on :9187, scraped by the per-cluster PodMonitors in apps/base/*/podmonitor.yaml.", - "tags": [ - "homelab", - "postgres", - "cnpg" - ], - "timezone": "browser", - "editable": true, - "graphTooltip": 1, - "schemaVersion": 39, - "version": 1, - "refresh": "30s", - "time": { - "from": "now-6h", - "to": "now" - }, - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "grafana", - "uid": "-- Grafana --" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "links": [], - "templating": { - "list": [ - { - "name": "namespace", - "label": "Postgres cluster (namespace)", - "type": "query", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "refresh": 1, - "includeAll": true, - "multi": true, - "allValue": ".*", - "current": { - "selected": true, - "text": [ - "All" - ], - "value": [ - "$__all" - ] - }, - "options": [], - "query": { - "query": "label_values(cnpg_collector_up, namespace)", - "refId": "PromQLNamespace" - } - } - ] - }, - "panels": [ - { - "id": 23, - "type": "row", - "title": "Cluster health", - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 0 - }, - "panels": [] - }, - { - "id": 24, - "type": "stat", - "title": "Instances up", - "description": "cnpg_collector_up from the instance manager (:9187) \u2014 1 = PostgreSQL answering.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 0, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "min by (namespace) (cnpg_collector_up{namespace=~\"$namespace\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "green", - "value": 1 - } - ] - } - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 25, - "type": "stat", - "title": "Nodes used / instances", - "description": "1 with instances: 1 \u2014 no HA. Documented as a known limit, not a fault.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 4, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max by (namespace) (cnpg_collector_nodes_used{namespace=~\"$namespace\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "green", - "value": 1 - } - ] - } - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 26, - "type": "stat", - "title": "Connections used", - "description": "pg_stat_activity backends, all states.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 8, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (namespace) (cnpg_backends_total{namespace=~\"$namespace\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "green", - "value": 1 - } - ] - } - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 27, - "type": "stat", - "title": "Connections / max_connections", - "description": "Used against the server's own max_connections setting, so it stays right if the setting changes.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 12, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "100 * sum by (namespace) (cnpg_backends_total{namespace=~\"$namespace\"}) / max by (namespace) (cnpg_pg_settings_setting{namespace=~\"$namespace\",name=\"max_connections\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "yellow", - "value": 70 - }, - { - "color": "red", - "value": 90 - } - ] - }, - "unit": "percent" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 28, - "type": "stat", - "title": "Manual switchover required", - "description": "1 = the operator is asking for a manual switchover (e.g. after a fencing event).", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 16, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max by (namespace) (cnpg_collector_manual_switchover_required{namespace=~\"$namespace\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - } - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 29, - "type": "stat", - "title": "Last available backup", - "description": "0 = never. sirius-growth/portal archives through the CNPG-I Barman Cloud plugin, whose metric is `barman_cloud_cloudnative_pg_io_last_available_backup_timestamp`; the deprecated `cnpg_collector_*` name is the fallback for any cluster still on the in-tree path. Order matters: the legacy series is still scraped for portal and holds the PRE-migration timestamp, so it must not win the `or`.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 20, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max by (namespace) (barman_cloud_cloudnative_pg_io_last_available_backup_timestamp{namespace=~\"$namespace\"} or cnpg_collector_last_available_backup_timestamp{namespace=~\"$namespace\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "green", - "value": 1 - } - ] - }, - "unit": "dateTimeAsIso" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 30, - "type": "row", - "title": "Throughput", - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 6 - }, - "panels": [] - }, - { - "id": 31, - "type": "timeseries", - "title": "Transactions/s \u2014 commit vs rollback", - "description": "From pg_stat_database, which Forgejo's connection pool drives directly.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 7 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (namespace) (rate(cnpg_pg_stat_database_xact_commit{namespace=~\"$namespace\"}[5m]))", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}} commit" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (namespace) (rate(cnpg_pg_stat_database_xact_rollback{namespace=~\"$namespace\"}[5m]))", - "refId": "B", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}} rollback" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "ops" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 32, - "type": "timeseries", - "title": "Commit share", - "description": "Commit / (commit + rollback). clamp_min keeps a quiet database from rendering NaN.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 6, - "x": 12, - "y": 7 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum(rate(cnpg_pg_stat_database_xact_commit{namespace=~\"$namespace\"}[5m])) / clamp_min(sum(rate(cnpg_pg_stat_database_xact_commit{namespace=~\"$namespace\"}[5m])) + sum(rate(cnpg_pg_stat_database_xact_rollback{namespace=~\"$namespace\"}[5m])), 0.0000001)", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 33, - "type": "timeseries", - "title": "Cache hit ratio", - "description": "shared_buffers hit ratio. A lab database with 256Mi request will sit high; a drop means the working set outgrew the buffers.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 6, - "x": 18, - "y": 7 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (namespace) (rate(cnpg_pg_stat_database_blks_hit{namespace=~\"$namespace\"}[5m])) / clamp_min(sum by (namespace) (rate(cnpg_pg_stat_database_blks_hit{namespace=~\"$namespace\"}[5m])) + sum by (namespace) (rate(cnpg_pg_stat_database_blks_read{namespace=~\"$namespace\"}[5m])), 0.0000001)", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 34, - "type": "row", - "title": "Errors and pressure", - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 15 - }, - "panels": [] - }, - { - "id": 35, - "type": "timeseries", - "title": "Deadlocks (24h increase)", - "description": "increase() on a counter that exists on every database, so a quiet DB renders a hard 0 rather than 'No data'.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 0, - "y": 16 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (namespace) (increase(cnpg_pg_stat_database_deadlocks{namespace=~\"$namespace\"}[24h]))", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 36, - "type": "timeseries", - "title": "Temp bytes/s", - "description": "Spill to disk from sorts/hashes that did not fit work_mem. Non-zero during Forgejo Actions index scans is expected.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 8, - "y": 16 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (namespace) (rate(cnpg_pg_stat_database_temp_bytes{namespace=~\"$namespace\"}[5m]))", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "Bps" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 37, - "type": "timeseries", - "title": "Longest transaction age", - "description": "Longest open transaction (pg_stat_activity.xact_start). The CNPG default query set exposes transaction age, not per-statement query age \u2014 see docs.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 16, - "y": 16 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max by (namespace) (cnpg_backends_max_tx_duration_seconds{namespace=~\"$namespace\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "s" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 38, - "type": "row", - "title": "Size, WAL, replication", - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 24 - }, - "panels": [] - }, - { - "id": 39, - "type": "timeseries", - "title": "Database size", - "description": "pg_database_size. Both PVs are 10Gi (forgejo/pg) and 5Gi (sirius-growth/portal) \u2014 this is the trend that fills them.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 0, - "y": 25 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max by (namespace, datname) (cnpg_pg_database_size_bytes{namespace=~\"$namespace\",datname!~\"template.*|postgres\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}/{{datname}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "bytes" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 40, - "type": "timeseries", - "title": "WAL generation", - "description": "Bytes of WAL written per second. sirius-growth/portal archives its WAL to the Linode Garage; forgejo/pg does not archive, so its WAL only ever fills the pg_wal directory.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 8, - "y": 25 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (namespace) (rate(cnpg_collector_wal_bytes{namespace=~\"$namespace\"}[5m]))", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "Bps" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 41, - "type": "timeseries", - "title": "WAL archiver failures", - "description": "pg_stat_archiver.failed_count. Archiving is configured only on sirius-growth/portal (Barman Cloud plugin -> Linode Garage); forgejo/pg has no archiver, so any non-zero value is the honest signal that WAL failed to reach the archive.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 16, - "y": 25 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max by (namespace) (cnpg_pg_stat_archiver_failed_count{namespace=~\"$namespace\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 42, - "type": "row", - "title": "Replication (single instance \u2014 panels are honest about it)", - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 33 - }, - "panels": [] - }, - { - "id": 43, - "type": "timeseries", - "title": "Replication lag", - "description": "0 on the primary with no standby. With instances: 1 this metric is structurally zero, not evidence that replication is healthy.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 6, - "w": 8, - "x": 0, - "y": 34 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max by (namespace) (cnpg_pg_replication_lag{namespace=~\"$namespace\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "s" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 44, - "type": "timeseries", - "title": "Streaming replicas / in recovery", - "description": "Both clusters run instances: 1, so 0 streaming replicas and in_recovery=0 is the correct reading. A future replica would light these up with no dashboard change.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 6, - "w": 8, - "x": 8, - "y": 34 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max by (namespace) (cnpg_pg_replication_streaming_replicas{namespace=~\"$namespace\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}} streaming" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max by (namespace) (cnpg_pg_replication_in_recovery{namespace=~\"$namespace\"})", - "refId": "B", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}} in recovery" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 45, - "type": "text", - "title": "Known unknowns on the CNPG board", - "gridPos": { - "h": 8, - "w": 24, - "x": 0, - "y": 40 - }, - "options": { - "mode": "markdown", - "code": { - "language": "plaintext", - "showLineNumbers": false, - "showMiniMap": false - }, - "content": "- **Backups exist on one cluster only.** `sirius-growth/portal` archives WAL + daily base backups\n through the CNPG-I Barman Cloud plugin (`ObjectStore portal-wal`) into the Linode Garage;\n `forgejo/pg` has no archiver by design. The \"Last available backup\" stat reads 0 only if neither\n the plugin's `barman_cloud_cloudnative_pg_io_last_available_backup_timestamp` nor the legacy\n `cnpg_collector_last_available_backup_timestamp` series exists.\n- **Single instance.** Both clusters run `instances: 1`, so replication lag / streaming replicas /\n in recovery are structurally zero. The panels show the zero and say so instead of hiding them.\n- **Query age vs transaction age.** CNPG's default query set exposes\n `cnpg_backends_max_tx_duration_seconds` (transaction age). Per-statement `query_start` age is not in\n the default set; adding it would need another custom query in the cluster's\n `customQueriesConfigMap`.\n- **Permissions.** Custom queries run as `cnpg_metrics_exporter`, not superuser. See\n docs/monitoring-dashboards.md for the GRANT the Forgejo Actions metrics need.\n" - } - } - ] - } diff --git a/monitoring/controllers/home/dashboards/forgejo-runners.yaml b/monitoring/controllers/home/dashboards/forgejo-runners.yaml deleted file mode 100644 index b28732d..0000000 --- a/monitoring/controllers/home/dashboards/forgejo-runners.yaml +++ /dev/null @@ -1,1208 +0,0 @@ -# GENERATED by monitoring/controllers/home/dashboards/build.py — edit the script, not this file. -# Provisioned by the kube-prometheus-stack dashboard sidecar (label grafana_dashboard=1, -# NAMESPACE=ALL), so it wins over any UI edit. Dashboard uid: forgejo-runners -apiVersion: v1 -kind: ConfigMap -metadata: - name: grafana-dashboard-forgejo-runners - namespace: monitoring - labels: - grafana_dashboard: "1" - app.kubernetes.io/part-of: homelab-dashboards - annotations: - homelab.siriusdevops.com/managed-by: monitoring/controllers/home/dashboards/build.py -data: - forgejo-runners.json: | - { - "uid": "forgejo-runners", - "title": "Forgejo Runners", - "description": "Runner health as the cluster sees it (kube-state-metrics/cAdvisor) and as Forgejo sees it (action_runner.last_online, action_run_job), plus the filesystem that the dind data-root and the Pi's host-docker jobs consume.", - "tags": [ - "homelab", - "forgejo", - "runners" - ], - "timezone": "browser", - "editable": true, - "graphTooltip": 1, - "schemaVersion": 39, - "version": 1, - "refresh": "30s", - "time": { - "from": "now-6h", - "to": "now" - }, - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "grafana", - "uid": "-- Grafana --" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "links": [], - "templating": { - "list": [] - }, - "panels": [ - { - "id": 1, - "type": "row", - "title": "Runners & queue", - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 0 - }, - "panels": [] - }, - { - "id": 2, - "type": "stat", - "title": "Runner pods Ready", - "description": "replicas_ready summed across the three runner Deployments. Expected 3.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 0, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum(kube_deployment_status_replicas_ready{namespace=\"forgejo\",deployment=~\"forgejo-runner-.*\"}) or vector(0)", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "yellow", - "value": 2 - }, - { - "color": "green", - "value": 3 - } - ] - } - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 3, - "type": "stat", - "title": "Runner pods not Ready", - "description": "Running-but-not-Ready runner pods (crashloop, failing probe).", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 4, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum(kube_pod_status_ready{namespace=\"forgejo\",pod=~\"forgejo-runner-(amd64|arm64|deploy-arm64)-.*\",condition=\"false\"} == 1) or vector(0)", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - } - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 4, - "type": "stat", - "title": "Last runner poll age", - "description": "Worst of the three runners, from Forgejo's action_runner.last_online. A Running pod whose poll age climbs is a runner that cannot reach the forge.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 8, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max(cnpg_actions_runners_last_online_seconds{namespace=\"forgejo\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "yellow", - "value": 90 - }, - { - "color": "red", - "value": 300 - } - ] - }, - "unit": "s" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 5, - "type": "stat", - "title": "Queue depth", - "description": "Jobs assigned to a runner that have not started (action_run_job: started=0, stopped=0, status<>4).", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 12, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max(cnpg_actions_queue_depth{namespace=\"forgejo\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "yellow", - "value": 1 - }, - { - "color": "red", - "value": 3 - } - ] - } - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 6, - "type": "stat", - "title": "Running now", - "description": "Jobs currently executing. capacity=1 per runner, so >3 here means something is stuck.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 16, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max(cnpg_actions_running_total{namespace=\"forgejo\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "green", - "value": 1 - } - ] - } - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 7, - "type": "stat", - "title": "Queue while running = contention", - "description": "1 = jobs are queued while another job runs, i.e. the single-slot runners are the bottleneck (this is why capacity stays 1: two concurrent jobs clobbered the shared docker volumes).", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 20, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max((cnpg_actions_queue_depth{namespace=\"forgejo\"} > bool 0) * (cnpg_actions_running_total{namespace=\"forgejo\"} > bool 0))", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "orange", - "value": 1 - } - ] - } - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 8, - "type": "row", - "title": "Action throughput & outcomes", - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 6 - }, - "panels": [] - }, - { - "id": 9, - "type": "timeseries", - "title": "Jobs finished, by status (24h window)", - "description": "Rolling 24h count of action_run_job rows with stopped in the window. status 1=success 2=failure 3=cancelled 4=skipped (codes validated against /api/v1 .../actions/runs).", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 0, - "y": 7 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "cnpg_actions_jobs_window_total{namespace=\"forgejo\",window=\"24h\"}", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "status {{status}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 10, - "type": "timeseries", - "title": "Successes / hour and failures / hour", - "description": "Jobs that finished inside the last rolling hour. A true rolling count, not rate() over a row count \u2014 Forgejo prunes rows, so rate() would drift.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 8, - "y": 7 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max(cnpg_actions_jobs_window_total{namespace=\"forgejo\",window=\"1h\",status=\"1\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "success, last 60m" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max(cnpg_actions_jobs_window_total{namespace=\"forgejo\",window=\"1h\",status=\"2\"})", - "refId": "B", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "failure, last 60m" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 11, - "type": "timeseries", - "title": "Oldest not-yet-started job age", - "description": "How long the oldest queued job has been waiting. Flat 0 = nothing queued.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 16, - "y": 7 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "cnpg_actions_queue_oldest_pending_seconds{namespace=\"forgejo\"}", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "s" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 12, - "type": "row", - "title": "Runner pods", - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 15 - }, - "panels": [] - }, - { - "id": 13, - "type": "timeseries", - "title": "Runner pod restarts (24h)", - "description": "increase() over 24h from kube-state-metrics. The history behind this board: the amd64 runner crashlooped on dind socket permissions.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 0, - "y": 16 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (pod, container) (increase(kube_pod_container_status_restarts_total{namespace=\"forgejo\",pod=~\"forgejo-runner-(amd64|arm64|deploy-arm64)-.*\"}[24h]))", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{pod}} / {{container}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 14, - "type": "timeseries", - "title": "CPU usage per runner pod", - "description": "cAdvisor CPU per runner pod. The dind sidecar of forgejo-runner-amd64 does the actual build work.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 8, - "y": 16 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (pod) (rate(container_cpu_usage_seconds_total{namespace=\"forgejo\",pod=~\"forgejo-runner-(amd64|arm64|deploy-arm64)-.*\",container!=\"\"}[5m]))", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{pod}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "cores" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 15, - "type": "timeseries", - "title": "Memory working set per runner pod", - "description": "cAdvisor working set. Note the amd64 runner's dind keeps a 1Gi memory limit \u2014 a build that OOMs shows here first.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 16, - "y": 16 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (pod) (container_memory_working_set_bytes{namespace=\"forgejo\",pod=~\"forgejo-runner-(amd64|arm64|deploy-arm64)-.*\",container!=\"\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{pod}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "bytes" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 16, - "type": "row", - "title": "Disk \u2014 the one that actually bites", - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 24 - }, - "panels": [] - }, - { - "id": 17, - "type": "timeseries", - "title": "Runner pod network I/O", - "description": "Image pulls and artifact traffic through the pod interface.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 0, - "y": 25 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (pod) (rate(container_network_receive_bytes_total{namespace=\"forgejo\",pod=~\"forgejo-runner-(amd64|arm64|deploy-arm64)-.*\"}[5m]))", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{pod}} in" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (pod) (rate(container_network_transmit_bytes_total{namespace=\"forgejo\",pod=~\"forgejo-runner-(amd64|arm64|deploy-arm64)-.*\"}[5m]))", - "refId": "B", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{pod}} out" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "Bps" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 18, - "type": "stat", - "title": "dind PVC nominal size", - "description": "Requested size of the forgejo-runner-amd64 PVC (docker data-root + named CI volumes). This is the ceiling, not the usage \u2014 see the note on this row.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 4, - "x": 8, - "y": 25 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "max(kube_persistentvolumeclaim_resource_requests_storage_bytes{namespace=\"forgejo\",persistentvolumeclaim=\"forgejo-runner-amd64\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "green", - "value": 1 - } - ] - }, - "unit": "bytes" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 19, - "type": "stat", - "title": "siriussec root fs used", - "description": "The dind data-root lives on /opt/local-path-provisioner inside this filesystem, so this IS the number that caused the DiskPressure evictions at ~86%.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 4, - "x": 12, - "y": 25 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "100 * (1 - node_filesystem_avail_bytes{instance=\"10.10.0.2:9100\",mountpoint=\"/\"} / node_filesystem_size_bytes{instance=\"10.10.0.2:9100\",mountpoint=\"/\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "yellow", - "value": 75 - }, - { - "color": "red", - "value": 85 - } - ] - }, - "unit": "percent" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 20, - "type": "stat", - "title": "siriussec days to full", - "description": "Linear projection from the last hour of free-space trend; 365 = not shrinking. Only meaningful after a few hours of history.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 4, - "x": 16, - "y": 25 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "clamp_max(node_filesystem_avail_bytes{instance=\"10.10.0.2:9100\",mountpoint=\"/\"} / clamp_min(-deriv(node_filesystem_avail_bytes{instance=\"10.10.0.2:9100\",mountpoint=\"/\"}[1h]), 0.0000001) / 86400, 365)", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "yellow", - "value": 30 - }, - { - "color": "green", - "value": 90 - } - ] - }, - "unit": "d", - "decimals": 1 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 21, - "type": "timeseries", - "title": "rpi root fs used %", - "description": "The arm64 runners run their jobs as HOST docker containers on rpi, so their writes land here, not in any PVC. node-exporter on rpi is what makes this visible.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 4, - "x": 20, - "y": 25 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "100 * (1 - node_filesystem_avail_bytes{instance=\"10.10.0.1:9100\",mountpoint=\"/\"} / node_filesystem_size_bytes{instance=\"10.10.0.1:9100\",mountpoint=\"/\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "percent" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 22, - "type": "text", - "title": "What this board can and cannot see", - "gridPos": { - "h": 7, - "w": 24, - "x": 0, - "y": 33 - }, - "options": { - "mode": "markdown", - "code": { - "language": "plaintext", - "showLineNumbers": false, - "showMiniMap": false - }, - "content": "**Measured:** runner Deployments (kube-state-metrics), runner pods CPU/mem/net/restarts (cAdvisor),\nrunner liveness as *Forgejo* sees it (`action_runner.last_online`), queue depth and job outcomes\n(`action_run_job` via the CNPG exporter), and the host filesystems that CI fills (node-exporter).\n\n**Not measurable \u2014 by design, not by omission:**\n\n- **Per-job breakdown on the arm64 runner.** `forgejo-runner-arm64` and\n `forgejo-runner-deploy-arm64` drive the **host** Docker socket (gid 984), so their jobs are\n plain host containers with no pod identity. cAdvisor/kube-state-metrics see only the runner\n pod itself. There is no per-job CPU/mem/disk on rpi and there cannot be one without changing\n the runner to dind \u2014 which this board deliberately does not propose.\n- **Per-PV bytes for the dind PVC.** kubelet 1.34+ no longer exports the alpha\n `kubelet_volume_stats_*` set at all: its `/metrics/volumes` endpoint returns 404 on every node\n here (kubelet v1.36.4; upstream kubernetes/kubernetes#133847), so no scrape config can produce\n those series and it is not a hostPath quirk. The usable proxy is the runner node's root\n filesystem usage plus the PVC's requested size, both on this row \u2014 and the `RunnerDindDisk*`\n alerts watch that same filesystem, scoped to nodes that run a runner.\n" - } - } - ] - } diff --git a/monitoring/controllers/home/dashboards/home-lab-workloads.yaml b/monitoring/controllers/home/dashboards/home-lab-workloads.yaml deleted file mode 100644 index 17b47d8..0000000 --- a/monitoring/controllers/home/dashboards/home-lab-workloads.yaml +++ /dev/null @@ -1,1148 +0,0 @@ -# GENERATED by monitoring/controllers/home/dashboards/build.py — edit the script, not this file. -# Provisioned by the kube-prometheus-stack dashboard sidecar (label grafana_dashboard=1, -# NAMESPACE=ALL), so it wins over any UI edit. Dashboard uid: home-lab-workloads -apiVersion: v1 -kind: ConfigMap -metadata: - name: grafana-dashboard-home-lab-workloads - namespace: monitoring - labels: - grafana_dashboard: "1" - app.kubernetes.io/part-of: homelab-dashboards - annotations: - homelab.siriusdevops.com/managed-by: monitoring/controllers/home/dashboards/build.py -data: - home-lab-workloads.json: | - { - "uid": "home-lab-workloads", - "title": "Home lab workloads", - "description": "Cluster-wide view: who is using CPU/memory, what is Pending or restarting, how full the nodes' disks are, and whether the WireGuard-only internal services answer.", - "tags": [ - "homelab", - "overview" - ], - "timezone": "browser", - "editable": true, - "graphTooltip": 1, - "schemaVersion": 39, - "version": 1, - "refresh": "30s", - "time": { - "from": "now-6h", - "to": "now" - }, - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "grafana", - "uid": "-- Grafana --" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "links": [], - "templating": { - "list": [] - }, - "panels": [ - { - "id": 46, - "type": "row", - "title": "Cluster", - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 0 - }, - "panels": [] - }, - { - "id": 47, - "type": "stat", - "title": "Nodes Ready", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 0, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "count(kube_node_status_condition{condition=\"Ready\",status=\"true\"} == 1) or vector(0)", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "yellow", - "value": 2 - }, - { - "color": "green", - "value": 3 - } - ] - } - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 48, - "type": "stat", - "title": "Nodes with DiskPressure", - "description": "The taint that evicted Forgejo and pg-1 in the past. >0 here is an incident, not a warning.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 4, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum(kube_node_status_condition{condition=\"DiskPressure\",status=\"true\"} == 1) or vector(0)", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - } - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 49, - "type": "stat", - "title": "Pending pods", - "description": "Pods that cannot be scheduled \u2014 usually an unschedulable taint or an exhausted resource request.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 8, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum(kube_pod_status_phase{phase=\"Pending\"} == 1) or vector(0)", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - } - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 50, - "type": "stat", - "title": "Internal gateway probes OK", - "description": "blackbox-exporter probes of http://10.10.0.2:8081/ and :8084/ (monitoring/controllers/home/gateway-probe.yaml). 2 = both internal services answering.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 12, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum(probe_success{job=\"internal-gateway\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "yellow", - "value": 1 - }, - { - "color": "green", - "value": 2 - } - ] - } - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 51, - "type": "stat", - "title": "PVCs bound", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 16, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum(kube_persistentvolumeclaim_status_phase{phase=\"Bound\"} == 1) or vector(0)", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "green", - "value": 1 - } - ] - } - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 52, - "type": "stat", - "title": "PVC capacity requested", - "description": "Sum of every PVC request (local-path: all on siriussec's disk). Usage per PV is not available \u2014 see the note at the bottom.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 5, - "w": 4, - "x": 20, - "y": 1 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum(kube_persistentvolumeclaim_resource_requests_storage_bytes)", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false - } - ], - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "green", - "value": 1 - } - ] - }, - "unit": "bytes" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "justifyMode": "auto" - } - }, - { - "id": 53, - "type": "row", - "title": "Requests vs usage", - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 6 - }, - "panels": [] - }, - { - "id": 54, - "type": "timeseries", - "title": "CPU usage by namespace", - "description": "cAdvisor, all containers including pause-less init containers. Compare with the requests panel next to it.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 7 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (namespace) (rate(container_cpu_usage_seconds_total{container!=\"\"}[5m]))", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "cores" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 55, - "type": "timeseries", - "title": "CPU requests by namespace", - "description": "Scheduler-visible requests \u2014 this is what makes a pod Pending, not usage.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 7 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (namespace) (kube_pod_container_resource_requests{resource=\"cpu\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "cores" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 56, - "type": "timeseries", - "title": "Memory usage by namespace", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 15 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (namespace) (container_memory_working_set_bytes{container!=\"\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "bytes" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 57, - "type": "timeseries", - "title": "Memory requests by namespace", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 15 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum by (namespace) (kube_pod_container_resource_requests{resource=\"memory\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "bytes" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 58, - "type": "row", - "title": "Top pods", - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 23 - }, - "panels": [] - }, - { - "id": 59, - "type": "timeseries", - "title": "Top 10 pods by CPU", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 24 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "topk(10, sum by (namespace, pod) (rate(container_cpu_usage_seconds_total{container!=\"\"}[5m])))", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}/{{pod}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "cores" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 60, - "type": "timeseries", - "title": "Top 10 pods by memory", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 24 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "topk(10, sum by (namespace, pod) (container_memory_working_set_bytes{container!=\"\"}))", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}/{{pod}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "bytes" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 61, - "type": "timeseries", - "title": "Pod restarts (24h, top 10)", - "description": "increase() over 24h. Values below 1 are container restarts that happened before the current scrape window started.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 32 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "topk(10, sum by (namespace, pod) (increase(kube_pod_container_status_restarts_total[24h])))", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{namespace}}/{{pod}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 62, - "type": "timeseries", - "title": "Internal gateway probe result", - "description": "1 = HTTP 2xx/3xx from blackbox-exporter every 30s. There is no Alertmanager in this stack, so this panel and Prometheus /alerts are the alerting surface.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 32 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "probe_success{job=\"internal-gateway\"}", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{instance}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 63, - "type": "row", - "title": "Nodes", - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 40 - }, - "panels": [] - }, - { - "id": 64, - "type": "timeseries", - "title": "Node CPU utilisation", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 0, - "y": 41 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "100 * (1 - avg by (instance) (rate(node_cpu_seconds_total{mode=\"idle\"}[5m])))", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{instance}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "percent" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 65, - "type": "timeseries", - "title": "Node memory used", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 8, - "y": 41 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "100 * (1 - node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{instance}}" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "percent" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 66, - "type": "timeseries", - "title": "Filesystem used %", - "description": "Root filesystem per node \u2014 the local-path PVs, the dind data-root and the Pi's host-docker job containers all land on these.", - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 16, - "y": 41 - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "100 * (1 - node_filesystem_avail_bytes{mountpoint=\"/\",fstype!~\"tmpfs|overlay\"} / node_filesystem_size_bytes{mountpoint=\"/\",fstype!~\"tmpfs|overlay\"})", - "refId": "A", - "editorMode": "code", - "range": true, - "instant": false, - "legendFormat": "{{instance}} /" - } - ], - "fieldConfig": { - "defaults": { - "custom": { - "lineWidth": 1, - "fillOpacity": 0, - "showPoints": "never" - }, - "color": { - "mode": "palette-classic" - }, - "unit": "percent" - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "calcs": [ - "lastNotNull" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - } - }, - { - "id": 67, - "type": "text", - "title": "Known unknowns on this board", - "gridPos": { - "h": 8, - "w": 24, - "x": 0, - "y": 49 - }, - "options": { - "mode": "markdown", - "code": { - "language": "plaintext", - "showLineNumbers": false, - "showMiniMap": false - }, - "content": "- **PVC usage is not charted, only requested capacity.** kubelet 1.34+ dropped the alpha\n `kubelet_volume_stats_*` metrics (its `/metrics/volumes` endpoint 404s on every node here), so\n there is nothing to chart per PV. Node filesystem usage is the honest proxy for \"how full is\n the disk these PVs live on\".\n- **Namespaces are not filtered.** With this few workloads an unfiltered board is more useful than a\n variable that hides the one namespace you needed to see.\n- **No Alertmanager.** Alerts from `PrometheusRule` objects are visible in Prometheus /alerts and in\n Grafana \u2192 Alerting, but nothing pages.\n" - } - } - ] - } diff --git a/monitoring/controllers/home/dashboards/kustomization.yaml b/monitoring/controllers/home/dashboards/kustomization.yaml deleted file mode 100644 index 7cfdc10..0000000 --- a/monitoring/controllers/home/dashboards/kustomization.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -# Custom dashboards, loaded by the kube-prometheus-stack grafana sidecar -# (label grafana_dashboard=1, NAMESPACE=ALL, folder annotation grafana_folder). -# Regenerate the YAML from build.py after editing a panel; the JSON inside each -# ConfigMap is the deliverable, the .yaml is generated. -resources: - - forgejo-runners.yaml - - cnpg-postgres.yaml - - home-lab-workloads.yaml diff --git a/monitoring/controllers/home/dashboards/validate_panels.py b/monitoring/controllers/home/dashboards/validate_panels.py deleted file mode 100755 index b9ca788..0000000 --- a/monitoring/controllers/home/dashboards/validate_panels.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env python3 -"""Verify every panel on the three custom dashboards returns real data. - -Reads the dashboard JSON out of the provisioned ConfigMap YAML (i.e. exactly what -Grafana loaded), extracts every PromQL expression, queries the Prometheus HTTP API -and prints panel title -> PromQL -> series count -> sample. - -Usage: validate_panels.py [DASHBOARD_DIR] [PROM_URL] -""" -import json -import os -import sys -import urllib.parse -import urllib.request - -import yaml - -DASH_DIR = sys.argv[1] if len(sys.argv) > 1 else os.path.expanduser( - "~/Projects/homek8s/monitoring/controllers/home/dashboards") -PROM = sys.argv[2] if len(sys.argv) > 2 else "http://127.0.0.1:9090" - -# Grafana template variable substitution for the "All" case, so the query the -# script runs is the query Grafana runs. -SUBST = {"$namespace": ".*", "${namespace}": ".*", "$__all": ".*"} - - -def substitute(expr): - for k, v in SUBST.items(): - expr = expr.replace(k, v) - return expr - - -def query(expr): - url = "%s/api/v1/query?%s" % (PROM, urllib.parse.urlencode({"query": expr})) - with urllib.request.urlopen(url, timeout=20) as r: - body = json.load(r) - if body.get("status") != "success": - return None, body.get("error", "unknown error") - return body["data"]["result"], None - - -def panels_of(dash): - out = [] - for p in dash.get("panels", []): - out.append(p) - out.extend(p.get("panels", []) or []) - return out - - -total = 0 -bad = 0 -for fn in sorted(os.listdir(DASH_DIR)): - if not fn.endswith(".yaml"): - continue - doc = yaml.safe_load(open(os.path.join(DASH_DIR, fn))) - if not isinstance(doc, dict) or "data" not in doc: - continue # kustomization.yaml, build.py helpers, etc. - key = [k for k in doc["data"] if k.endswith(".json")][0] - dash = json.loads(doc["data"][key]) - print("\n=== %s (uid: %s) ===" % (dash["title"], dash["uid"])) - for p in panels_of(dash): - if p.get("type") in ("row", "text"): - continue - for t in p.get("targets", []): - expr = substitute(t.get("expr", "")) - if not expr: - continue - total += 1 - result, err = query(expr) - if err: - bad += 1 - print(" FAIL %-46s %s\n ERROR: %s" % (p["title"][:46], expr.replace("\n", " ")[:110], err)) - continue - if not result: - bad += 1 - print(" EMPTY %-46s %s" % (p["title"][:46], expr.replace("\n", " ")[:110])) - continue - sample = result[0] - labels = {k: v for k, v in sample["metric"].items() - if k not in ("__name__", "job", "instance", "namespace", "container", - "endpoint", "pod", "service", "uid")} - print(" OK %-46s %-3d series sample=%s %s" - % (p["title"][:46], len(result), sample["value"][1], labels or "")) - -print("\n%d targets checked, %d empty/failed" % (total, bad)) -sys.exit(1 if bad else 0) diff --git a/monitoring/controllers/home/garage.yaml b/monitoring/controllers/home/garage.yaml deleted file mode 100644 index fa10181..0000000 --- a/monitoring/controllers/home/garage.yaml +++ /dev/null @@ -1,163 +0,0 @@ -# Garage (Pi, WireGuard-only object store) -> Prometheus -# -# Garage runs OUTSIDE the cluster (Docker on rpi, see infrastructure/garage/), -# so it has no pod to scrape. Its admin API serves /metrics on the Pi's -# WireGuard hub address 10.10.0.1:3903, which the cluster reaches over the mesh -# by native routing — the same path the site's media initContainer already uses -# for 10.10.0.1:3900. -# -# Service + EndpointSlice with no selector is the supported way to scrape a -# fixed external address with ServiceMonitor: the operator resolves endpoints -# from the Service's EndpointSlices, so there is nothing for the cluster to -# schedule and no node affinity problem. -# -# Before 2026-11-19 the admin port was published on loopback only, so /metrics -# returned "connection refused" from inside the cluster and Garage was invisible -# to Prometheus. The listener is now published on 10.10.0.1 only (never -# 0.0.0.0), with no metrics_token because the port does not leave the mesh. -# -# No Alertmanager is deployed in this stack: these rules show up under -# Prometheus -> /alerts and Grafana -> Alerting, they do not page anyone. ---- -apiVersion: v1 -kind: Service -metadata: - name: garage - namespace: monitoring - labels: - app: garage -spec: - type: ClusterIP - # No selector on purpose — the endpoints are static, not pods. - ports: - - name: metrics - port: 3903 - targetPort: 3903 - protocol: TCP ---- -apiVersion: discovery.k8s.io/v1 -kind: EndpointSlice -metadata: - name: garage - namespace: monitoring - labels: - app: garage - kubernetes.io/service-name: garage -addressType: IPv4 -ports: - - name: metrics - port: 3903 - protocol: TCP -endpoints: - - addresses: - - 10.10.0.1 - conditions: - ready: true ---- -apiVersion: v1 -kind: Endpoints -metadata: - # Kept for older tooling that still reads the Endpoints API; the EndpointSlice - # above is what the operator actually consumes on this cluster. - name: garage - namespace: monitoring - labels: - app: garage -subsets: - - addresses: - - ip: 10.10.0.1 - ports: - - name: metrics - port: 3903 - protocol: TCP ---- -apiVersion: monitoring.coreos.com/v1 -kind: ServiceMonitor -metadata: - name: garage - namespace: monitoring - labels: - release: kube-prometheus-stack -spec: - jobLabel: app - namespaceSelector: - matchNames: - - monitoring - selector: - matchLabels: - app: garage - endpoints: - - port: metrics - path: /metrics - interval: 30s - scrapeTimeout: 10s ---- -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - name: garage - namespace: monitoring - labels: - release: kube-prometheus-stack -spec: - groups: - - name: garage - rules: - - alert: GarageDown - expr: up{job="garage"} == 0 - for: 5m - labels: - severity: critical - annotations: - summary: "Garage metrics endpoint is down (10.10.0.1:3903)" - description: >- - Prometheus cannot scrape Garage. Either the container is stopped - (docker compose on the Pi), the 3903 publish was lost, or the - WireGuard mesh is broken. The site's media initContainer degrades - gracefully when this happens, so nothing else will report it. - - alert: GarageClusterUnhealthy - expr: cluster_healthy{job="garage"} == 0 - for: 5m - labels: - severity: critical - annotations: - summary: "Garage reports an unhealthy cluster" - description: >- - Single storage node d053db4dfc97bf78 was not able to reach a - healthy state. S3 requests will fail until this clears. - - alert: GarageDiskFillingUp - # Same 80% threshold as this stack's other disk alerts. - expr: >- - (1 - (garage_local_disk_avail{job="garage"} / garage_local_disk_total{job="garage"})) > 0.8 - for: 15m - labels: - severity: warning - annotations: - summary: "Garage storage node is more than 80% full" - description: >- - The Pi's Garage data directory is filling up. Uploads start failing - hard at 100%; free space or raise the node capacity in Garage, - do not delete the meta/ directory. - - alert: GarageMetadataGcBacklog - expr: table_gc_todo_queue_length{job="garage"} > 1000 - for: 30m - labels: - severity: warning - annotations: - summary: "Garage metadata GC queue is backed up" - description: >- - The metadata engine has more than 1000 pending GC operations. This - is the early signal for a metadata problem, which is the failure - mode that orphans data/ — check `garage meta snapshot` and backups - are running before it becomes a restore. - - alert: GarageResyncErroredBlocks - expr: block_resync_errored_blocks{job="garage"} > 0 - for: 15m - labels: - severity: warning - annotations: - summary: "Garage has blocks that failed to resync" - description: >- - At least one data block could not be resynchronised on the storage - node. With replication_factor 1 there is no other copy, so this is - data at risk — verify the object is readable and check backups. diff --git a/monitoring/controllers/home/gateway-probe.yaml b/monitoring/controllers/home/gateway-probe.yaml deleted file mode 100644 index 69f4ac9..0000000 --- a/monitoring/controllers/home/gateway-probe.yaml +++ /dev/null @@ -1,181 +0,0 @@ -# Internal-gateway liveness probe (WireGuard-only services). -# -# Why this exists: the internal listeners (8081 Grafana, 8084 Hubble UI) are -# served by the Cilium hostNetwork Envoy on the node(s) carrying -# `node-role.kubernetes.io/gateway=true`. Before 2026-10-27 that label was on -# both rpi and siriussec, and the Pi's Envoy could complete TCP to a backend -# pod on siriussec but never finish the request: every request to -# 10.10.0.1:8081/8084 hung for 5 s and then returned 503, even from the Pi's -# own 127.0.0.1. Clients that tried "either IP" therefore saw the dashboards -# flap. The label now lives on siriussec only, and this probe makes a -# regression (label re-added, listener gone, Envoy wedged, firewall rule -# dropped) visible in Prometheus/Grafana instead of on Lance's phone. -# -# Prober: blackbox-exporter, pinned to siriussec (same node as the Gateway, so -# the probe crosses the pod network over the WireGuard mesh rather than -# loopback). Nothing here is public: the prober talks to the node IP over the -# mesh and the host firewall in `infrastructure/networking/internal` is what -# restricts the listeners themselves. ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: blackbox-exporter - namespace: monitoring -data: - blackbox.yml: | - modules: - # Grafana answers / with a 302 to /login, Hubble UI answers 200. - http_2xx_or_3xx: - prober: http - timeout: 5s - http: - valid_status_codes: [200, 301, 302, 303, 307, 308] - preferred_ip_protocol: ip4 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: blackbox-exporter - namespace: monitoring - labels: - app.kubernetes.io/name: blackbox-exporter -spec: - replicas: 1 - selector: - matchLabels: - app.kubernetes.io/name: blackbox-exporter - template: - metadata: - labels: - app.kubernetes.io/name: blackbox-exporter - spec: - nodeSelector: - kubernetes.io/hostname: siriussec - containers: - - name: blackbox-exporter - image: prom/blackbox-exporter:v0.25.0 - args: - - --config.file=/etc/blackbox_exporter/blackbox.yml - ports: - - name: http - containerPort: 9115 - readinessProbe: - httpGet: - path: /-/healthy - port: http - initialDelaySeconds: 5 - resources: - requests: - cpu: 10m - memory: 32Mi - limits: - cpu: 100m - memory: 64Mi - volumeMounts: - - name: config - mountPath: /etc/blackbox_exporter - volumes: - - name: config - configMap: - name: blackbox-exporter ---- -apiVersion: v1 -kind: Service -metadata: - name: blackbox-exporter - namespace: monitoring - labels: - app.kubernetes.io/name: blackbox-exporter -spec: - selector: - app.kubernetes.io/name: blackbox-exporter - ports: - - name: http - port: 9115 - targetPort: http ---- -# Only 10.10.0.2 is a serving internal-gateway address. The Gateways' -# `status.addresses` lists EVERY node InternalIP (10.10.0.1, 10.10.0.2, -# 10.10.0.5) regardless of which nodes run cilium-envoy, and Cilium ignores -# `spec.addresses`, so the status list is NOT a "try either IP" guide. -apiVersion: monitoring.coreos.com/v1 -kind: Probe -metadata: - name: internal-gateway - namespace: monitoring - labels: - release: kube-prometheus-stack -spec: - jobName: internal-gateway - interval: 30s - module: http_2xx_or_3xx - prober: - url: blackbox-exporter.monitoring.svc:9115 - path: /probe - targets: - staticConfig: - static: - - http://10.10.0.2:8081/ - - http://10.10.0.2:8084/ - labels: - exposure: wireguard-internal ---- -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - name: internal-gateway - namespace: monitoring - labels: - release: kube-prometheus-stack -spec: - groups: - - name: internal-gateway - rules: - - alert: InternalGatewayUnreachable - expr: probe_success{job="internal-gateway"} == 0 - for: 3m - labels: - severity: warning - annotations: - summary: >- - Internal gateway listener {{ $labels.instance }} is not answering - (probe_success 0 for 3m) - description: >- - Grafana (8081) / Hubble UI (8084) are served by cilium-envoy on - siriussec only. Check that rpi has NOT re-acquired - node-role.kubernetes.io/gateway=true, that cilium-envoy is Running - on siriussec, that the internal_gw nft table accepts 10.10.0.0/24 - and 10.244.0.0/16, and that the route/service behind the listener - exists. - # The exact regression this card fixed: rpi re-acquiring the gateway - # label adds a second Envoy that answers 5 s/503s for everything it is - # asked. kube-state-metrics exposes role labels as kube_node_role, so - # this needs no extra probe target (`kube_node_labels` is not exposed - # with the stack's default metric allowlist). - - alert: GatewayNodeCountNotOne - expr: count(kube_node_role{role="gateway"}) != 1 - for: 5m - labels: - severity: warning - annotations: - summary: >- - {{ $value }} nodes carry node-role.kubernetes.io/gateway=true - (expected exactly 1 — siriussec) - description: >- - Every gateway-labelled node runs cilium-envoy and binds 8080/8081/ - 8084. A node that does not also run the backend pods answers 503 - after exactly 5 s for everything (that is how 10.10.0.1 made the - internal dashboards flap). Remove the label: - kubectl label node node-role.kubernetes.io/gateway- - - alert: InternalGatewayProbeMissing - expr: absent(probe_success{job="internal-gateway"}) - for: 10m - labels: - severity: warning - annotations: - summary: The internal-gateway blackbox probe has disappeared from Prometheus - description: >- - Either the Probe object / blackbox-exporter pod is gone or the - operator is not selecting it (label release=kube-prometheus-stack). - The dashboards are then unmonitored, not necessarily broken. diff --git a/monitoring/controllers/home/grafana-backup.yaml b/monitoring/controllers/home/grafana-backup.yaml deleted file mode 100644 index 2da83fb..0000000 --- a/monitoring/controllers/home/grafana-backup.yaml +++ /dev/null @@ -1,178 +0,0 @@ ---- -# Nightly backup of Grafana's sqlite state (dashboards, alert rules, users, -# annotations) to the Linode VPS over the WireGuard mesh. -# -# Why a Job in this namespace instead of the `forgejo/cluster-backup` exec -# path: the Grafana image is `-distroless` — there is no shell, no `cp`, no -# `tar`, so `kubectl exec` cannot produce a dump. The PVC is on siriussec -# (`local-path`) and RWO still allows a second pod on the same node, so the -# backup pod mounts the volume read-write and takes a *consistent* copy with -# the sqlite backup API (a plain `cp` of a live database can capture a torn -# page or a half-applied transaction). -# -# Layout on the Linode (same tree/retention style as the cluster-backup job): -# /root/cluster-backup/grafana/grafana-.db -# /root/cluster-backup/manifests/.txt (appended by that job's runs) -apiVersion: v1 -kind: ConfigMap -metadata: - name: grafana-backup-scripts - namespace: monitoring - labels: - app: grafana-backup -data: - backup.sh: | - #!/bin/sh - # Consistent sqlite snapshot -> Linode. Streamed: nothing is staged on the - # T480's root filesystem, the only local file is a ~3 MB copy in /tmp. - set -eu - - if ! command -v rsync >/dev/null || ! command -v ssh >/dev/null; then - echo "== installing rsync + openssh-client" - apk add --no-cache rsync openssh-client >/dev/null - fi - - BACKUP_HOST=${BACKUP_HOST:-root@10.10.0.5} - BACKUP_DIR=${BACKUP_DIR:-/root/cluster-backup} - DB_KEEP=${DB_KEEP:-14} - MIN_FREE_GB=${MIN_FREE_GB:-8} - STAMP=${STAMP:-$(date -u +%Y%m%dT%H%M%SZ)} - OUT="$BACKUP_DIR/grafana/grafana-$STAMP.db" - - SSH_OPTS="-i /keys/id_ed25519 -o UserKnownHostsFile=/keys/known_hosts \ - -o StrictHostKeyChecking=yes -o BatchMode=yes -o ConnectTimeout=20 \ - -o ServerAliveInterval=30" - ssh_r() { ssh $SSH_OPTS "$BACKUP_HOST" "$@"; } - - echo "== target: $BACKUP_HOST:$BACKUP_DIR stamp=$STAMP" - ssh_r "mkdir -p '$BACKUP_DIR/grafana' '$BACKUP_DIR/manifests'" - avail_gb=$(ssh_r "df -Pk '$BACKUP_DIR' | awk 'NR==2{printf \"%d\", \$4/1048576}'") - avail_gb=${avail_gb:-0} - echo "== remote free space: ${avail_gb} GiB (minimum ${MIN_FREE_GB} GiB)" - if [ "$avail_gb" -lt "$MIN_FREE_GB" ]; then - echo "FAIL: not enough free space on $BACKUP_HOST" - exit 1 - fi - - echo "== sqlite snapshot of /grafana-data/grafana.db" - # The backup API takes a read transaction, so the copy is a consistent - # point-in-time image even while Grafana keeps writing. - python3 - <<'PY' - import sqlite3, sys - src = sqlite3.connect("/grafana-data/grafana.db", timeout=60) - src.execute("PRAGMA busy_timeout=60000") - dst = sqlite3.connect("/tmp/grafana.db") - src.backup(dst) - dst.close() - src.close() - check = sqlite3.connect("/tmp/grafana.db") - verdict = check.execute("PRAGMA integrity_check").fetchone()[0] - rows = {t: check.execute("SELECT count(*) FROM %s" % t).fetchone()[0] - for t in ("dashboard", "dashboard_version", "user", "alert_rule")} - check.close() - print(" integrity_check=%s dashboard=%s versions=%s user=%s alert_rule=%s" - % (verdict, rows["dashboard"], rows["dashboard_version"], - rows["user"], rows["alert_rule"])) - if verdict != "ok": - sys.exit("FAIL: sqlite integrity_check returned %r" % verdict) - PY - - local_sha=$(sha256sum /tmp/grafana.db | awk '{print $1}') - local_size=$(wc -c < /tmp/grafana.db) - echo "== shipping $local_size bytes sha256=$local_sha -> $OUT" - ssh_r "cat > '$OUT.part'" < /tmp/grafana.db - remote_sha=$(ssh_r "sha256sum '$OUT.part' | awk '{print \$1}'") - if [ "$local_sha" != "$remote_sha" ]; then - echo "FAIL: sha256 mismatch for $OUT (local=$local_sha remote=${remote_sha:-none})" - ssh_r "rm -f '$OUT.part'" - exit 1 - fi - ssh_r "mv '$OUT.part' '$OUT'" - rm -f /tmp/grafana.db - - echo "== manifest" - ssh_r "cd '$BACKUP_DIR' && { echo 'stamp $STAMP'; echo \"host \$(hostname -s)\"; \ - echo '--- grafana'; ls -l 'grafana/grafana-$STAMP.db'; \ - sha256sum 'grafana/grafana-$STAMP.db'; } >> manifests/$STAMP.txt && \ - tail -5 manifests/$STAMP.txt" - - echo "== retention: last $DB_KEEP grafana snapshots" - ssh_r "cd '$BACKUP_DIR/grafana' && ls -1t *.db 2>/dev/null | tail -n +$((DB_KEEP + 1)) | xargs -r rm -f" - ssh_r "df -h '$BACKUP_DIR' | tail -1" - - echo "RESULT=success stamp=$STAMP" ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: grafana-backup - namespace: monitoring - labels: - app: grafana-backup -spec: - # 23 minutes after the forgejo/cluster-backup job starts (02:37 UTC) so the - # two do not compete for WireGuard bandwidth or the Linode's disk. - schedule: "0 3 * * *" - timeZone: "Etc/UTC" - concurrencyPolicy: Forbid - startingDeadlineSeconds: 1800 - successfulJobsHistoryLimit: 3 - failedJobsHistoryLimit: 3 - jobTemplate: - spec: - activeDeadlineSeconds: 900 - backoffLimit: 1 - template: - metadata: - labels: - app: grafana-backup - spec: - restartPolicy: Never - # The grafana PVC is local-path on siriussec; RWO still allows a - # second pod on the same node. - nodeSelector: - kubernetes.io/hostname: siriussec - containers: - - name: backup - # python3 alpine: the sqlite backup API is the only consistent - # way to copy a live database without a shell inside Grafana. - image: python:3.12-alpine - imagePullPolicy: IfNotPresent - command: ["/bin/sh", "/scripts/backup.sh"] - env: - - name: BACKUP_HOST - value: root@10.10.0.5 - - name: BACKUP_DIR - value: /root/cluster-backup - - name: DB_KEEP - value: "14" - volumeMounts: - - name: grafana-data - mountPath: /grafana-data - - name: keys - mountPath: /keys - readOnly: true - - name: scripts - mountPath: /scripts - readOnly: true - resources: - requests: - cpu: 50m - memory: 64Mi - limits: - ephemeral-storage: 256Mi - memory: 256Mi - volumes: - - name: grafana-data - persistentVolumeClaim: - claimName: kube-prometheus-stack-grafana - - name: keys - secret: - # Copy of forgejo/cluster-backup-ssh, created out of band - # (never in git) — see docs/cluster-overview.md §8.1. - secretName: cluster-backup-ssh - defaultMode: 0400 - - name: scripts - configMap: - name: grafana-backup-scripts - defaultMode: 0755 diff --git a/monitoring/controllers/home/httproute.yaml b/monitoring/controllers/home/httproute.yaml deleted file mode 100644 index fb18718..0000000 --- a/monitoring/controllers/home/httproute.yaml +++ /dev/null @@ -1,35 +0,0 @@ -# Grafana is served by the INTERNAL gateway only (gateway-system is the public -# one, fed by the Cloudflare tunnel). There is no Cloudflare ingress entry for -# this hostname and there must never be one. -# -# Reachable over WireGuard, and deliberately WITHOUT a Host header mapping: -# phones: http://10.10.0.2:8081/ -# laptops: http://grafana.lab.internal:8081/ (10.10.0.2 grafana.lab.internal) -# -# `hostnames` is intentionally ABSENT: a phone sends `Host: 10.10.0.2:8081`, -# which matches no `.lab.internal` hostname, and Envoy answers 404. A route -# with no hostnames matches any Host on the listener, so both URLs work. -# Port 8081 is Grafana's alone — do not attach a second hostname-less route to -# `http-internal`: two bare routes on one listener make precedence ambiguous, -# so any future internal service gets its own listener port. -# -# The listener answers only on 10.10.0.0/24 + the pod CIDR — the host firewall -# (see docs/internal-wireguard-services.md) drops :8081 everywhere else. -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: grafana - namespace: monitoring -spec: - parentRefs: - - name: internal - namespace: internal - sectionName: http-internal - rules: - - matches: - - path: - type: PathPrefix - value: / - backendRefs: - - name: kube-prometheus-stack-grafana - port: 80 diff --git a/monitoring/controllers/home/kustomization.yaml b/monitoring/controllers/home/kustomization.yaml index 0d2b035..b83b23e 100644 --- a/monitoring/controllers/home/kustomization.yaml +++ b/monitoring/controllers/home/kustomization.yaml @@ -1,20 +1,3 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: monitoring -resources: - - namespace.yaml - - repository.yaml - - release.yaml - - httproute.yaml - - gateway-probe.yaml - - garage.yaml - - prune-alerts.yaml - # Nightly consistent sqlite snapshot of Grafana's dashboards/alerts/users. - - grafana-backup.yaml - - dashboards -configMapGenerator: - - name: kube-prometheus-stack-values - files: - - values.yaml=values.yaml -configurations: - - kustomizeconfig.yaml +resources: [] diff --git a/monitoring/controllers/home/kustomizeconfig.yaml b/monitoring/controllers/home/kustomizeconfig.yaml deleted file mode 100644 index a80be15..0000000 --- a/monitoring/controllers/home/kustomizeconfig.yaml +++ /dev/null @@ -1,6 +0,0 @@ -nameReference: - - kind: ConfigMap - version: v1 - fieldSpecs: - - path: spec/valuesFrom/name - kind: HelmRelease diff --git a/monitoring/controllers/home/namespace.yaml b/monitoring/controllers/home/namespace.yaml deleted file mode 100644 index d325236..0000000 --- a/monitoring/controllers/home/namespace.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: monitoring diff --git a/monitoring/controllers/home/prune-alerts.yaml b/monitoring/controllers/home/prune-alerts.yaml deleted file mode 100644 index 9d683d8..0000000 --- a/monitoring/controllers/home/prune-alerts.yaml +++ /dev/null @@ -1,266 +0,0 @@ -# Alerts for the disk-reclamation job and the daemons it prunes. -# -# Context: `forgejo/forgejo-runner-prune` reclaims build cache nightly. Its -# own success/failure is invisible unless kube-state-metrics is watched, and -# the failure mode it exists to prevent (a full disk on siriussec → DiskPressure -# → Forgejo + Postgres evicted, public 503) shows up in node_exporter first. -# -# What is measurable here: -# - node filesystem utilisation per node (node-exporter, all three nodes); -# on siriussec the local-path PVs — including the runner's dind data-root — -# live on `/`, so this is the DiskPressure precursor and the closest thing -# to a PVC watchdog this cluster can have (runner-scoped rules below). -# - CronJob last-success timestamp and Job failure counters -# (kube-state-metrics). -# -# What is NOT measurable here — per-PVC bytes. kubelet_volume_stats_* was an -# ALPHA metric set served from kubelet's /metrics/volumes endpoint; that -# endpoint is gone in this cluster's kubelet. Verified 2026-10-27 on kubelet -# v1.36.4: `https://:10250/metrics/volumes` returns **404 on all three -# nodes** (10.10.0.2 / 10.10.0.1 / 10.10.0.5) while /metrics, /metrics/probes, -# /metrics/cadvisor and /metrics/resource return 200, `/metrics` contains no -# kubelet_volume_stats_* series at all, and Prometheus has zero series for -# either name. This is the upstream loss of the alpha volume-stats metrics in -# kubelet 1.34 (kubernetes/kubernetes#133847, regression fix #133890), not a -# hostPath/PVC-type quirk and not something a scrape config can bring back: -# there is no endpoint left to scrape, and re-deriving it would mean a new -# exporter parsing kubelet's /stats/summary JSON (new Deployment + nodes/stats -# RBAC) — out of proportion for a three-node lab. So: no alert here selects a -# metric that does not exist. Coverage is the node filesystem that actually -# holds the data: `RunnerDindDisk*` below (runner-scoped, 80/90 %, every node -# running a runner except rpi), `RpiDindDataRootFillingUp` in group -# `dind-disk-cap` (rpi, 70 %, because its 240 GiB of dind PVCs sit on a 917 G -# disk) and the generic `disk-capacity` group (85/92 %). Per-PVC and -# per-Docker-volume sizes are still printed by the prune job every night -# (`docker system df -v`) — that output is the record of growth. -# -# Alertmanager is disabled in this stack (monitoring card), so these surface in -# Prometheus → Alerts and Grafana → Alerting. No external receiver is added. -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - name: forgejo-prune - namespace: monitoring - labels: - release: kube-prometheus-stack -spec: - groups: - - name: forgejo-prune - rules: - - alert: ForgejoPruneCronJobStale - # 04:17 UTC nightly; 26 h leaves room for one missed tick before it - # pages a human. `or absent(...)` catches the job being deleted or - # never having succeeded at all. - expr: | - ( - time() - kube_cronjob_status_last_successful_time{namespace="forgejo", cronjob="forgejo-runner-prune"} > 26 * 3600 - ) - or - absent(kube_cronjob_status_last_successful_time{namespace="forgejo", cronjob="forgejo-runner-prune"}) - for: 10m - labels: - severity: warning - annotations: - summary: >- - forgejo-runner-prune has not completed successfully in over 26 h - description: >- - Build cache, exited containers and unused images are not being - reclaimed on the Pi host daemon or on the dind daemons. Check - `kubectl -n forgejo get jobs -l role=prune` and the pod logs of - the newest Job; the job skips (exit 0) when a build is live, but - a *stale* success means it has not run at all. Force one run: - kubectl -n forgejo create job --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s) - - alert: ForgejoPruneJobFailed - # kube_job_failed was removed from kube-state-metrics; the supported - # series is kube_job_status_failed (0 for a successful job, >0 when a - # pod failed). Only the most recent jobs are kept in Prometheus, so a - # transient failure ages out on its own after the history limit. - expr: | - max by (job_name) ( - kube_job_status_failed{namespace="forgejo", job_name=~"forgejo-runner-prune-.*"} - ) > 0 - for: 5m - labels: - severity: warning - annotations: - summary: forgejo-runner-prune Job {{ $labels.job_name }} has a failed pod - description: >- - A prune run failed (or its dind discovery/exec container did). - Read `kubectl -n forgejo logs job/{{ $labels.job_name }} -c - dind-daemons` — a failure there means a running dind daemon was - not reachable over the exec API, so that daemon is growing - unpruned. One retry is allowed by backoffLimit; persistent - failures need the RBAC or the pod checked. - # Runner-scoped filesystem rules: this is the honest replacement for the - # old per-PVC pair (kubelet_volume_stats_* has no producer — header). - # They measure the filesystem that actually backs the dind data-root, on - # the nodes that actually run a forgejo-runner pod. On siriussec that is - # /opt/local-path-provisioner/pvc-*_forgejo_forgejo-runner-amd64 (dind's - # /var/lib/docker) on the root ext4. - # Scoping by *pod* rather than by PVC name is deliberate: the PVCs are - # shared-filesystem consumers, arm64 dind PVCs are covered the moment - # their runner pod is scheduled, and nodes that run no runner (linode) do - # not duplicate the generic disk-capacity group. - # rpi is deliberately excluded (nodename!="rpi"): it carries 240 GiB of - # dind PVCs on a 917 G disk, so 80 % (~734 G) would be far too late to run - # the prune job. Group `dind-disk-cap` holds its tighter 70 % cap - # (RpiDindDataRootFillingUp). Two rules, two disks, no double page. - # Thresholds here are 5 points tighter than NodeFilesystemFillingUp / - # Critical so CI fill is reported as CI fill, with the runner runbook. - - alert: RunnerDindDiskHighWatermark - expr: | - ( - ( - ( - 1 - ( - node_filesystem_avail_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs"} - / - node_filesystem_size_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs"} - ) - ) * on (instance) group_left (nodename) node_uname_info{nodename!="rpi"} - ) - and on (nodename) - label_replace( - max by (node) (kube_pod_info{namespace="forgejo", pod=~"forgejo-runner-.*"}), - "nodename", "$1", "node", "(.+)" - ) - ) > 0.80 - for: 30m - labels: - severity: warning - annotations: - summary: >- - {{ $labels.nodename }} is {{ $value | humanizePercentage }} full — - the filesystem carrying this node's Forgejo runner dind data-root - description: >- - A forgejo-runner pod runs on {{ $labels.nodename }}, and its dind - data-root is a directory under /opt/local-path-provisioner on this - node's root filesystem (on siriussec: - pvc-*_forgejo_forgejo-runner-amd64), so CI images, build cache and - named volumes fill the same disk as Forgejo, Postgres and - Prometheus. Per-PVC bytes cannot be measured here — kubelet 1.34+ - no longer exports kubelet_volume_stats_* and /metrics/volumes is - 404 — so this node-level rule is the guard. Inspect the offenders: - `kubectl -n forgejo exec -c dind -- docker system df -v` - and `du -sh /opt/local-path-provisioner/pvc-*` on the node, then let - the nightly prune reclaim (or force it: kubectl -n forgejo create job - --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s)). - - alert: RunnerDindDiskCritical - expr: | - ( - ( - ( - 1 - ( - node_filesystem_avail_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs"} - / - node_filesystem_size_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs"} - ) - ) * on (instance) group_left (nodename) node_uname_info{nodename!="rpi"} - ) - and on (nodename) - label_replace( - max by (node) (kube_pod_info{namespace="forgejo", pod=~"forgejo-runner-.*"}), - "nodename", "$1", "node", "(.+)" - ) - ) > 0.90 - for: 10m - labels: - severity: critical - annotations: - summary: >- - {{ $labels.nodename }} is {{ $value | humanizePercentage }} full — - runner builds will fail with ENOSPC - description: >- - DiskPressure is imminent on a node running CI: kubelet starts - evicting (Forgejo + pg-1 went Pending on siriussec this way) and - dind builds fail with "no space left on device". Act now: scale the - runner to 0 (`kubectl -n forgejo scale deploy/ --replicas=0`), - force the prune, and only then clear the dind data-root by hand - (`/opt/local-path-provisioner/pvc-*_forgejo_forgejo-runner-*/` on - the node) — never wipe it while the runner pod is up. The 20Gi PVC - request does not cap the directory: local-path PVs are plain - directories, so the filesystem fills first. - - name: dind-disk-cap - rules: - # Pi-specific cap, added with the arm64 dind cutover (kanban - # t_0da0a1cc). The two arm64 runners now hold 240 GiB of dind PVCs - # (200Gi shared + 40Gi deploy) on rpi's single root filesystem, which - # is the same disk the kubelet lives on. A static hostPath PV does NOT - # enforce its claim, and per-PVC usage cannot be alerted on at all - # (kubelet 1.34+ exports no kubelet_volume_stats_*, header), so this node - # filesystem rule is the real growth cap: 70 % of 917 G leaves ~275 G, - # i.e. reachable while there is still room to run the prune job. - # `NodeFilesystemFillingUp` below stays at 85 % as the backstop. - - alert: RpiDindDataRootFillingUp - expr: | - ( - 1 - ( - node_filesystem_avail_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs", instance=~"10.10.0.1:.*"} - / - node_filesystem_size_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs", instance=~"10.10.0.1:.*"} - ) - ) * on (instance) group_left (nodename) node_uname_info{nodename="rpi"} > 0.70 - for: 30m - labels: - severity: warning - annotations: - summary: >- - rpi root filesystem is {{ $value | humanizePercentage }} full - (dind CI data-roots live here) - description: >- - The arm64 runners' dind data-roots (PVCs forgejo-runner-arm64-dind - 200Gi and forgejo-runner-deploy-arm64-dind 40Gi) share rpi's only - filesystem with the kubelet. Nothing enforces those claim sizes. - Attribute the growth with - `kubectl -n forgejo exec -c dind -- docker system df -v` - (the nightly prune job prints this for every daemon and never - deletes named volumes), then reclaim with - `kubectl -n forgejo create job --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s)`. - See docs/arm64-runner-dind.md §4.4. - - name: disk-capacity - rules: - - alert: NodeFilesystemFillingUp - # Root filesystem per node, named by hostname rather than IP so the - # alert is actionable. 85% is where kubelet's imagefs/nodefs GC and - # the DiskPressure taint start to matter on siriussec; the Pi's - # Docker volumes (169 GB of CI caches) live here too. - expr: | - ( - 1 - ( - node_filesystem_avail_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs"} - / - node_filesystem_size_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs"} - ) - ) * on (instance) group_left (nodename) node_uname_info > 0.85 - for: 30m - labels: - severity: warning - annotations: - summary: "{{ $labels.nodename }} root filesystem is {{ $value | humanizePercentage }} full" - description: >- - Reclaim with `kubectl -n forgejo create job - --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s)` (it - prunes the Pi host daemon and every dind daemon), and read that - job's `docker system df -v` output for the volumes that are - growing. At 85% kubelet starts evicting on siriussec — that is - the Forgejo 503 failure mode. - - alert: NodeFilesystemCritical - expr: | - ( - 1 - ( - node_filesystem_avail_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs"} - / - node_filesystem_size_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs"} - ) - ) * on (instance) group_left (nodename) node_uname_info > 0.92 - for: 10m - labels: - severity: critical - annotations: - summary: "{{ $labels.nodename }} root filesystem is {{ $value | humanizePercentage }} full" - description: >- - DiskPressure is imminent/immediate. Free space before the next - build: prune now, then check `docker system df -v` on that host - for the named volume that grew (never delete named volumes - blind — onionwire-target-ci and the Android SDK/Gradle caches - are shared CI state). diff --git a/monitoring/controllers/home/release.yaml b/monitoring/controllers/home/release.yaml deleted file mode 100644 index 75ba0d1..0000000 --- a/monitoring/controllers/home/release.yaml +++ /dev/null @@ -1,34 +0,0 @@ -apiVersion: helm.toolkit.fluxcd.io/v2 -kind: HelmRelease -metadata: - name: kube-prometheus-stack - namespace: monitoring -spec: - releaseName: kube-prometheus-stack - interval: 30m - chart: - spec: - chart: kube-prometheus-stack - # Pinned — never a floating range. Bump deliberately. - version: "92.14.0" - sourceRef: - kind: HelmRepository - name: prometheus-community - namespace: monitoring - install: - crds: Create - timeout: 15m - remediation: - retries: 3 - upgrade: - crds: CreateReplace - timeout: 15m - cleanupOnFail: true - remediation: - retries: 3 - remediateLastFailure: true - # Values live in monitoring/controllers/home/values.yaml, rendered to a - # Flux ConfigMap (kube-prometheus-stack-values-) by kustomize. - valuesFrom: - - kind: ConfigMap - name: kube-prometheus-stack-values diff --git a/monitoring/controllers/home/repository.yaml b/monitoring/controllers/home/repository.yaml deleted file mode 100644 index 96e0994..0000000 --- a/monitoring/controllers/home/repository.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1 -kind: HelmRepository -metadata: - name: prometheus-community - namespace: monitoring -spec: - interval: 24h - url: https://prometheus-community.github.io/helm-charts diff --git a/monitoring/controllers/home/values.yaml b/monitoring/controllers/home/values.yaml deleted file mode 100644 index 1dae79c..0000000 --- a/monitoring/controllers/home/values.yaml +++ /dev/null @@ -1,191 +0,0 @@ -# kube-prometheus-stack values — home cluster (Sirius DevOps) -# -# Pinned in release.yaml to chart 92.14.0 (appVersion v0.94.2). -# Everything lands on siriussec: amd64 image (rpi is arm64) + local-path PVs. -# Prometheus is capped twice (time AND bytes) so a metrics burst can never -# repeat the ephemeral-storage / DiskPressure incident (see docs/cluster-overview.md). - -# --- Alertmanager: off. No receivers in this card; alerts fire to nowhere on purpose. -alertmanager: - enabled: false - -defaultRules: - create: true - # Control-plane / proxy components that this cluster does not expose to - # Prometheus: kube-proxy is replaced by Cilium, and the kubeadm static pods - # only bind their metrics on 127.0.0.1. Rules for them would sit "firing" - # forever, so drop the whole groups that depend on those targets. - rules: - kubeProxy: false - kubeControllerManager: false - kubeScheduler: false - kubeEtcd: false - # Per-rule opt-out (chart: `defaultRules.disabled.`), used instead - # of dropping a whole group. - # - # Group `kubernetes-storage` has five rules. Four of them — both severities of - # KubePersistentVolumeFillingUp and of KubePersistentVolumeInodesFillingUp — - # use kubelet_volume_stats_*. That ALPHA metric set was served - # from kubelet's /metrics/volumes, which was removed in kubelet 1.34 - # (kubernetes/kubernetes#133847, fix #133890). This cluster runs kubelet - # v1.36.4, /metrics/volumes returns 404 on all three nodes, and Prometheus - # holds zero series: count(kubelet_volume_stats_used_bytes) -> [] (0 series). - # Those rules therefore load `health=ok, state=inactive` and can never fire — - # which reads as "no PVC is filling up" when in reality nothing is measured. - # Both severities of one alert name are gated by a single `disabled` key. - # - # The group's fifth rule, KubePersistentVolumeErrors, is NOT dead — it is - # built on kube-state-metrics' `kube_persistentvolume_status_phase`, which is - # live here (40 series across 6 PVs when this landed). It stays in the chart - # and is deliberately not disabled: this way no working alert is dropped and - # no chart rule is duplicated by hand. - disabled: - KubePersistentVolumeFillingUp: true - KubePersistentVolumeInodesFillingUp: true - -# --- Control-plane targets that are unreachable or lift-heavy for a lab box -kubeProxy: - enabled: false -kubeControllerManager: - enabled: false -kubeScheduler: - enabled: false -kubeEtcd: - enabled: false -kubeApiServer: - enabled: true - -prometheusOperator: - nodeSelector: - kubernetes.io/hostname: siriussec - resources: - requests: - cpu: 50m - memory: 128Mi - limits: - cpu: 500m - memory: 256Mi - admissionWebhooks: - patch: - nodeSelector: - kubernetes.io/hostname: siriussec - -prometheus: - enabled: true - prometheusSpec: - # Storage: local-path on siriussec. 10Gi PVC + an 8GB TSDB cap leaves - # headroom for WAL/checkpoint files inside the same volume. - retention: 7d - retentionSize: 8GB - scrapeInterval: 30s - evaluationInterval: 30s - nodeSelector: - kubernetes.io/hostname: siriussec - resources: - requests: - cpu: 200m - memory: 512Mi - limits: - cpu: "1" - memory: 2Gi - storageSpec: - volumeClaimTemplate: - spec: - storageClassName: local-path - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 10Gi - # No remoteWrite / remoteRead / receivers: metrics never leave the cluster. - -grafana: - enabled: true - nodeSelector: - kubernetes.io/hostname: siriussec - # Admin credentials live in the monitoring/grafana-admin Secret (created out of - # band with kubectl, never in git). Keys: admin-user, admin-password. - admin: - existingSecret: grafana-admin - resources: - requests: - cpu: 50m - memory: 128Mi - limits: - cpu: 500m - memory: 512Mi - # Dashboards and datasources are provisioned from ConfigMaps (chart-generated, - # sidecar-loaded) — nothing is created by hand in the UI. - defaultDashboardsEnabled: true - sidecar: - dashboards: - enabled: true - label: grafana_dashboard - datasources: - enabled: true - label: grafana_datasource - # Persistence: Grafana's own sqlite DB (/var/lib/grafana/grafana.db) now lives - # on a local-path PVC on siriussec, so an in-app admin-password change and any - # session/API-key state survive a pod restart. Dashboards + datasources are - # STILL provisioned from ConfigMaps below and win over UI edits — that is the - # source of truth, and the reason only credentials/session state needed a PVC. - # 5Gi is generous for a sqlite DB that is measured in MB; the PV sits next to - # Prometheus's 10Gi on the same disk. - persistence: - enabled: true - type: pvc - storageClassName: local-path - accessModes: - - ReadWriteOnce - size: 5Gi - # A single local-path RWO PVC cannot be mounted by old + new pod at once, so a - # rolling update deadlocks (new pod Pending on the volume). Recreate is - # required with persistence enabled. Note: the live Deployment also carried - # strategy.rollingUpdate from the previous release, which SSA does not drop by - # omission — that took a one-off patch, see docs/grafana-persistence.md. - deploymentStrategy: - type: Recreate - # Stable session-signing key. Without this Grafana generates a fresh - # secret_key on every boot, so every existing browser cookie becomes - # "user token not found" and the client bounces on /. The Secret - # monitoring/grafana-secret-key is created out of band (never in git). - envValueFrom: - GF_SECURITY_SECRET_KEY: - secretKeyRef: - name: grafana-secret-key - key: secret_key - grafana.ini: - auth.anonymous: - enabled: false - users: - allow_sign_up: false - analytics: - reporting_enabled: false - -kube-state-metrics: - nodeSelector: - kubernetes.io/hostname: siriussec - resources: - requests: - cpu: 20m - memory: 32Mi - limits: - cpu: 200m - memory: 256Mi - -prometheus-node-exporter: - # DaemonSet on EVERY node (deliberately not pinned to siriussec). The arm64 - # Forgejo runner runs its jobs as *host* Docker containers on rpi, so the disk - # pressure that matters there is the Pi's root filesystem — invisible to - # kubelet/cAdvisor, which only describe pods. The runner dashboard's "Pi disk - # free" panel needs node-exporter on rpi to exist at all, and the same applies - # to linode. node-exporter is a read-only host-metrics DaemonSet (hostPath - # /proc + /sys, host network); it adds ~700 series per node, well inside the - # 8GB retentionSize cap, and rpi's PreferNoSchedule taint does not exclude it. - resources: - requests: - cpu: 20m - memory: 32Mi - limits: - cpu: 200m - memory: 128Mi