Configuration and API reference

Documentation home · Administrator guide · Tenant guide

This reference describes the implementation in this repository. The installed controller image and CRD should be kept consistent with it. Examples use placeholder source URLs and domains.

OrbitDeployment resource

apiVersion: k8s.tlspu.com/v1
kind: OrbitDeployment
metadata:
  name: web
  namespace: team-a
spec:
  source: https://git.example.com/team-a/web-deployments.git
  secret: web-source
  path: default
  ref: refs/heads/main
  pause: false
  replacements:
    environment: production
  images:
    web-image: registry.example.com/team-a/web:release-1.2.0
Field Type/default Meaning
metadata.namespace Kubernetes namespace Determines scope: kube-system is unrestricted; all other namespaces use tenant mode.
spec.source Required string Git URL. The CRD accepts HTTP(S), git://, ssh:// and scp-style SSH source syntax.
spec.secret Optional string Name of a same-namespace Secret used for Git and OCI credentials.
spec.path String, default Starting directory inside the repository. Runtime also normalizes a missing/blank path to default. . selects the root.
spec.ref Optional string Branch, tag, explicit ref or available historical commit. Missing/blank/HEAD selects the remote default branch.
spec.pause Boolean, false Skip source processing on subsequent iterations while retaining the worker and workloads.
spec.replacements String map Deployment-specific token overrides.
spec.images String map Image declarations/overrides applied throughout the selected source tree.
status.lastRun Timestamp string Last successful status persistence timestamp; not a readiness condition.
status.errors Object-key/message map Recorded object errors. Logs also contain failures outside object application.
status.managedObjects Object-key/hash map Desired-manifest hashes for successfully managed objects.

The supplied CRD has no status subresource declaration. Status is patched on the resource using merge-patch. There is no Ready condition, health gate, sync approval field or configurable prune policy. Printer columns are convenience output; use the actual maps or console for entry counts.

Ref values admitted by the CRD use letters, digits, ., _, / and -. Runtime checks also validate full ref names. Avoid ambiguous bare 4–40-character hexadecimal names; use explicit branch/tag refs. See the source selection guidance.

Source metadata and substitution

deployment.json accepts images and replacements mappings. They are inherited downward from the selected source directory; a file outside that processed tree is not an implicit default. Children override inherited declarations.

Syntax Meaning
<!token!> Substitute image, OD override or directory/default replacement, in that precedence order.
<!image-hash!> Generated hash token for image named image, unless an explicit replacement supplies it.
<!ifod name!>…<!endifod!> Include when a live OD of that name exists in the worker namespace or kube-system.
<!ifnotod name!>…<!endifod!> Include when that name is absent from those checked namespaces.

Only .yaml and .yml workload files are parsed. YAML can contain multiple documents; empty documents are ignored. Invalid resource identity/metadata, duplicate explicit YAML keys and YAML syntax errors are logged while valid documents/files continue. API discovery failures (including missing CRDs, timeouts and access errors) and individual Kubernetes rejections likewise skip only the affected item. An unreadable YAML stream cannot resume after its parse error. All these failures block automatic pruning. Unresolved/circular tokens, invalid tenant scope, duplicate desired identities and uncertain source reads still abort inventory processing. Lint shares parsing rules but supplies simulated cluster and registry inputs. Duplicate desired identity means the same API group, kind, effective namespace and name, including across served versions and even for exact copies. The diagnostic names both source locations; separate ODs have separate inventories.

Annotations and labels

These annotations belong on the actual managed object's metadata, not only on its Pod template. Flag truth values are true, 1, yes and on, ignoring case and surrounding whitespace; either truthy alias enables its protection.

