Wire cross-namespace dependencies explicitly
This content is for the v0.1 version. Switch to the latest version for up-to-date documentation.
Use an explicit deps entry when a package consumes an instance in another
namespace. The wiring remains visible beside the consuming instance, and the
package still receives the dependency through its build argument.
This guide assumes the package already declares the dependency by naming it in
a build function, such as { backend, ... }: ....
Accept ref in the cluster module
Section titled “Accept ref in the cluster module”Define the module that contains the instances as a function with a ref
argument:
modules = [ ( { ref, ... }: { # Namespace and instance configuration goes here. } )];ref mirrors the instances.<namespace>.<name> tree. Each leaf identifies
one package instance.
Wire the dependency
Section titled “Wire the dependency”Set deps.<argument-name> on the consuming instance. This tested example
wires an application gateway to a backend in the platform namespace:
gateway = { package = reverseProxyPackage; # Explicit cross-namespace wiring keeps the boundary # crossing visible at the call site. deps.backend = ref.platform.backend; };The left side, deps.backend, matches the package’s backend build argument.
The right side, ref.platform.backend, selects the exact provider instance.
Add the provider instance under the referenced namespace as usual:
instances.platform.backend = { package = packages.echo-server; config.message = "Hello from the platform backend";};Check the wiring
Section titled “Check the wiring”Evaluate the cluster:
❱ kix check 08-namespace-deps
TOOL RESULT DETAILS
eval pass 15 manifests evaluated
kubeconform pass skipped (this validation tool is not yet integrated with Kix)
pluto pass skipped (this validation tool is not yet integrated with Kix)
kyverno pass skipped (this validation tool is not yet integrated with Kix)
scorecard pass 0 errors, 10 warnings, 2 info A missing reference fails module evaluation. If the package declares another
required build argument without a matching deps entry or resolvable
provider, dependency resolution names the missing argument.