179 lines
10 KiB
Markdown
179 lines
10 KiB
Markdown
# Registry discovery and retained-data migration
|
|
|
|
`./jeannie apps` and `./jeannie apps container-registry` reconcile registry
|
|
storage before updating the Argo Application. This uses pinned cluster identity,
|
|
live nodes/PVs and the existing worker inventory, rather than a profile-specific
|
|
manifest directory.
|
|
|
|
Existing local PVs retain their node, path and resource names. A fresh cluster
|
|
with the old registry worker still present uses that worker. A fresh single-node
|
|
cluster on the deployment host instead prepares its local retained directory.
|
|
An existing PV pointing to a missing node is refused rather than rewritten.
|
|
|
|
For the local destination, Jeannie inspects the previous registry worker over
|
|
SSH. If the worker is stopped, it checks its Proxmox VMID and name, temporarily
|
|
starts only that VM, and restores its stopped state with a graceful shutdown.
|
|
It does not start the old control plane. Failure to reach or inspect the source
|
|
blocks deployment; it is not treated as missing registry data.
|
|
|
|
If source data exists, it is copied into a new staging directory after a disk
|
|
capacity check. Source manifests before/after the copy and the copied files must
|
|
have identical SHA-256 checksums. Changed source data, special files, failed
|
|
transfers or verification errors stop publication. Staging directories are
|
|
retained for investigation, and source data is never removed. If source
|
|
inspection confirms an absent or empty directory, an empty retained destination
|
|
is prepared instead. An existing destination is checksummed and reused unchanged
|
|
when it already contains the source files. Otherwise, non-conflicting files are
|
|
merged in staging and the complete union is verified. The original destination
|
|
is renamed to a timestamped backup before publishing the staged directory; a
|
|
publication failure restores it. Mutable tag `current/link` conflicts prefer the
|
|
Pimox source after checking the linked schema-2 manifest/index and all referenced
|
|
blob hashes. Repository history (`dc59dc8`, October 1, 2026) moved the active
|
|
registry from Debian to Pimox and routed subsequent endpoint pushes there. This
|
|
is an explicit lineage policy, not an assumption about filesystem timestamps.
|
|
Every selection and its old/new checksum is recorded in the migration receipt;
|
|
the complete original Debian directory remains in the destination backup.
|
|
Immutable blob conflicts, other unknown file conflicts, or a running Docker
|
|
container with write access to the destination block automatic publication. Destination
|
|
checksums must also remain stable throughout reconciliation. Existing data is
|
|
never silently overwritten or discarded.
|
|
|
|
Successful copies write a profile-scoped `registry-migration.json` receipt.
|
|
Subsequent runs preserve existing destination data. The storage and deployment
|
|
placement are passed to Argo through `registry_placement` Kustomize patches;
|
|
the scheduling preflight renders those same patches. Legacy PV/PVC names remain
|
|
stable to preserve existing Pimox deployments.
|
|
|
|
When serving locally, only firewall rules bearing Jeannie's exact
|
|
`homelab-pimox-registry-forward` comment are retired, together with the matching
|
|
forwarding service. If the local runtime is k3s, its registry configuration is
|
|
merged with the HTTP mirror needed for the existing registry endpoint. Existing
|
|
configuration is backed up; custom mirror endpoints are refused. The first
|
|
configuration change restarts k3s and waits for API readiness. Repeat runs avoid
|
|
that restart.
|
|
|
|
Discovery overrides, when inventory uses different locations:
|
|
|
|
- `LAB_PIMOX_REGISTRY_STORAGE_PATH`: previous registry directory.
|
|
- `LAB_REGISTRY_STORAGE_PATH`: local destination directory.
|
|
- `LAB_PIMOX_REGISTRY_SOURCE_VMID`: source VMID (defaults to worker base VMID).
|
|
|
|
Registry paths must be specific directories below `/data`. Migration requires
|
|
passwordless sudo on the destination, source worker and Proxmox host. This is a
|
|
copy, not ongoing replication or failover between registries.
|
|
|
|
Source reads and bulk transfer now pass through the configured Proxmox host.
|
|
An A/B test transferred 64 MiB successfully through that host while direct
|
|
worker-to-Debian SSH repeatedly failed MAC verification. Authentication remains
|
|
end-to-end and private keys stay on the deployment host.
|
|
Bulk transfer uses a fresh, non-multiplexed SSH connection with AES-256-GCM,
|
|
compression disabled and mandatory source/destination SHA-256 verification.
|
|
`LAB_REGISTRY_TRANSFER_CIPHER` can select another supported authenticated cipher
|
|
(`aes128-gcm@openssh.com` or `chacha20-poly1305@openssh.com`). Negotiation and
|
|
transfer errors are retained in private diagnostic files. A MAC/authentication
|
|
failure aborts transfer and never publishes partial storage. Repeated SSH MAC
|
|
errors, especially alongside TLS bad-record-MAC failures, require investigation
|
|
of the endpoints and network path; cipher selection alone does not prove that
|
|
the underlying issue is repaired.
|
|
|
|
There are exactly three canonical profiles:
|
|
|
|
| Profile | Control plane | Workers | Conflicting runtime requirements |
|
|
| --- | --- | --- | --- |
|
|
| `debian` | Laptop `.73`, kubeadm | Pimox VMs 9010/9011 | Host K3s stopped; VM 9001 stopped |
|
|
| `pimox` | Pimox VM 9001 at `.65`, kubeadm | Pimox VMs 9010/9011 | Laptop control plane and host K3s stopped |
|
|
| `k3s` | Native Orange Pi `.80` | Same host | Laptop control plane and every Pimox VM stopped |
|
|
|
|
Pimox remains installed on the Orange Pi. The direct-host installation requires
|
|
the declared hypervisor-host capability and checks that all VMs are stopped.
|
|
It does not remove Pimox or rewrite `vmbr0`. Packaged K3s Traefik, ServiceLB and
|
|
metrics-server are disabled so platform charts own those components.
|
|
|
|
`./jeannie cluster-runtime check` performs read-only SSH probes of physical host
|
|
services, API listeners and VM state. Deploy/start pipelines and guarded Tofu
|
|
mutations refuse active conflicts or unverifiable host state. Stop commands
|
|
remain available to resolve conflicts; pipelines do not kill another cluster or
|
|
remove its identity/state. The same check is exposed by the API allowlist.
|
|
Top-level deployment/start pipelines hold a shared lock across profiles until
|
|
they exit, preventing concurrent Jeannie deployments on the same controller.
|
|
Starting an enrolled, stopped cluster checks its pinned endpoint and CA offline;
|
|
the live namespace UID is checked after startup and before deployment mutations.
|
|
Manual VM/service starts outside Jeannie are not covered by the pipeline lock.
|
|
|
|
The accidentally installed laptop K3s cluster is not profile 3. Its service must
|
|
be stopped and its identity/state retained separately before enrolling the
|
|
Orange Pi cluster. Existing `.73` identity/state under `clusters/k3s` is never
|
|
automatically rebound to `.80`; endpoint/CA/UID mismatch guards remain active.
|
|
The old laptop kubeconfig can be retained, while native K3s uses
|
|
`/home/jv/.kube/opi5-k3s-config`.
|
|
|
|
The registry copy must be secured before switching to host K3s: migration cannot
|
|
boot a source VM while host K3s is active. The transition below prepares the remote
|
|
registry offline. Apps accepts it only when the receipt's host, node and path match
|
|
the live cluster; before the PV exists it also verifies the complete file manifest.
|
|
|
|
The native profile declares `storage.required_mount: /data`. Runtime/start guards,
|
|
offline publication and remote registry reconciliation require that exact
|
|
writable mount; an empty `/data` directory on eMMC is not a valid fallback.
|
|
Profiles without a declared separate mount retain their existing storage model.
|
|
The registry check compares host and running-pod filesystem/inode identities,
|
|
refusing a stale volume binding after an unmount/remount. It never recreates
|
|
missing data or restarts that pod to conceal the mismatch.
|
|
|
|
After these checks pass, Jeannie installs its own K3s systemd drop-in with
|
|
`RequiresMountsFor` and `ConditionPathIsMountPoint`, preserving other overrides.
|
|
It reloads unit metadata without restarting the live service. Future service
|
|
starts require the data mount; existing `/etc/fstab` device selection is not
|
|
rewritten. Missing, read-only or mismatched storage remains a blocking error.
|
|
|
|
## Retire the accidental laptop K3s installation
|
|
|
|
On the Debian deployment laptop, after pulling the updated repository:
|
|
|
|
```sh
|
|
./jeannie cluster-transition k3s-to-native
|
|
./jeannie cluster-transition k3s-to-native --yes
|
|
```
|
|
|
|
The first command prints the transition plan. The second performs the move and
|
|
runs cluster, platform and apps in sequence, stopping on failure. It requires
|
|
passwordless sudo and SSH access to the Orange Pi and source registry worker.
|
|
The declared native target must report ARM64. The old laptop kubeconfig defaults
|
|
to `~/.kube/k3s-config`; `--source-kubeconfig PATH` selects another explicit file.
|
|
Before stopping the old service, its CA and live `kube-system` UID must match its
|
|
existing pinned identity. Its private K3s workload process trees are stopped as well;
|
|
Docker and the system containerd are not stopped.
|
|
K3s intentionally leaves containers running when the service stops, as explained
|
|
in the [K3s stopping documentation](https://docs.k3s.io/upgrades/killall).
|
|
|
|
The stopped server configuration/datastore is archived under root-only
|
|
`/var/backups/jeannie-k3s-laptop-*`. Existing scoped identity/state moves to
|
|
`~/.local/share/homelab/retired-clusters/k3s-laptop-*`, with the old kubeconfig
|
|
retained. The original datastore and application volume directories are retained.
|
|
Only registry data is copied to the native host; other laptop PVC data is not
|
|
restored into the fresh cluster. The registry copy uses staging and full SHA-256
|
|
verification; different existing remote data blocks publication.
|
|
|
|
Pimox VMs are shut down gracefully, without forced stops or disk removal. The
|
|
source registry worker can be started temporarily before native K3s is installed
|
|
and is then shut down again. Native K3s receives its HTTP registry mirror before
|
|
startup. The new identity is enrolled only after comparing API CA/namespace UID
|
|
against reads made directly on the intended Orange Pi SSH host. The legacy
|
|
registry endpoint is forwarded to the live selected registry node for all profiles.
|
|
|
|
A private journal at `~/.local/share/homelab/transitions/k3s-to-native.json` records
|
|
completed phases. Repeat the same command after correcting a failure; it resumes
|
|
without archiving the new cluster as the laptop cluster. The global runtime lock
|
|
excludes other Jeannie deployment pipelines throughout the transition. The command
|
|
is API-allowlisted after rebuilding/deploying the Jeannie API server.
|
|
|
|
After completion, use the canonical target for subsequent commands:
|
|
|
|
```sh
|
|
export LAB_CLUSTER_PROFILE=k3s
|
|
export LAB_CLUSTER_RUNTIME=k3s
|
|
export TF_VAR_cluster_runtime=k3s
|
|
export KUBECONFIG="$HOME/.kube/opi5-k3s-config"
|
|
./jeannie cluster-context check
|
|
```
|