Key Read from Behavior
k8s.tlspu.com/priority Desired manifest Integer ownership priority. Default 1; invalid input is logged and uses 1. A different current owner with equal/higher priority prevents takeover of an existing object.
k8s.tlspu.com/no-update Rendered Git manifest only Blocks ordinary in-place replace of existing objects. Remove or disable in Git to resume updates; live-only flags are ignored. Does not block creation or recreation DELETE. Alias: k8s.tlspu.com/noupdate.
k8s.tlspu.com/no-delete Live object Blocks Orbit DELETE of that target during prune, recreate and cleanup. Alias: k8s.tlspu.com/nodelete.
k8s.tlspu.com/recreate-on-change Desired or live object Changes trigger DELETE then CREATE for a previously managed, owned object. Old live no-delete blocks deletion; desired-only protection does not protect the old target.
k8s.tlspu.com/applied-manifest Controller-written annotation Deployment namespace/name plus desired hash, persisted with CREATE/REPLACE to recognize completed application despite stale status. Not ownership authority.
k8s.tlspu.com/original-image Controller-written label Sanitized project/tag provenance for manifests that use image tokens. Subject to Kubernetes label length/character limits.

No-delete does not prevent an otherwise permitted update from removing it. Normal protected removal retains the target and releases tracking/ownership; blocked recreation keeps tracking. Flags do not intercept direct Kubernetes deletes or Kubernetes Namespace/CRD cascades. See deployment safety.

Credential Secret fields

The optional spec.secret refers to an Opaque Secret in the OD's namespace. Use stringData for plain input or correctly base64-encoded data.

Key Meaning
username HTTPS Git user; optional SSH user when not provided by the URL.
password HTTPS Git password/access token.
sshPrivateKey SSH private-key text.
sshPasshrase Optional encrypted-key passphrase; spelling is intentional compatibility behavior.
sshKnownHosts Optional OpenSSH known-host entries. Empty/missing means host verification is disabled.
Registry hostname, e.g. registry.example.com OCI credential string username:password, split on its first colon. Proxy hosts use their own entry.

Orbit does not consume Kubernetes .dockerconfigjson as its OCI resolution credentials. imagePullSecrets for workloads are configured separately. The current host:port credential-key format is not representable by valid Secret keys, and native Basic registry authentication is tracked as unsupported; see known limitations.

Cluster ConfigMaps

ConfigMap in kube-system Data Loading behavior
orbit-deploy String key/value replacement tokens Read at controller startup; overrides learned cluster tokens. Restart the process after changes.
orbit-deploy-registries proxies: YAML/JSON map; insecure: YAML/JSON list Loaded at startup and refreshed every 60 seconds. Missing means default policy; refresh failures retain the last valid policy.
orbit-deployment-owners owners.json: JSON authority map Created when needed, refreshed for transactions, synchronously written with resourceVersion checks; background monitor polls every 5 seconds.

Default replacement tokens are domain (node hostname suffix or localhost), addresses (JSON internal-node-address list) and external_addresses (JSON external-node-address list). An enabled, resolved embedded registry also supplies internal_registry.

Proxy mappings use registry or registry/path prefixes without schemes or trailing slashes. Exact path-boundary matching and longest-prefix selection apply. External insecure exceptions require exact lowercase hostnames or IPv4 addresses without ports or paths, applying to that hostname on any port. Read the administrator policy procedure before modifying these maps. Ownership data is authoritative state, not a cache to delete when troubleshooting.

Runtime settings

Container entrypoint: python3 -u /app/controller.py. Normal startup uses in-cluster Kubernetes configuration unless --kubeconfig is provided. Lint exits before initializing cluster clients or HTTP listeners.

