Reference / Package authoring
Package anatomy
These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.
A Kix package is a reusable blueprint for an application or cluster service. It declares the settings operators can customize (options), the other services it needs (build arguments), and the Kubernetes objects it creates (build). Reach for this page when you are writing a new package from scratch or adding typed configuration options to an existing one.
1{2 scope,3 lib,4 kix,5 availability,6 ...7}:8
9{10 meta = {11 version = "1.10.0";12 description = "HTTP echo server for testing";13 availability.max = "node";14 };15
16 options = {17 image = kix.options.image {18 repository = "hashicorp/http-echo";19 tag = "1.0.0";20 digest = "sha256:fcb74f691c8b0bd1ebff992c0a3ce2bf29f61ccb2f3d85fe72c4bd8b34e05061";21 };22 replicas = lib.mkOption {23 type = lib.types.ints.positive;24 default = kix.availability.pick availability {25 none = 1;26 pod = 2;27 node = 3;28 zone = 3;29 };30 description = "Number of echo server pods.";31 };32 resources = kix.options.resources {33 requests = {34 cpu = "50m";35 memory = "64Mi";36 };37 limits.memory = "64Mi";38 };39 ingress = kix.options.ingress;40 };41
42 build = [43 (44 { self, config }:45 {46 deployment = scope.mkDeployment {47 name = "echo";48 spec = {49 replicas = config.replicas;50 selector.matchLabels = scope.selectorLabels;51 template.spec.containers = [52 {53 name = "echo";54 image = kix.image.ref config.image;55 ports = [ (kix.port "http" 5678) ];56 resources = config.resources;57 }58 ];59 };60 };61
62 service = scope.mkResource (63 kix.service.fromWorkload { name = "echo"; } self.deployment64 );65
66 root = self.service;67 }68 )69
70 (kix.expose { service = "service"; })71 ];72}Root function and return shape
Section titled “Root function and return shape”A package file is either a Nix function taking system arguments or a plain attribute set containing a build attribute.
When written as a function, Kix calls it with four Phase 1 arguments before evaluating options:
| Outer argument | Type | Description |
|---|---|---|
scope | attrset | Instance-scoped builders (mkResource, mkDeployment, mkSecret, mkCRD, forNamespace, selectorLabels, and related helpers). |
lib | attrset | Standard nixpkgs.lib. |
kix | attrset | Framework helpers (kix.options, kix.availability, kix.image, kix.expose, kix.monitor, kix.mount, kix.contracts, and related helpers). |
availability | string | Effective availability level for the instance ("none", "pod", "node", or "zone"), clamped to meta.availability.max. Map it to replica counts or settings with kix.availability.pick availability { none = ...; pod = ...; node = ...; zone = ...; } and kix.availability.atLeast "<min>" availability. |
Include ... in the outer function header ({ scope, lib, kix, ... }:) so the package accepts future framework arguments. Do not declare cross-package dependencies in the outer function header; declare them in build entries instead.
Top-level package attributes
Section titled “Top-level package attributes”The package returns an attribute set with the following top-level keys:
| Attribute | Type | Required | Description |
|---|---|---|---|
meta | attrset | No | Package metadata, platform role declarations, availability ceiling, compatibility bounds, and network intents. |
options | attrset | No | NixOS module option declarations (lib.mkOption or kix.options.*) exposed to instances.<name>.config. |
config | attrset or module function | No | Package-level configuration module merged with options. Values inside config that the author wraps in lib.mkDefault are lowered from priority 1000 to 1250 (between option defaults at 1500 and instance or injected lib.mkDefault values at 1000). |
deps | attrset | No | Per-dependency configuration injection (config), warnings, and assertions keyed by build argument name. |
build | function or list of functions | Yes | One or more functions returning named resource parts and a root entry. |
warnings | { config, self, deps, clusterConfig }: [ string or attrset ] | No | Warnings shown when Kix evaluates the cluster or reads a bundle with --bundle. |
assertions | { config, self, deps, clusterConfig }: [ { assertion; message; fix ? null; id ? null; option ? null; } ] | No | Evaluation-time assertions checked before building manifests. |
The root entry and part reachability
Section titled “The root entry and part reachability”Across all build entries, the merged parts attribute set must define root. root designates the primary entry point of the package and determines what downstream packages receive when they depend on this instance.
root accepts either a direct resource or an extended attribute set:
1# Direct resource2root = self.service;3
4# Extended root with extra dependencies, post-deploy hooks, and custom outputs5root = {6 resource = self.service;7 requires = [ self.migrationJob ];8 postHooks = [ self.smokeTest ];9 out = {10 endpoint = "http://${self.service.out.fqdn}:8080";11 };12};root field | Type | Default | Description |
|---|---|---|---|
resource | resource | Required | Primary resource of the package. Must also be assigned to a named attribute in build (for example, service = ...; root = self.service;). |
requires | list of resources | [ ] | Additional resources that must be ready before the package instance is considered ready. |
postHooks | list of resources | [ ] | Post-deployment resources (such as kix.healthCheck jobs) that run after root.resource and requires are ready. |
out | attrset | { } | Extra fields merged onto root.resource.out and promoted to the top level of the dependency object passed to consumers. |
Every resource defined in build must be reachable from root.resource, root.requires, or root.postHooks (either because root depends on it through .out string context or requires, or because it depends on a reachable resource such as an RBAC RoleBinding referencing a reachable ServiceAccount). Resources that are disconnected from root emit an orphaned-resource warning during evaluation.
root.requires and a resource’s own requires order different things. A resource’s requires becomes a kix.run/depends-on annotation on that resource, so deploy applies it after the listed resources are ready. root.requires extends the dependencies of the package’s PackageInstance, so consumers of the package wait for the listed resources, but nothing inside the package does. An operator that watches kinds its own package defines therefore puts the CRDs in the controller’s requires (requires = builtins.attrValues self.crds; on the mkDeployment call). With the CRDs only in root.requires, a first deploy can start the controller before the API server serves its kinds, and the controller crashes and restarts until it does. The scorecard rule architecture.controllerRequiresCrds warns about this shape.
meta declares static package properties that Kix inspects during dependency binding, cluster validation, and scorecard evaluation.
1meta = {2 version = "2.51.0";3 description = "Prometheus monitoring system and time series database";4 roles = [ "metricsApi" ];5 defaultAliases = [ "monitoring" ];6 availability.max = "node";7 podSecurity = "restricted";8 lifecycle = "stateful";9 owner = "platform-observability";10 annotationDomains = [ "monitoring.coreos.com" ];11 compatibleWith.grafana = {12 minVersion = "10.0.0";13 reason = "Requires Grafana 10+ data source provisioning format";14 };15 k8s = {16 minVersion = "1.28";17 reason = "The CRDs use a validation rule added in Kubernetes 1.28";18 supported = {19 minVersion = "1.30";20 maxVersion = "1.32";21 source = "the compatibility table in the upstream README";22 };23 };24};Summary of meta fields
Section titled “Summary of meta fields”| Field | Type | Default | Description |
|---|---|---|---|
version | string | None | Upstream software version the package deploys by default ([vV]?<digits>(.<digits>)*[-<suffix>][+<build>]). An instance reports it unless the package builds an out.version. See The version an instance reports. |
description | string | None | Non-empty one-line summary of the package. Checked by the governance.hasDescription scorecard rule (info severity). |
roles | list of strings | [ ] | Platform capabilities provided by this package. |
defaultAliases | list of strings | [ ] | Default dependency-injection names registered when instances.<name>.aliases is empty. |
availability | { max; reason?; } | None | Highest availability level the package supports (max: "none", "pod", "node", or "zone"), plus an optional reason string shown when Kix caps availability or rejects multiple replicas under "none". |
compatibleWith | attrset of { minVersion?; maxVersion?; reason?; } | { } | Version bounds for upstream dependencies keyed by dependency argument name. |
k8s | { minVersion?; maxVersion?; reason?; supported?; } | None | Kubernetes version bounds checked against k8sVersion. Top-level minVersion and maxVersion fail the build outside that range; supported = { minVersion?; maxVersion?; source?; } emits a warning without stopping the build. |
conflictsWith | list of strings or { key; reason; } | [ ] | Packages that cannot coexist with this package ("<name>" for same-namespace, "cluster:<name>" for cluster-wide), with an optional reason included in conflict errors. |
podSecurity | "privileged" | "baseline" | "restricted" | None | Pod Security Standards enforcement level applied to the instance namespace. |
unsafe | list of strings | [ ] | Acknowledged security or architectural exceptions ("raw-pvc", "host-network", "privileged", "run-as-root", "cluster-admin"). |
annotationDomains | list of strings | [ ] | Annotation domain prefixes (such as "cert-manager.io") owned and consumed by this package. |
dnsPeers | list | unset | DNS endpoints allowed on UDP and TCP port 53 by generated network policies when this package claims the "dns" role. Each entry is { namespace?; podSelector; } (namespace defaults to the instance’s namespace) or { cidr; } (rejected by the cilium enforcer). When unset, policies allow pods labeled k8s-app: kube-dns in kube-system. See DNS peers. |
network | attrset | { } | Ambient network intents (intents.<part>.{egress,ingress}) and externalIngressEntities. |
lifecycle | "stateful" | None | Marks the PackageInstance with kix.run/lifecycle: stateful. |
scope | "cluster" | "namespace" | unset | "cluster": consumers in every namespace find an instance by name, and auto-instantiation places the package once per cluster in autoNamespace or the catalog entry’s namespace (without either, evaluation fails; declare the instance under instances or set autoNamespace). "namespace": an instance is never used from another namespace, not even with ref. Unset: an instance in another namespace is used only when the consumer names it with deps.<arg> = ref.<namespace>.<instance>. Packages that claim a role or declare a cluster: conflict still serve the whole cluster, as do instances that Kix creates from availablePackages or enables via optional = true to satisfy a dependency. A kix.mkImport stand-in defaults to "cluster". |
owner | string | None | Team or owner identifier used by governance.hasOwner and byOwner policy rules. Built-in packages use "platform" for cluster infrastructure and "app-team" for applications, so you can set different rule severities for each. |
deprecated | { message; replacement?; } | None | Emits an evaluation warning when the package is instantiated. |
meta.version
Section titled “meta.version”Set meta.version to the software version the package deploys by default, such as "1.30.6" for nginx 1.30.6. Define the version once in a local release variable and reuse it for the default image tag so the two stay in sync. If the upstream image tag starts with v (such as "v1.12.1"), pass release directly to meta.version. Kix strips the leading v when reading meta.version, so kix list packages, the PackageInstance record, and compatibleWith all see "1.12.1", matching kix.image.version:
1let2 release = "v1.12.1";3in4{5 meta = {6 version = release;7 ...8 };9
10 options.image = kix.options.image {11 repository = "quay.io/prometheus/node-exporter";12 tag = release;13 digest = "sha256:1b4e4438faca4dd7e001dd445d161a4a2091b0fededa84093b3a8dfeae1f1be0";14 };15
16 ...17}Omit meta.version when the package runs no software of its own, such as a package that only creates Secrets or custom resources for a separate controller. Without meta.version, kix list packages shows -, and the instance’s PackageInstance record omits spec.version unless out.version or the instance’s version option is set.
Version strings must match <digits>(.<digits>)* with an optional leading v or V, an optional -<suffix>, and an optional +<build> (for example, "1.28.2", "v2.4.0-rc1", "1.31.2-gke.1209000", or "1.31.2+rke2r1").
When comparing versions in compatibleWith and k8s:
- Numeric segments are compared as integers from left to right.
- A
-<suffix>whose first dot-separated identifier starts withalpha,beta,rc,pre,dev, orpreviewis treated as a pre-release and sorts before the corresponding release (1.0.0-rc1 < 1.0.0). - All other
-<suffix>values (such as-r0,-debian-12, or-gke.1209000) and+<build>suffixes are treated as vendor build metadata and compare equal to the base version (1.0.0-debian-12 == 1.0.0).
The version an instance reports
Section titled “The version an instance reports”meta.version is fixed for the package, and an instance can run another image. Kix works out one version for each instance and uses it in two places: spec.version on the instance’s PackageInstance record, which kix plan shows, and the meta.compatibleWith checks of the packages that depend on the instance. Kix takes the first of these that is set:
- The instance’s
versionoption. - The
out.versionthe package builds on itsroot. - The package’s
meta.version.
A package whose image a user can change publishes out.version with kix.image.version, which reads the version from the image tag:
1root = {2 resource = self.service;3 out.version = kix.image.version config.image;4};A package that runs several images reads the image of its main software. When the tag names no version, such as latest, out.version is null. The record then carries no version, and a meta.compatibleWith check warns that it cannot compare. Set the instance’s version option to state the version yourself.
kix list shows the package’s meta.version, because it reads packages without building instances.
meta.roles and meta.defaultAliases
Section titled “meta.roles and meta.defaultAliases”meta.roles registers the instance as a provider of one or more cluster roles from a closed vocabulary:
| Role | Required out fields | Effect |
|---|---|---|
"cni" | None | Satisfies the cluster CNI capability check. |
"dns" | fqdn | Provides cluster DNS resolution; workloads automatically receive a dependency and network egress rule to the DNS service. |
"gatewayApi" | crds | Provides the gateway.networking.k8s.io CRD family to Gateway API packages (envoy-gateway-controller, envoy-gateway, traefik). |
"loadBalancer" | None | Satisfies Service resources of type = "LoadBalancer". |
"metricsApi" | None | Satisfies consumers that call scope.requireMetricsApi (such as HorizontalPodAutoscaler). |
"network-policy-enforcer" | netpol | Enables cluster-wide NetworkPolicy enforcement when cluster.networkPolicy.enable = true. |
"registryMirror" | None | Registers a cluster container registry mirror. |
"snapshotController" | crds | Provides the VolumeSnapshot CRD family for backup and restore workflows. |
"storageClasses" | storageClassName | Provides a dynamic StorageClass for PersistentVolumeClaim resources. |
Each role in meta.roles also registers that role name as a dependency alias so other packages can request { dns ? null }: or { loadBalancer ? null }:. At most one active instance in a cluster may provide a given role unless disambiguated.
meta.defaultAliases provides additional dependency-injection names when the instance does not set instances.<name>.aliases. If an instance sets an aliases list, even an empty one, defaultAliases are replaced while meta.roles remain active.
meta.availability
Section titled “meta.availability”meta.availability.max declares the highest availability topology the package architecture supports ("none", "pod", "node", or "zone"). When a cluster requests a higher level (for example, "zone"), Kix clamps availability inside the package to meta.availability.max so replica counts and topologySpreadConstraints never exceed what the software can safely run.
Individual workloads can further clamp their own ceiling by passing availability.max to scope.mkDeployment, scope.mkStatefulSet, scope.mkJob, or scope.mkCronJob.
Add reason alongside max (in meta.availability or on a workload builder) to explain why the software cannot run at a higher availability level. Kix includes reason when it warns that an instance or workload was capped at max, and when it rejects a workload with more than one replica under max = "none". Write reason as one or more complete sentences; Kix prints Reason: <reason> and adds a final period if missing:
1availability = {2 max = "none";3 reason = "The service stores state in a single SQLite file that supports only one writer at a time.";4};meta.compatibleWith and meta.k8s
Section titled “meta.compatibleWith and meta.k8s”meta.compatibleWith.<dep> checks the meta.version of the bound <dep> provider at evaluation time:
1meta.compatibleWith.postgres = {2 minVersion = "15";3 maxVersion = "17";4 reason = "Uses PostgreSQL 15+ logical replication syntax";5};Bounds are inclusive (minVersion <= actual <= maxVersion) and compare only up to the segment precision of the bound. For example, maxVersion = "1.29" accepts "1.29.4", while maxVersion = "1.29.0" rejects "1.29.4". meta.k8s uses the same comparison rules against k8sVersion.
meta.k8s holds two ranges:
- Top-level
minVersionandmaxVersionfail the build whenk8sVersionfalls outside them. Set these bounds only when the package is known to fail beyond them, such as when a workload reads an API version that older Kubernetes releases do not serve or a CRD uses a validation rule added in a newer Kubernetes release, and explain what fails inreason. When a package can disable just the unsupported feature on older clusters, compareclusterConfig.k8sVersionwithkix.version.atLeastinbuildinstead of setting a hard bound. supportedrecords the Kubernetes versions the upstream project lists as supported or tests in CI, andsourcenames where upstream states that range. Whenk8sVersionfalls outsidesupported, the build continues and emits a warning with the range and its source.
When a cluster leaves k8sVersion unset, Kix skips both checks without warning.
1meta.k8s = {2 minVersion = "1.36";3 reason = "Reads admissionregistration.k8s.io/v1 MutatingAdmissionPolicy, added in Kubernetes 1.36";4 supported = {5 minVersion = "1.36";6 maxVersion = "1.36";7 source = "the compatibility matrix in the upstream README";8 };9};Each Kix release supports a range of Kubernetes versions (1.36 and 1.37 in this release). Every stable package accepts all versions in that range, so a cluster on Kubernetes 1.36 or 1.37 builds with any combination of stable packages. Setting k8sVersion outside that range emits a warning without stopping the build.
meta.conflictsWith
Section titled “meta.conflictsWith”Entries in meta.conflictsWith prevent incompatible packages from being deployed together:
"<pkg>"forbids another instance of<pkg>in the same namespace."cluster:<pkg>"forbids<pkg>anywhere in the same cluster.- Listing the package’s own name in
"cluster:<self>"enforces a cluster-wide singleton.
An instance counts when it answers <pkg> by its name or its aliases, or when its package lists <pkg> in meta.defaultAliases. The last case holds even when the instance sets its own aliases, so two instances of a singleton package fail whatever aliases they set.
An entry can also be { key; reason; }, where key is "<pkg>" or "cluster:<pkg>" and reason (one or more complete sentences) explains why the instances cannot coexist. Kix prints Reason: <reason> in the conflict error:
1conflictsWith = [2 {3 key = "cluster:tailscale";4 reason = "The operator watches cluster-wide tailscale.com resources, Services with loadBalancerClass \"tailscale\", and Ingresses with IngressClass \"tailscale\" across all namespaces, so two instances would compete for the same objects.";5 }6];meta.podSecurity and meta.unsafe
Section titled “meta.podSecurity and meta.unsafe”Setting meta.podSecurity to "restricted", "baseline", or "privileged" applies the corresponding pod-security.kubernetes.io/enforce label to the generated Namespace resource. When multiple instances share a namespace, the least restrictive level wins (privileged > baseline > restricted).
meta.unsafe acknowledges intentional security or isolation trade-offs so the scorecard records them as reviewed grants (architecture.unsafeGrants) rather than unexpected violations:
meta.unsafe token | What it permits |
|---|---|
"raw-pvc" | Constructing a raw PersistentVolumeClaim via scope.mkResource instead of a managed storage operator. |
"host-network" | Setting hostNetwork = true, hostPID = true, or hostIPC = true on a pod spec. |
"privileged" | Setting securityContext.privileged = true on a container. |
"run-as-root" | Running containers with runAsNonRoot = false or runAsUser = 0. |
"cluster-admin" | Binding a ServiceAccount to the built-in cluster-admin ClusterRole or granting wildcard * verbs and resources. |
meta.network
Section titled “meta.network”When cluster.networkPolicy.enable = true, Kix derives NetworkPolicy resources from the dependency graph. Workloads that need ambient network access not represented by a Kix resource dependency (such as scraping all pods or calling external webhooks) declare that access in meta.network:
1meta.network = {2 intents.deployment = {3 egress = [4 {5 to = "apiserver";6 }7 {8 to = "world";9 ports = [ { port = 443; protocol = "TCP"; } ];10 }11 ];12 ingress = [13 {14 from = "all-pods";15 ports = [ { port = 9090; protocol = "TCP"; } ];16 }17 ];18 };19 externalIngressEntities = [ "world" ];20};intents.<partName>.egress: list of rules wheretois"world","pods","all-pods","apiserver","dns","node-local"(with requiredcidr, for a link-local or metadata address on the pod’s own node), or{ entities = [ ... ]; }, with optionalports = [ { port; protocol ? "TCP"; } ]."pods"allows traffic only to pods."all-pods"means all pods in the cluster; although theciliumenforcer maps"all-pods"to Cilium’sclusterentity (which also includes cluster nodes and the Kubernetes API server), any rule that also needs to reach cluster nodes, host-network peers, or NodePort traffic SNATed by a node should declare{ to = "world"; entities = [ "cluster" ]; }(orfrom = "world"for ingress) explicitly.intents.<partName>.ingress: list of rules wherefromis"world","all-pods", or{ entities = [ ... ]; }, with optionalports.externalIngressEntities: list of entity names (such as["world"]or["remote-node"]) used when this package acts as a cluster ingress controller.entities(on an intent rule) andexternalIngressEntitiesaccept only"world","host","remote-node","kube-apiserver","cluster", and"all". Any other entity name fails evaluation with[K2060]. Each network policy enforcer maps these names to its own rule format.
options
Section titled “options”options defines the configuration schema for instances.<name>.config using standard NixOS module options (lib.mkOption) or kix.options.* helpers.
1options = {2 logLevel = lib.mkOption {3 type = lib.types.enum [ "debug" "info" "warn" "error" ];4 default = "info";5 description = "Minimum log severity emitted by the server.";6 };7
8 extraEnv = lib.mkOption {9 type = lib.types.attrsOf lib.types.str;10 default = { };11 description = "Additional environment variables passed to the main container.";12 };13};Evaluation order and module priority
Section titled “Evaluation order and module priority”When Kix evaluates an instance, it merges configuration layers using the NixOS module system in the following priority order (lowest number wins):
- Option defaults (
options.<name>.default): priority1500. - Package
configdefaults (lib.mkDefaultvalues inside the top-levelconfigblock in the package file): lowered from priority1000to priority1250so package-level computed defaults override option defaults (1500) while yielding to dependency injections and instance config (including instancelib.mkDefaultat1000). Unwrapped definitions in the packageconfigblock keep normal module priority (100). - Dependency config injections (
deps.<arg>.configfrom downstream consumers) and instanceconfig(instances.<name>.config): priority100(orlib.mkDefaultat1000,lib.mkForceat50).
Both the package config block and instance config modules can take { config, lib, clusterConfig, ... }: as module arguments to compute values from sibling options or cluster settings.
The option default contract
Section titled “The option default contract”Every package in a flake checked by kix.mkFlake or kix.checkPackageOptions must obey three rules on options defaults so users can override individual keys without unexpectedly wiping sibling defaults:
- No untyped options with non-empty attrset defaults. An option without a
type(or typed aslib.types.anything/lib.types.raw) cannot have a non-empty attribute set as itsdefault, because setting one subkey ininstances.<name>.configreplaces the entire attribute set. Use a submodule (lib.types.submodule) instead. - No
attrsOforlazyAttrsOfwith non-empty defaults.lib.types.attrsOfreplaces the default map wholesale when a user sets a single key unless merged carefully, and prevents per-key schema documentation. Define known keys as explicit options or put user extensions inextra*options withdefault = { };. - Submodule defaults must match field defaults. If a
lib.types.submoduleoption hasdefault = { foo = "bar"; };, thefoooption inside that submodule must also declaredefault = "bar";so specifying another field in the submodule does not dropfoo.
Reusable option sets
Section titled “Reusable option sets”kix.options.* provides pre-typed option schemas that pair directly with composition helpers like kix.expose, kix.monitor, and kix.healthCheck.
kix.options.* helpers
Section titled “kix.options.* helpers”| Helper | Arguments / shape | Generated options and types |
|---|---|---|
kix.options.image | { repository ? null, tag ? null, digest ? null, pullPolicy ? "IfNotPresent", tagText ? null, description ? ... } | Submodule option with repository (str), tag (str), digest (nullOr str, defaults to digest while config.tag == tag, otherwise null), pullPolicy (nullOr str, default pullPolicy), plus pin record-keeping options sourceRev, promotedBy, resolvedAt, and note (all nullOr str, default null). Consumed by kix.image.ref. |
kix.options.resources | { requests ? { }, limits ? { }, description ? ... } | Submodule option with requests and limits (each supporting cpu, memory, and ephemeral-storage defaults plus freeform hugepages-<size> or extended <domain>/<name> quantities validated by kix.types.quantity; setting a field to null clears its default) and claims (nullOr (listOf (submodule { name; request ? null; }))). Cleaned via apply so it passes directly to a container’s resources field. When cluster.defaultLimits.cpu or cluster.defaultLimits.memory is "none", kix.options.resources (from the package’s kix argument) drops that default limit while keeping any limit set on the instance. |
kix.options.env | option value (not a function) | lib.mkOption of type attrsOf (nullOr envValue) with default = { }, where each value is a string, a { valueFrom = ...; } source, or null (to clear a package default). Consumed by kix.mergeEnv. |
kix.options.ingress | option attrset (not a function) | Attribute set of options { host; extraHosts; annotations; timeouts; }: host (nullOr str, default null), extraHosts (listOf str, default [ ]), annotations (attrsOf str, default { }), and timeouts (nullOr (submodule { request; backendRequest; }) with nullOr str fields, default null). Assign as options.ingress = kix.options.ingress;; read by kix.expose from config.ingress. |
kix.options.monitor | option attrset (not a function) | Attribute set of options { enabled; interval; } where enabled is bool (default true) and interval is nullOr str (default null). Assign as options.metrics = kix.options.monitor;; read by kix.monitor from config.metrics. |
kix.options.alerts | option attrset (not a function) | Attribute set { enabled; } where enabled is bool (default true), for packages that render alert rules without a kix.monitor scrape. Assign as options.metrics = kix.options.alerts;; read by kix.alerts from config.metrics.enabled. |
kix.options.healthCheck | option attrset (not a function) | Attribute set { enabled; retryFor; } where enabled is bool (default false) and retryFor is int (default 90). Assign as options.healthCheck = kix.options.healthCheck;; read by kix.healthCheck from config.healthCheck. |
kix.contracts.oidc.options | { scopes, autoLogin ? null } | Attribute set of options { scopes; autoLogin?; } where scopes is listOf str that must include "openid" (default scopes), and autoLogin is bool (default false, included only when autoLogin != null). Setting the removed enabled or realm options fails evaluation in kix.contracts.oidc.helpers.client with migration steps. The single sign-on option set lives on its contract. |
kix.contracts.smtp.options | option attrset (not a function) | Attribute set { from; } where from is nullOr str holding one @ (default null): the sender address that replaces the smtp server’s out.from. Assign as options.mail = kix.contracts.smtp.options; and pass config.mail.from to kix.contracts.smtp.helpers.settings. The mail option set lives on its contract. |
Resource quantities (kix.types.quantity and kix.parseQuantity)
Section titled “Resource quantities (kix.types.quantity and kix.parseQuantity)”kix.types.quantity is a NixOS option type that accepts standard Kubernetes resource quantity strings (such as "100m", "0.5", "256Mi", "2Gi", or "1e3") and rejects malformed suffixes or numbers exceeding 64-bit signed integer limits or 18 significant digits.
To compare or compute resource quantities in Nix code, use kix.parseQuantity:
1# Returns millicores (integer) when the first argument is "cpu"2cpuMillis = kix.parseQuantity "cpu" config.resources.requests.cpu; # "250m" -> 250, "2" -> 20003
4# Returns bytes (integer) for memory or storage5memBytes = kix.parseQuantity "memory" config.resources.requests.memory; # "256Mi" -> 268435456Tolerations (kix.types.toleration and kix.tolerations)
Section titled “Tolerations (kix.types.toleration and kix.tolerations)”kix.types.toleration is a submodule option type for Kubernetes pod tolerations. Each entry defines key (nullOr str), operator ("Equal" by default, or "Exists"), value (nullOr str), effect ("NoSchedule", "PreferNoSchedule", "NoExecute", or null), and tolerationSeconds (nullOr ints.unsigned). Every field except operator defaults to null. Because Kubernetes rejects some combinations of these fields, validate the list in assertions with kix.tolerations.problems and format it for the pod spec with kix.tolerations.render:
| Helper | Signature | Behavior |
|---|---|---|
kix.tolerations.problems | { optionPath, tolerations } -> [ message ] | Returns an error message for each toleration that Kubernetes would reject: a missing or empty key when operator is not "Exists", value set when operator is "Exists", or tolerationSeconds set when effect is not "NoExecute". Each message identifies the entry as <optionPath>[<index>]. |
kix.tolerations.render | tolerations -> list | Strips null fields from each toleration so you can assign the list directly to spec.tolerations on a pod spec. |
1options.node.tolerations = lib.mkOption {2 type = lib.types.listOf kix.types.toleration;3 default = [ ];4 description = "Taints the node plugin tolerates.";5};6
7assertions =8 { config, ... }:9 map (message: {10 assertion = false;11 inherit message;12 }) (kix.tolerations.problems {13 optionPath = "config.node.tolerations";14 inherit (config.node) tolerations;15 });16
17# In the pod spec:18tolerations = kix.tolerations.render config.node.tolerations;VolumeSnapshotClasses (kix.types.volumeSnapshotClass and kix.storage)
Section titled “VolumeSnapshotClasses (kix.types.volumeSnapshotClass and kix.storage)”CSI driver packages expose VolumeSnapshotClass settings as an option of type lib.types.attrsOf kix.types.volumeSnapshotClass, keyed by class name. Each entry accepts deletionPolicy ("Delete" by default, or "Retain") plus parameters, labels, and annotations (each attrsOf str, default { }). The provider of the snapshotController role supplies the VolumeSnapshotClass CRD, so take snapshotController ? null as an optional build argument:
| Helper | Signature | Behavior |
|---|---|---|
kix.storage.snapshotClassProblems | { optionPath, classes, snapshotController } -> [ message ] | Returns error messages when classes is non-empty and snapshotController is null, when more than one class sets annotations."snapshot.storage.kubernetes.io/is-default-class" = "true", or when a class is named root or meta (keys Kix reserves). Call this in assertions with snapshotController = deps.snapshotController or null. |
kix.storage.mkSnapshotClasses | { scope, snapshotController, driver, classes, requires ? [ ] } -> attrset | Builds a VolumeSnapshotClass resource for each entry in classes (under the same attribute keys) using scope.mkCR snapshotController.out.crds.VolumeSnapshotClass, setting driver on each class and omitting parameters when empty. Returns { } when snapshotController is null. |
1snapshotClasses = kix.storage.mkSnapshotClasses {2 inherit scope snapshotController;3 driver = self.csiDriver.out.name;4 classes = config.volumeSnapshotClasses;5 requires = [ self.controller ];6};Escape hatches and guard helpers
Section titled “Escape hatches and guard helpers”Packages often expose an escape hatch option (extraSpec, extraEnv, extraArgs, or settings) so cluster operators can set fields not covered by first-class options. Use Kix’s guard helpers to merge operator overrides while protecting invariants owned by the package:
| Helper | Signature | Behavior |
|---|---|---|
kix.mergeGuarded | { scope, locked, option ? "extraSpec", object ? null } base overrides | Recursively merges overrides into base. Fails evaluation if overrides sets any path in locked (a list of path-segment lists, such as [ [ "replicas" ] [ "selector" ] ] or [ [ "template" "spec" "serviceAccountName" ] ]) or replaces an ancestor of a locked path with a non-attribute-set value such as null. On conflict, Kix fails with option set on the error and tells the user to remove the locked field from that option. Set option = null when overrides comes from a function argument (such as a builder in out) rather than an instance option. Pass object ({ kind; name; namespace ? null; }) to name the affected Kubernetes resource, such as when one option configures several resources or a builder in out creates one. |
kix.mergeEnv | { scope, option ? "env", owned ? [ ], defaults ? { } } userEnv | Checks that userEnv does not set any environment variable claimed in owned (even to null), then returns defaults // userEnv // <all owned.vars> for kix.mkEnvVars. Each owned entry is { vars ? { }; names ? [ ]; from; fix ? null; } for variables the package provides, or { names; reason; fix ? null; } for variables the package rejects outright. If userEnv sets a claimed variable, Kix fails with option set on the error and reports <option> sets <VAR>, which comes from <from>. or <option> sets <VAR>, which this package does not accept: <reason>. If fix is omitted, the error tells the user to remove the variable from option. |
kix.mergeArgs | { scope, parser, option ? "extraArgs", args ? [ ], id ? null } userArgs | Builds the container’s argument list (args, then userArgs) and stops the build if userArgs sets a reserved flag. Set parser to match how the program reads flags: "gnu" (getopt, clap, pflag, kingpin) matches --flag, --flag=value, or a single-letter -f with an attached value; "component-base" (Kubernetes component-base cli.Run, or pflag with WordSepNormalizeFunc) matches like "gnu" and treats _ and - as the same character in flag names, so --leader_elect matches --leader-elect; "go" (Go’s flag package) treats -flag and --flag as the same flag; "go-arg" (alexflint/go-arg) matches like "go" with any number of leading dashes; "paerser" (Traefik) matches like "go" and ignores letter case. Each item in args is one of three forms: a plain string (passed as written; userArgs may repeat it), { defaults = [ "--flag=value" ]; } (passed unless userArgs sets the same flag; write each flag and value as one string), or { flags ? [ ]; names ? [ ]; families ? [ ]; reason; fix ? null; } (or from instead of reason). Kix passes flags to the container and rejects them in userArgs; write each item as "--flag=value" or as a list [ "--config" path ] where the first item is the flag name and the rest are its values. names rejects extra flag names without passing them (such as short aliases, unsupported flags, or a conditional flag in flags = lib.optional <cond> "--flag=value" that must stay blocked when <cond> is false). families rejects a flag and every <flag>.<name> sub-flag. When userArgs sets a reserved flag, Kix sets option on the error, reports <option> sets "<word>", which comes from <from>. or <option> sets "<word>", which this package does not accept: <reason>, shows fix (or tells the user to remove the flag from option), and notes that partsOverlays can modify the built resource after the package’s checks. When userArgs is an attribute set (such as extraArgs on a VictoriaMetrics custom resource), flags and defaults must also be attribute sets of flag values, plain string entries are rejected, and keys match with or without leading dashes. Set id to a change ID (such as "K4740") when a package starts rejecting a flag or spelling it previously accepted. |
kix.argValues | { parser } flag userArgs -> [ value ] | Returns all values passed for flag in userArgs, in order, using the same parser rules as kix.mergeArgs. Reads values after =, attached to a single-letter flag (under "gnu" and "component-base"), or from the next list item. Only call kix.argValues for flags that take a value: if flag appears without =, Kix treats the next list item as its value. When userArgs is an attribute set, returns the values of all keys matching flag. |
Pass inherit scope; to kix.mergeGuarded, kix.mergeEnv, and kix.mergeArgs. All three report errors through scope.fail, which sets instance and package in Kix’s error output and in kix check -o json.
kix.mergeArgs replaces kix.guardArgs; calling kix.guardArgs stops the build with [K5396].
1# Guarding CLI flags and environment variables owned by typed options2args = kix.mergeArgs {3 inherit scope;4 parser = "gnu";5 args = [6 {7 flags = [ "--storage.tsdb.retention.time=${config.retention}" ];8 from = "the retention option";9 fix = "Remove it from extraArgs and set retention instead.";10 }11 {12 flags = [ "--web.listen-address=:9090" ];13 reason = "the Service and the probes use port 9090.";14 }15 ];16} config.extraArgs;17
18env = kix.mkEnvVars (19 kix.mergeEnv {20 inherit scope;21 option = "extraEnv";22 defaults = { LOG_FORMAT = "json"; };23 owned = [24 {25 vars = {26 PORT = "8080";27 DATABASE_HOST = database.host;28 };29 from = "the package and its `database` dependency";30 fix = "Wire the database with `deps.database` instead.";31 }32 ];33 } config.extraEnv34);build and deps
Section titled “build and deps”build function arguments
Section titled “build function arguments”Each function in build is called via pattern matching on its attribute set parameter list. Kix recognizes the following built-in framework arguments, and treats any other argument name as a cross-package dependency request:
| Built-in argument | Description |
|---|---|
self | Lazy fixed point of the merged parts attribute set returned across all build entries. Use self.<partName> to reference sibling resources in the same package. |
config | Evaluated package options (options merged with package config, dependency injections, and instances.<name>.config). |
clusterConfig | Evaluated cluster module configuration (such as clusterConfig.cluster.domain, clusterConfig.cluster.name, clusterConfig.k8sVersion, clusterConfig.cluster.availability, and clusterConfig.networkPolicy.enable). |
scope | Instance-scoped resource builders (identical to outer scope). |
lib | Standard nixpkgs.lib. |
kix | Framework helpers. |
deps | Attribute set of all bound dependencies declared across build entries and deps. |
availability | Effective availability level string for the instance ("none", "pod", "node", or "zone"). |
Declaring dependencies
Section titled “Declaring dependencies”Any argument to a build function outside the built-in list above requests another package instance by instance name, aliases, meta.defaultAliases, or meta.roles:
- Required dependency (
{ postgres, ... }:without?): Kix requires a matching instance (or auto-instantiates the package when it is listed in the cluster’savailablePackages). - Optional dependency (
{ prometheus ? null, ... }:with? null): Bound to the provider’s output object if present in the cluster, ornullif absent.
When a dependency is bound, the argument receives the provider’s consumer view:
dep.out: Full output attribute set (dep.root.resource.out // dep.root.out).- Top-level convenience fields: every key in
dep.outis promoted directly ontodep(for example,postgres.fqdnandpostgres.port), alongside any top-level part folders from the provider’sbuild(such asdep.crdsanddep.secrets) and the view’s system keys (_type,_packageInstance,root,out,raw, and_meta). Aroot.outkey or part folder that collides with a system key (or a part folder other thancrdsandsecretsthat collides with aroot.outkey) throws an evaluation error. dep.crds: Attribute set of CRD resources from the provider’scrdspart folder (unless overridden byroot.out.crds).
Enriching dependencies with deps.<arg>
Section titled “Enriching dependencies with deps.<arg>”The top-level deps attribute set lets a consumer package inject configuration into an upstream provider or attach dependency-specific assertions and warnings:
1deps.postgres = {2 config = consumerConfig: {3 databases.${scope.instanceName} = {4 owner = consumerConfig.dbUser;5 };6 };7 assertions = pg: [8 {9 assertion = pg.out.tlsEnabled or false;10 message = "myapp requires postgres to have TLS enabled.";11 }12 ];13 warnings = pg:14 lib.optional (pg.out.maxConnections or 100 < 200)15 "myapp recommends postgres maxConnections >= 200.";16};deps.<arg> field | Type | Description |
|---|---|---|
config | attrset or consumerConfig: attrset | Configuration module injected into the upstream provider instance. Throws an error if the provider instance’s config in the cluster definition locked the target option with kix.mkLocked. |
assertions | dep: [ { assertion; message; } ] | Assertions evaluated only when <arg> is non-null. Kix sets dependency to <arg> unless the assertion sets it. |
warnings | dep: [ string or attrset ] | Warnings evaluated only when <arg> is non-null. Each takes the fields of a package’s top-level warnings, and Kix sets dependency to <arg> unless the warning sets it. |
renamedFrom | { name; id; } | The name this dependency had in earlier releases, and a change id such as "K1234". When no instance matches the dependency, the error carries id and adds a sentence saying that the dependency was named name in earlier releases. |
Built-in dependency contracts (kix.contracts.*)
Section titled “Built-in dependency contracts (kix.contracts.*)”kix.contracts.* provides shared contract validators (postgresDatabase, redis, smtp, oidc, and gateway under kix.contracts.<name>, and oidcProvider, otlpEndpoint, and clickhouse under kix.contracts.experimental.<name>) that verify the out surface passed between providers (including kix.mkImport stand-ins) and consumers:
- Provider validation (
check): A provider passesroot.outthroughkix.contracts.<name>.check scope { ... }(orkix.contracts.experimental.<name>.check scope { ... }), which validates every required and optional field and returnsout. - Consumer validation (
assertionsor helper functions): A consumer setsdeps.<alias>.assertionstokix.contracts.<name>.assertions(orkix.contracts.experimental.<name>.assertions), or reads the dependency through a contract helper such askix.contracts.smtp.helpers.settings,kix.contracts.smtp.helpers.server,kix.contracts.oidc.helpers.client, orkix.contracts.gateway.require. Consumer checks require allrequired = truefields and validate any optional fields that are present. - Automatic error context: Contract checks that take
scopefail throughscope.fail, and Kix attachesinstance,package, anddependencyto failed dependency assertions automatically, so error messages should not repeat the instance or package name. - Credentials on contracts (
out.credentials): Every contract that carries a login places the secret or secret instance atout.credentials(read viadep.out.credentials.out.keyRef "<key>") rather than taking a second secret dependency.
1deps.database.assertions = kix.contracts.postgresDatabase.assertions;Build entries
Section titled “Build entries”build can be a single function or a list of functions (or file paths to functions). When build is a list:
- Kix inspects the function arguments of every entry and takes the union of all dependency requests. If any entry declares a dependency without a default (
{ redis }:), the dependency is required for the package even if another entry declares{ redis ? null }:. - Each entry is called with its requested arguments and returns an attribute set of named parts.
- Kix merges the returned attribute sets across all entries with
mergeCollide. Any duplicate part name acrossbuildentries throws an evaluation error.
Parts, folders, and conditional null entries
Section titled “Parts, folders, and conditional null entries”Each attribute in a build return set is one of the following:
- A resource created by
scope.mkResource,scope.mkDeployment,scope.mkSecret,scope.mkCRD, or a provider builder. null, which Kix filters out automatically. Useif config.metrics.enabled then scope.mkResource { ... } else nullorscope.mkOptional config.metrics.enabled (scope.mkResource { ... })for conditional resources.- A nested folder (up to 3 levels deep) grouping related resources, such as
rbac = { sa = ...; role = ...; binding = ...; };. Top-level folders are also exposed on the instance’s consumer view. - Known folders (
secretsandcrds):- Both
secretsandcrdsmust be attribute sets of resources rather than a single resource directly (assigning a resource directly tosecretsorcrdsthrows an evaluation error), and any entry inside them that is not a Kix resource (_type = "k8s-resource") emits an evaluation warning. - Place
scope.mkSecret/scope.mkSecretRefresources undersecrets = { ... };andscope.mkCRD/scope.mkCRDRefresources undercrds = { ... };. CRDs placed incrdsare exposed to downstream consumers atdep.crds.<Kind>.
- Both
Composable build-entry helpers
Section titled “Composable build-entry helpers”Because build accepts a list of functions, cross-cutting concerns are packaged as standalone build entries:
1build = [2 (3 { self, config }:4 {5 deployment = ...;6 service = ...;7 root = self.service;8 }9 )10 (kix.expose { service = "service"; })11 (kix.monitor { service = "service"; port = "metrics"; })12 (kix.healthCheck {13 runtime = kix.healthCheck.runtimes.shell;14 script = ''15 curl -sf "http://$SERVICE_FQDN:8080/healthz"16 '';17 env = { self, ... }: { SERVICE_FQDN = self.service.out.fqdn; };18 })19];See Composition helpers for the full reference on kix.expose, kix.monitor, kix.alerts, and kix.healthCheck.
Evaluation-only store (no shell builders)
Section titled “Evaluation-only store (no shell builders)”Kix evaluates packages in its local store without running shell build scripts. Package and cluster definitions can evaluate expressions, read files from the repository (builtins.readFile, builtins.fromJSON), write files with builtins.toFile or builtins.path, and render Helm charts through scope.helm.fetchHelmChart and scope.helm.importChart.
Do not call pkgs.runCommand, pkgs.stdenv.mkDerivation, or pkgs.writeText inside a package or cluster definition; evaluation fails under the default kix builder.
Package diagnostics
Section titled “Package diagnostics”Top-level warnings and assertions
Section titled “Top-level warnings and assertions”A package can define top-level warnings and assertions functions. Both receive { config, self, deps, clusterConfig } after options and build parts are wired. clusterConfig is the same evaluated cluster configuration passed to build. Because deps only contains bound dependencies, an absent optional dependency is omitted from deps (test for it with !(deps ? <name>) or (deps.<name> or null) == null):
1warnings =2 { config, deps, ... }:3 lib.optional (config.ingress.host != null && !(deps ? gateway) && !(deps ? ingressController)) {4 message = "ingress.host is set, but neither gateway nor ingressController is present in the cluster.";5 option = "ingress.host";6 };7
8assertions =9 { config, ... }:10 [11 {12 assertion = !(config.tls.enable && config.tls.secretName == null);13 message = "config.tls.secretName is not set, and config.tls.enable is true.";14 fix = "Set config.tls.secretName to the Secret that holds the certificate.";15 option = "tls.secretName";16 }17 ];An assertion takes the same optional fields as scope.fail (below): fix, id, object, option, dependency, and clusterOption. A warning is a message, or an attribute set with message and the same optional fields. Kix adds the instance to each, so the message does not name it. Failed assertions stop evaluation, and Kix lists every failed assertion of the cluster at once. warnings do not stop evaluation. kix check lists them under its table, and every other command that evaluates a cluster or reads a bundle with --bundle prints them to stderr. Return warnings from warnings or deps.<name>.warnings; Kix hides builtins.trace and lib.warn output when evaluation succeeds. A field in the wrong form, such as an id that is not a change record id, stops evaluation in a warning as it does in an error.
Raising an error with scope.fail
Section titled “Raising an error with scope.fail”A package stops evaluation with scope.fail when something it was given cannot work. Do not use throw for an error a person must fix: Kix shows a scope.fail error from its fields, without a stack trace, and kix check -o json carries the fields.
1_passwordCheck =2 if config.password != null then3 scope.fail {4 id = "K9503";5 option = "password";6 message = "password was removed, because it put the password in plain text.";7 fix = "Give the password as the dependency `password`.";8 }9 else10 null;| Field | Required | Meaning |
|---|---|---|
message | Yes | What is wrong. scope.fail "text" is short for scope.fail { message = "text"; }. |
fix | No | What to change. It may span several lines, such as a line to paste into the cluster definition. |
id | No | The change record id, such as "K0001", when the error refuses something an upgrade removed. |
object | No | The Kubernetes object at fault, as { kind = "Deployment"; name = "web"; }, with an optional namespace. |
option | No | The option to change, as a path in the instance’s config, such as "tls.secretName". kix pin set --option takes the same form. |
dependency | No | The dependency to change, as its name in the instance’s deps, such as "database". |
clusterOption | No | The cluster option to change, as a path in the cluster definition, such as "cluster.domain". |
instance | No | Set by scope.fail to <namespace>/<instance>. |
package | No | The package’s name, such as "harbor" or "experimental/coredns". Set automatically by scope.fail for built-in packages. |
option, dependency, and clusterOption name settings a person can change in a cluster definition. A package’s meta is not an instance option, so leave option out when an error is about meta. An option must not start with config., deps., or meta., and a clusterOption must not start with instances.. Kix leaves out a field in the wrong form, or one it does not take, and adds a line to the message that says why. A warning with such a field stops evaluation with that error. Start fix with a capital letter.
scope.fail also takes a list of errors, to report several problems at once. A cluster definition, which has no scope, uses kix.fail, which takes the same arguments and leaves out the instance.
Kix shows the error as:
1[K9503] shop/db: password was removed, because it put the password in plain text.2Option: password3Fix: Give the password as the dependency `password`.Structural build-time warnings
Section titled “Structural build-time warnings”During package evaluation, Kix also gives structural warnings for common wiring mistakes, which kix check lists with the package’s own warnings. Each names the resource in its object field:
- Orphaned resources: A part defined in
buildis not reachable fromroot.resource,root.requires, orroot.postHooks. - Redundant
requires: A resource lists a dependency inrequires = [ ... ]that is already tracked implicitly through.outstring context in its manifest. - Duplicate
requires: The same resource appears more than once in arequireslist. - Unordered
postHooks: A resource inroot.postHooksdoes not depend (directly or through another resource) onroot.resourceor any entry inroot.requires, so Kix can deploy it before the main resources are ready. Referencing a Secret or ConfigMap thatroot.resourcealso uses does not order the hook afterroot.resource. If a resource must finish before the instance is ready without waiting forroot.resource, put it inroot.requiresinstead.
kix.checkPackageOptions and kix.packageOptionViolations
Section titled “kix.checkPackageOptions and kix.packageOptionViolations”kix.checkPackageOptions validates that a package’s options block obeys the option default contract across every availability level up to meta.availability.max:
1kix.checkPackageOptions {2 package = import ./pkgs/myapp;3 who = "myapp";4}kix.checkPackageOptions returns null when valid or throws an evaluation error listing all violations. To inspect the violations as data without throwing, call kix.packageOptionViolations { package = ...; who = "..."; }, which returns a list of violation attribute sets (empty when valid). kix.mkFlake runs kix.checkPackageOptions automatically across all exported packages.
kix.contracts.secret.helpers.use
Section titled “kix.contracts.secret.helpers.use”A package takes every secret value through a secret dependency, never through an option, so the cluster chooses where the value comes from: packages.secret (plain text or a SOPS file), packages.secret-ref (a Secret that something else writes), or another source package. A test in the Kix repository fails any package that Kix ships if one of its options holds a secret or a path to one.
Wrap the dependency with kix.contracts.secret.helpers.use before reading its keys. It checks that dep satisfies kix.contracts.secret (out.name, out.keyRef, out.mkEnv, out.envFrom, and out.volume) and that dep.out.keys declares every key in keys and at least one full group in anyOf. When valid, it returns dep; otherwise it fails through scope.fail with dependency set to arg. kix.checkSecretKeys takes the same arguments and checks only the keys.
1build =2 {3 self,4 config,5 credentialsSecret ? null,6 ...7 }:8 let9 checkedSecret = kix.contracts.secret.helpers.use {10 inherit scope;11 arg = "credentialsSecret";12 dep = credentialsSecret;13 keys = [ "username" ];14 anyOf = [15 [ "password" ]16 [ "api-token" ]17 ];18 };19 in20 {21 ...22 };| Field | Type | Default | Description |
|---|---|---|---|
scope | scope | Required | The consumer’s scope, used to report the instance and package through scope.fail. Passing the removed who argument fails with [K6417]. |
arg | string | Required | Dependency argument name. |
dep | resource or null | Required | Bound Secret dependency. Returned unchanged when dep is null or when all key requirements are satisfied (or if dep.out.keys is not set). |
keys | list of strings | [ ] | Keys that must all be present in dep.out.keys. |
anyOf | list of lists of strings or null | null | When non-null, every key in at least one inner list ([ [ "a" "b" ] [ "c" ] ]) must be present in dep.out.keys. |