Orbit Deploy application logic ============================== 1. Watch OrbitDeployments and reconcile each in its worker thread. - Isolate failed registrations/reloads by OD; failed starts stay pending for retry. - Fetch the configured Git repository/ref/path and load its Secret. - Reject missing named refs; never substitute stale local branches/tags. - Inherit deployment.json values, resolve OCI image tokens and render YAML. - Preserve existing namespace scope, priority arbitration and status behaviour. 2. Build the whole desired inventory before workload application. - Evaluate conditionals and tokens, parse every document and resolve its API. - Report malformed YAML/resource shape and missing APIs/CRDs per item while independent valid manifests continue. A YAML stream cannot resume after a parser error; continue other files. Every item failure blocks pruning. - Missing paths, uncertain discovery/conditional lists and namespace violations still abort. Directory/metadata access errors propagate. - Canonical identity is API group/kind/namespace/name, independent of served version. - Reject duplicate desired identities, even exact copies, naming both source locations. 3. Apply through the shared write-through owner ConfigMap. - Owner identity is deployment namespace/name plus priority. Higher priority wins; a missing live object permits replacing a stale claim. - Refresh ConfigMap authority under one lock for each transaction. Perform the object mutation and persist ownership with a ConfigMap resourceVersion check. - Failed/malformed ownership reads or failed writes stop the operation. A monitor reloads unexpected external ConfigMap changes. - Only no-update/noupdate in the rendered Git manifest blocks in-place update/replace. Removing or disabling it in Git resumes updates; live-only flags are ignored. Creation is allowed. no-delete alone does not prevent updates. - Recreate-on-change deletes the verified old tracked reference before creating the replacement; only the old target's live no-delete blocks that DELETE. 4. Automatically prune after complete successful processing. - Compare OD status tracking with desired canonical identities. Delete the recorded old address, never a hypothetical replacement address. - For each absent identity, refresh current ownership and read the live target. - Delete only when the ConfigMap owner matches this deployment and the target has no live no-delete/nodelete flag. UID/resourceVersion are API preconditions, not additional owner identity. Clear ownership synchronously after deletion. - Source uncertainty or apply failure skips pruning. No workload readiness, approval workflow or extra prune policy is involved. - Normal removal retains protected targets but releases tracking/ownership; blocked recreation retains tracking. Namespace/CRD deletion does not scan descendants. 5. Persist managedObjects/errors/lastRun separately from spec updates. - Parse metadata.creationTimestamp for API creation time and the age metric only. - Self-referential spec changes must not be overwritten by status persistence. - Report progress during load, Git, images, apply, prune and store. - Stop and join retired workers before replacement. If forced retirement remains blocked, terminate the controller process for Kubernetes to restart. - The supplied Deployment uses Recreate to avoid overlapping controllers. 6. On confirmed OrbitDeployment deletion, make one best-effort cleanup pass. - Check source absence, tenant scope, current ConfigMap owner and live no-delete. - Skip existing/recreated CRs and uncertain reads. No finalizer/durable retry queue. 7. Offline lint uses a local source tree, simulated defaults and image hashes. - Share parsing and duplicate-identity checks, with one inventory per followed OD. - It does not contact Kubernetes/registries or establish live deletion authority. - See README.md, LINTER.md and docs/deployment-safety.md for behaviour and limits. - See docs/diagnostics.md for single-line action-prefixed errors and source context.