How-to guide / Debug dependency wiring
Debug a missing dependency
These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.
A package declares required dependencies through the arguments to its build functions. When Kix cannot resolve one of those arguments, evaluation stops before any manifests are deployed.
Read the missing argument
Section titled “Read the missing argument”Run the cluster checks:
❱ kix check 06-service-dep
tutorial-06/gateway: dependency 'backend' has no matching instance in namespace 'tutorial-06'.
Fix: Declare an instance named 'backend' in namespace 'tutorial-06':
instances.tutorial-06.backend.package = packages.<package>;
If another instance in 'tutorial-06' provides 'backend', wire it in instances.tutorial-06.gateway:
deps.backend = ref.tutorial-06.<instance>;
(exit code: 1) The diagnostic identifies backend as the unresolved build argument and
names the consuming instance’s namespace. Start with that argument name, not
the Kubernetes resources the package would have rendered.
Check the package declaration
Section titled “Check the package declaration”Find the build entry that accepts the missing argument:
1build = { backend, ... }: {2 # Resources that read backend.out values.3};An argument without a default is required. An argument such as
backend ? null is optional and does not cause this error when no provider is
available.
Check the available instances
Section titled “Check the available instances”Kix first looks for an eligible instance with the same name or alias in the consumer’s namespace. Check the cluster definition for spelling changes and for an instance that was removed or moved.
If the intended provider has another name or lives in another namespace, wire
it explicitly. When the only match is in another namespace, the error already
prints the line to add (To use it, add this line to instances.<namespace>.<instance>:),
and when several namespaces answer the name it prints one line per instance:
1instances.apps.gateway = {2 package = packages.gateway;3 deps.backend = ref.platform.api;4};The key after deps must match the build argument. The reference selects the
provider by namespace and instance name.
Run the checks again after correcting the name or wiring:
❱ kix check 06-service-dep
TOOL RESULT DETAILS
eval pass 13 manifests evaluated
scorecard pass 0 errors, 6 warnings, 1 info
governance.hasOwner (warning), 1:
tutorial-06/gateway: package 'gateway' has no meta.owner
reliability.boundedResources (warning), 1:
tutorial-06/gateway/gateway: container 'nginx' is missing resource settings: requests.cpu, requests.memory, limits.cpu, limits.memory. Set CPU and memory requests and limits. Without a memory limit, a workload can exhaust the node's memory.
reliability.hasProbes (warning), 1:
tutorial-06/gateway/gateway: container 'nginx' has no livenessProbe
security.hasNetworkPolicy (warning), 1:
tutorial-06: namespace 'tutorial-06' has workloads but no network policy
security.nonRoot (warning), 1:
tutorial-06/gateway/gateway: container 'nginx' may run as root: neither it nor the pod sets securityContext.runAsNonRoot, and no non-zero runAsUser resolves for it
security.readOnlyRootfs (warning), 1:
tutorial-06/gateway/gateway: container 'nginx' does not set readOnlyRootFilesystem
1 info finding(s) not listed; run with -v to list them. If Kix reports that the argument matches multiple instances instead, add the
same kind of explicit deps entry to the consumer, naming the provider it
should use. See
Use aliases and default aliases
for how names and aliases collide.