How-to guide Debug dependency wiring
Use aliases and default aliases
Make a package instance resolvable under a stable dependency name.
Use an alias when a package should satisfy a dependency name that differs from its instance name. Put a reusable default on the package, or set an alias on one instance when the mapping belongs to a particular cluster.
Declare a package default alias
Section titled “Declare a package default alias”Add meta.defaultAliases when every instance of a package provides the same
kind of dependency. A persistent-volume package can advertise itself as
storage even when cluster authors choose names such as data or uploads:
{ meta = { version = "1.0.0"; defaultAliases = [ "storage" ]; };
build = { ... }: { # Package resources. };}A consumer declares the alias as its build argument:
build = { storage, ... }: { dataMount = kix.mount.pvc storage { mountPath = "/data"; }; # Other package resources.};The cluster can now give the provider a task-specific instance name:
instances.apps.data = { package = packages.persistent-volume;};Kix indexes the instance under both data and storage.
Set aliases on one instance
Section titled “Set aliases on one instance”Use the instance’s aliases field when the name applies only in this cluster:
instances.apps.redis-primary = { package = packages.valkey; aliases = [ "cache" ];};A package with a required cache build argument can now resolve this
instance.
A non-empty instance alias list replaces meta.defaultAliases for that
instance. Include any package defaults you still need:
aliases = [ "cache" "valkey" ];Package roles remain available as aliases even when instance aliases replace the defaults.
Check for collisions
Section titled “Check for collisions”Evaluate the cluster after adding an alias:
❱ kix check production If more than one instance in the consumer’s namespace has the requested name or alias, Kix reports that the dependency matches multiple instances. Wire that consumer to the provider it should use:
instances.apps.web = { package = packages.web; deps.cache = ref.apps.redis-primary;};This records the choice at the consumer, where the dependency is easiest to understand.
Aliases can also make two availablePackages entries answer one name. See
Choose between catalog packages that answer one name.