Skip to main content

Module drivers

Module drivers 

Source
Expand description

Cluster driver and deployer registration.

Port of the side effect Go gets for free from each driver and deployer package’s func init() (see internal/cluster/{colima,k3d,vcluster, external,auto}/driver.go and internal/deployer/{helm,kustomize, namespace}/manager.go): registering itself with the matching registry just by being imported. Rust has no import-time side effects, so xianyun-cli — the one binary that actually needs everything wired up — does the registration explicitly, once per process.

Without the deployer half, deployer::registry::new_manager fails with UnknownType for every configured deployer, so up and deploy can install nothing (GAP-001 in the specification).

Test binaries need this too (a caproni.yaml with cluster.driver: mock has to resolve to something), so ensure_registered is public and idempotent rather than being private, main-only setup.

Functions§

ensure_registered
Registers every built-in cluster driver with xianyun_cluster’s registry, and every built-in deployer (helm, kustomize, namespace) with xianyun_deploy’s. Safe to call from multiple test binaries and multiple times within the same process; only the first call does anything.