CLI option Environment/default Purpose
--kubeconfig PATH In-cluster configuration by default Select a kubeconfig for an explicitly configured external run.
--http-listen HOST:PORT ORBIT_HTTP_LISTEN, 0.0.0.0:8080 Admin UI/API/metrics bind. Explicit CLI empty string disables it. A blank environment value falls back to the default.
--internal-registry ORBIT_INTERNAL_REGISTRY_ENABLED, false Enable the optional embedded registry. Environment truth values: 1, true, yes, on.
--internal-registry-root PATH ORBIT_INTERNAL_REGISTRY_ROOT, /registry Embedded-registry filesystem storage.
--internal-registry-listen HOST:PORT ORBIT_INTERNAL_REGISTRY_LISTEN, 0.0.0.0:5000 Separate OCI registry listener.
--internal-registry-service NAME ORBIT_INTERNAL_REGISTRY_SERVICE, orbit-deploy-registry Service for registry addressing; accepts NAME or NAMESPACE/NAME.
--internal-registry-service-port PORT ORBIT_INTERNAL_REGISTRY_SERVICE_PORT, unset Override Service port; otherwise use registry listen port.
--internal-registry-host HOST:PORT ORBIT_INTERNAL_REGISTRY_HOST, unset Explicit registry address override; can include HTTP(S) scheme.
--lint URL PATH [tokens] No environment equivalent Offline lint. Tokens are comma-separated name=value pairs.
Other environment variable Default Purpose
POD_NAMESPACE kube-system Default namespace when resolving the registry Service. Set from the Pod metadata in the installation.
POD_IP Unset Pod address used in registry address resolution. Set from Pod status in the installation.
ORBIT_WORKER_WATCHDOG true Enable stuck-worker detection.
ORBIT_WORKER_WATCHDOG_INTERVAL 60 seconds Interval between watchdog checks.
ORBIT_WORKER_STUCK_SECONDS 1800 seconds In-progress run's maximum reported inactivity before forced restart.
REQUESTS_CA_BUNDLE Normal requests trust configuration PEM CA bundle for the OCI HTTP client.
ORBIT_REGISTRY_CRL_BUNDLE Unset PEM CRLs enabling OpenSSL full-chain CRL checks on verified OCI requests.

The worker's 30-second post-iteration delay and 120-second retirement join timeout are implementation constants, not exposed settings. Kubernetes dynamic requests default to a 5-second connect and 30-second read timeout; explicit caller timeouts can override them. SSH transfers use isolated key/trust files and OpenSSH connection/keepalive controls. There is no global transactional deadline guaranteeing every pass completes in a fixed time.

Admin HTTP API

Default base address is the internal Service on port 8080. The API has no built-in authentication or per-namespace authorization. Use a controlled access path. The following local examples assume an authorized port-forward.

Method Path Result
GET / Redirect to /ui/.
GET /ui/ Console HTML; assets are served below /ui/.
GET /api/deployments Object with deployments, an array of worker snapshots.
GET /api/deployments/<namespace>/<name> Full worker snapshot, or 404 not_found.
GET /api/deployments/<namespace>/<name>?fields=errors,managed_objects Reduced snapshot plus requested maps.
POST /api/deployments/<namespace>/<name>/pause Persist spec.pause=true; returns ok and pause.
POST /api/deployments/<namespace>/<name>/unpause Persist spec.pause=false; returns ok and pause.
POST /api/deployments/<namespace>/<name>/errors/clear Clear recorded errors; returns {"ok":true}.
POST /api/deployments/<namespace>/<name>/purge Preserve ownership, clear tracking/errors and request reapplication; returns {"ok":true}.
POST /api/deployments/<namespace>/<name>/restart Force worker retirement/replacement; returns {"ok":true} or 404 not_found_or_raced.
GET /api/registry/service Registry address configuration; returns {"enabled":false} when disabled.
GET /api/registry/images Referenced image list and per-deployment image snapshots, plus unique count.
GET /api/registry/summary Embedded-registry summary, only registered when registry is enabled.
GET /api/registry/repositories Embedded repository detail list, only when enabled.
GET /api/registry/repositories/<repository> Embedded repository details, or 404 not_found, only when enabled.
GET /metrics Prometheus exposition; /metrics/ is also accepted.

POST actions require no request body. Missing workers return 404. Pause/unpause write failures return 503 pause_update_failed; other unhandled action failures can return a server error. A successful response means the action request completed, not that a workload rollout succeeded.

Full snapshot fields:

Field Meaning
namespace, name OD identity.
alive Whether the worker thread is alive.
pause In-memory pause state, reflecting loaded/persisted spec.
source, path, ref Current source selection.
last_run ISO timestamp of the last successful status write, or null when unknown.
created Timezone-bearing ISO timestamp parsed from the OD's Kubernetes metadata.creationTimestamp, or null when unknown.
errors, managed_objects Worker maps. API uses snake_case; Kubernetes status uses managedObjects.
phase Latest progress phase.
run_in_progress Whether an iteration is running.
seconds_since_activity Elapsed seconds since a reported worker heartbeat.

