Skip to content
kix /docs
Install the CLI

Reference Instance schema

optional

Keep a configured instance dormant until another instance depends on it.

instances.platform.metrics = {
package = packages.prometheus;
optional = true;
config.retention = "30d";
};

An optional instance is available to dependency resolution but is omitted from the cluster unless a non-optional instance depends on it. This lets a cluster configure a provider without deploying it in clusters that do not use it.

PropertyValue
Typeboolean
Defaultfalse
Set atinstances.<namespace>.<name>.optional

Kix starts with every non-optional instance and follows its dependencies. An optional instance is activated when that dependency closure reaches it by:

  • a required build argument that matches its instance name, alias, default alias, or role;
  • an explicit deps.<argument> = ref.<namespace>.<instance>; or
  • a dependency of another optional instance that has already been activated.

An optional build argument (x ? null) activates nothing, and a dormant optional instance or import does not answer it, so the argument is null unless an active instance answers it. An activated import emits its PackageInstance marker, so the deploy waits for the resource the import names.

An activated optional instance is evaluated and deployed like any other instance. A dormant one contributes no manifests.

If several optional instances answer the same dependency name, Kix prefers a managed instance over an import and an instance in the consumer’s namespace over one elsewhere. More than one candidate at the preferred level is an error. Use an explicit deps reference to choose one.

optional describes the instance, not a package function argument. A build argument with a default value is a separate feature: the package can evaluate when no provider exists for that argument.