The fields query retains namespace/name, alive, pause and last_run, adding only the recognized requested maps. It does not preserve all other snapshot metadata.

curl --fail http://127.0.0.1:8080/api/deployments
curl --fail 'http://127.0.0.1:8080/api/deployments/team-a/web?fields=errors,managed_objects'
curl --fail -X POST http://127.0.0.1:8080/api/deployments/team-a/web/pause

The separate optional registry listener serves OCI /v2/* routes, including pull and upload operations. They are not mounted on the admin listener. Read-only /api/registry/* browse views do not make the OCI listener read-only.

Prometheus metrics

Metrics are updated from controller/worker snapshots when scraped. Per-worker series carry namespace and name labels and are removed when workers leave.

Metric Type/meaning
orbit_deploy_active_workers Gauge: registered worker count.
orbit_deploy_error_map_entries_total Gauge despite suffix: current recorded error-key count.
orbit_deploy_managed_object_map_entries_total Gauge despite suffix: current managed-key count.
orbit_deploy_reconcile_runs_total{result} Counter: success, paused, nosource, error iteration results.
orbit_deploy_reconcile_duration_seconds Histogram: iteration duration.
orbit_deploy_watchdog_restarts_total{namespace,name} Counter: successful watchdog-triggered worker restart requests.
orbit_deploy_image_cache_actions_total{action} Counter: source pin/cache actions, including failures. Present even with cache disabled.
orbit_deploy_ownership_operations_total Counter: ownership refresh/write operation results.
orbit_deploy_referenced_images_total Gauge: unique referenced images across workers.
orbit_deploy_referenced_image_entries_total Gauge: sum of image-list entries across workers.
orbit_deploy_seconds_since_last_run Per-worker gauge: seconds since stored run, -1 if unknown.
orbit_deploy_seconds_since_created Per-worker gauge: seconds since OD metadata.creationTimestamp, -1 if unknown; unrelated to watchdog inactivity.
orbit_deploy_managed_objects Per-worker gauge: tracked map entries.
orbit_deploy_error_objects Per-worker gauge: recorded error-map entries.
orbit_deploy_owned_objects Per-worker gauge: objects currently attributed by shared ownership.
orbit_deploy_paused Per-worker gauge: 1 paused, 0 otherwise.
orbit_deploy_worker_alive Per-worker gauge: 1 alive, 0 otherwise.
orbit_deploy_referenced_images Per-worker gauge: unique referenced images.
orbit_deploy_run_in_progress Per-worker gauge: 1 during iteration, 0 otherwise.
orbit_deploy_seconds_since_activity Per-worker gauge: seconds since progress heartbeat.
orbit_deploy_registry_enabled, orbit_deploy_registry_healthy Gauges: embedded-registry flags.
orbit_deploy_registry_repositories_total, orbit_deploy_registry_tags_total Gauges: embedded-registry counts.
orbit_deploy_registry_blob_bytes_total Gauge: embedded blob storage bytes.

Registry gauges are set to zero when the embedded registry is absent. Counters and in-memory snapshots restart with the process; use stored monitoring data for historical analysis. A scrape can fail if required ownership reads fail. Metrics and map counts are not readiness or application SLO measurements.

  • Source validation and automatic pruning are described in deployment safety.
  • Deleted-OD cleanup has one attempt and no durable retry/finalizer guarantee.
  • Namespace/CRD deletion can cascade through children independently of their flags.
  • API-group aliases, OCI digest/authentication gaps and admin clear/purge races are tracked in TODO.md. Avoid ambiguous bare hexadecimal refs as documented above.
  • Optional-registry limitations are parked in INTERNAL_REGISTRY_TODO.md.
  • The internal registry is disabled by default; enabling it does not configure persistent storage, node trust or access control automatically.

See diagnostics for error prefixes and source locations, and Kubernetes state for ownership/status persistence details.