Reference / Package authoring
Helm and imports
These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.
Not everything in your cluster starts as a native Kix package: you might want to deploy a complex third-party operator published as a Helm chart, or connect your workloads to a managed database or cloud ingress controller that already exists outside Kix. This page covers the two bridges for bringing external software into Kix’s dependency graph: Helm chart wrappers (kix.helmChart and scope.helm.importChart) and external service markers (kix.mkImport).
Helm helpers
Section titled “Helm helpers”Helm chart wrappers are a fallback bridge for third-party software that does not have a native Kix package yet. Compared to native Kix packages, Helm charts use untyped values maps (unless wrapped with custom options), rely on YAML heuristics rather than .out references for dependency and network-policy discovery, ignore cluster.availability scaling by default, and often require overrides to satisfy scorecard rules. See Trade-offs of wrapping a Helm chart for when to use each tier.
Kix provides two entry points for Helm charts:
kix.helmChart: A turn-key package constructor for quick chart adoption that exposes avaluesoption (options.values) and wraps the rendered resources automatically.scope.helm.importChart: The full chart-adoption builder used inside custom packages that expose typedoptions, translate them into Helmvalues, and patch or extend the rendered resources.
Quick adoption with kix.helmChart
Section titled “Quick adoption with kix.helmChart”1{ kix, ... }:2kix.helmChart {3 repo = "https://stakater.github.io/stakater-charts";4 name = "reloader";5 version = "1.0.115";6 hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";7 metaExtra = {8 description = "Kubernetes controller that watches ConfigMaps and Secrets and triggers rollouts";9 };10}kix.helmChart argument | Type | Default | Description |
|---|---|---|---|
repo | string | Required | Helm repository URL (https://... or oci://...). |
name | string | Required | Upstream chart name. |
version | string | Required | Chart version string (also used as default meta.version). |
hash | string | Required | Fixed-output Nix SRI hash ("sha256-...") of the fetched chart tarball. |
releaseName | string | name | Helm release name passed to helm template. |
helmVersion | "3" or "4" | "4" | Major version of the Helm in the Kix runtime used to render the chart ("4" is 4.3.1, "3" is 3.19.1; see Helm versions). |
root | { kind, name } or null | null | Explicit root resource selector; when null, Kix selects the primary Service or workload automatically (chart.autoRoot). |
includeCrds | bool | true | Whether to pass --include-crds to helm template. |
strip | { helmAnnotations ? true; helmLabels ? true; defaultStrategy ? true; } | { } | Controls normalization of Helm metadata annotations (helmAnnotations), app.kubernetes.io/managed-by and helm.sh/chart labels (helmLabels), and default RollingUpdate strategy blocks (defaultStrategy). |
patchResources | list -> list | lib.id | Function transforming the list of parsed chart resource attribute sets before Kix reconstructs the DAG and wraps them. |
metaExtra | attrset | { } | Additional fields merged into the package’s meta block. |
Full adoption with scope.helm.fetchHelmChart and scope.helm.importChart
Section titled “Full adoption with scope.helm.fetchHelmChart and scope.helm.importChart”In a typed package, fetch the chart tarball with scope.helm.fetchHelmChart and render it into Kix resources with scope.helm.importChart:
1{2 scope,3 lib,4 kix,5 ...6}:7
8let9 chart = scope.helm.fetchHelmChart {10 repo = "https://charts.jetstack.io";11 name = "cert-manager";12 version = "1.14.4";13 hash = "sha256-BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB=";14 };15in16{17 meta = {18 version = "1.14.4";19 description = "X.509 certificate controller for Kubernetes";20 };21
22 options = {23 replicas = lib.mkOption {24 type = lib.types.ints.positive;25 default = 1;26 description = "Controller replica count.";27 };28 values = lib.mkOption {29 type = lib.types.attrsOf lib.types.anything;30 default = { };31 description = "Extra Helm values merged over typed options.";32 };33 };34
35 build =36 { self, config }:37 let38 rendered = scope.helm.importChart {39 inherit chart scope;40 releaseName = "cert-manager";41 values = lib.recursiveUpdate {42 replicaCount = config.replicas;43 installCRDs = true;44 } config.values;45 patchResources = builtins.filter (r: r.kind != "Pod");46 };47 in48 rendered.mkParts {49 root = rendered.get "Deployment" "cert-manager";50 };51}scope.helm.importChart arguments
Section titled “scope.helm.importChart arguments”| Argument | Type | Default | Description |
|---|---|---|---|
chart | derivation | Required | Chart tarball derivation returned by scope.helm.fetchHelmChart { repo, name, version, hash }. |
scope | attrset | Required | Package scope (automatically configured with labelStyle = "helm" for wrapped resources). |
values | attrset | { } | Nix attribute set serialized to values.yaml and passed to helm template --values. |
releaseName | string | "release" | Release name passed to helm template. |
namespace | string | scope.namespaceName | Namespace passed to helm template --namespace. |
helmVersion | "3" or "4" | "4" | Major version of the Helm in the Kix runtime used to render the chart ("4" is 4.3.1, "3" is 3.19.1; see Helm versions). |
includeCrds | bool | true | Passes --include-crds and wraps rendered CRDs with scope.mkCRD. |
includeHooks | bool | true | When false, passes --no-hooks to helm template. Chart test hooks (helm.sh/hook containing "test") are always dropped when wrapping resources. |
extraFlags | list of strings | [ ] | Extra CLI arguments appended to helm template, one argument per list element (for example, [ "--api-versions" "monitoring.coreos.com/v1" ]). Do not pass --values, --namespace, --include-crds, or --no-hooks here: Kix passes those flags itself and does not filter extraFlags. Set --kube-version with kubeVersion instead. |
kubeVersion | string or null | null | Kubernetes version passed to helm template --kube-version to set .Capabilities.KubeVersion. When null, Helm uses its built-in default (see Helm versions). |
strip | { helmAnnotations ? true; helmLabels ? true; defaultStrategy ? true; } | { } | Normalization booleans controlling whether Kix strips meta.helm.sh/*, helm.sh/*, and checksum/* annotations (helmAnnotations), app.kubernetes.io/managed-by and helm.sh/chart labels (helmLabels), and default RollingUpdate strategy blocks (defaultStrategy). To filter or modify rendered resources, use patchResources. |
preserveAnnotationPrefixes | list of strings | [ ] | Keeps matching annotation prefixes (such as "argocd.argoproj.io/") when strip.helmAnnotations is enabled. |
patchResources | list -> list | lib.id | Transforms the list of parsed chart resource attribute sets (after List expansion and test-hook filtering) before DAG reconstruction and scope.mk* wrapping. |
extraEdges | list of { from = { kind; name; }; to = { kind; name; }; } | [ ] | Additional intra-chart dependency edges (from depends on to) merged with Kix’s automatic DAG reconstruction (for example, [ { from = { kind = "Deployment"; name = "my-app"; }; to = { kind = "Job"; name = "my-migration"; }; } ]). |
networkDeps | list of strings | [ ] | Additional context-carrying strings (such as nested dep.out.byKind outputs) attached to chart workloads for network-policy edge discovery. |
deps | list of dependency views | [ ] | Upstream Kix dependency views whose top-level context-carrying out.* strings are attached to chart workloads for network-policy edge discovery. |
Automatic intra-chart DAG reconstruction
Section titled “Automatic intra-chart DAG reconstruction”Raw Helm YAML files have no deployment ordering between objects. When scope.helm.importChart wraps a chart, Kix inspects every rendered manifest and reconstructs the intra-chart dependency graph automatically:
- Workloads depend on the
ServiceAccountnamed inspec.template.spec.serviceAccountName, anyConfigMap,Secret, orPersistentVolumeClaimmounted involumesor referenced inenv/envFrom, and anyCRDwhose custom resources are present. RoleBindingandClusterRoleBindingresources depend on their targetRole/ClusterRoleandServiceAccountsubjects.Serviceresources depend on the workload whose pod template labels matchspec.selector.Ingress,HTTPRoute,ServiceMonitor, and webhook configurations depend on their targetService.
Use extraEdges when a chart has a runtime dependency that is not visible in standard Kubernetes reference fields (for example, an application Deployment that expects a chart Job to initialize an external schema).
Cross-package wiring and network policy
Section titled “Cross-package wiring and network policy”| Wiring | Network policy | Deploy ordering |
|---|---|---|
Reference in values only | None. Kix serializes values to JSON before helm template, stripping dependency metadata. Chart workloads receive only DNS egress. | None. |
deps = [ dep ] (dep must also be an argument of build) | Attaches top-level strings in dep.out (out.name, out.fqdn, and out.url) to every chart workload. When network policy is enabled, Kix generates egress from each chart workload to dep’s Service pods on the target port, plus matching ingress on dep. | When network policy is enabled, chart workloads wait for cluster DNS and their generated policies, which apply after dep’s Service. When network policy is disabled, chart workloads wait only for cluster DNS. Chart workloads never wait for dep’s Deployment or StatefulSet. |
networkDeps = [ ... ] (dep must also be an argument of build) | Attaches nested output strings (such as dep.out.byKind.<Kind>.<name>) to every chart workload so Kix generates the same egress and ingress policies. | Same as deps: orders chart workloads after cluster DNS (and after the target Service when network policy is enabled), never after dep’s workloads. |
kix.helmChart does not accept deps or networkDeps. To connect a chart to another package, wrap it in a package that calls scope.helm.importChart:
1build =2 { backend, ... }:3 let4 rendered = scope.helm.importChart {5 inherit chart scope;6 releaseName = "web";7 values = {8 backendHost = backend.out.fqdn;9 networkPolicy.enabled = false;10 };11 # Lets Kix derive egress from the chart's workloads to backend.12 deps = [ backend ];13 };14 in15 rendered.mkParts { root = rendered.get "Service" "web"; };If a chart renders its own NetworkPolicy templates, Kix applies them alongside its generated CiliumNetworkPolicy objects, and Cilium enforces both. Disable the chart’s built-in policies in either of two ways:
- Chart
values: Turn them off through the chart’s own option when available, such asvalues.networkPolicy.enabled = false(check the chart’svalues.yamlfor the exact key). patchResources: Filter them out after rendering withpatchResources = builtins.filter (r: r.kind != "NetworkPolicy");onscope.helm.importChartorkix.helmChart.
Collection methods on importChart results
Section titled “Collection methods on importChart results”scope.helm.importChart returns a collection attribute set with the following selectors and helpers:
| Attribute or method | Signature | Description |
|---|---|---|
all | list of resources | All wrapped Kix resources in the chart. |
attrs | attrset of resources | Map of <partKey> = resource (for example, "deployment-cert-manager"). |
crds | attrset of CRD handles | Map of <Kind> = { cr; mkCR; } CRD builder handles for all CRDs rendered by the chart. |
get | kind -> name -> resource | Looks up a single resource by kind and metadata.name. Throws an evaluation error listing available resources if not found. |
find | kind -> name -> resource or null | Same as get, but returns null if the resource is not present. |
byKind | kind -> list of resources | Returns the list of wrapped resources of the given kind. |
workloads | list of resources | All Deployment, StatefulSet, DaemonSet, Job, and CronJob resources in the chart. |
excluding | [ resources ] -> list | Returns all minus the listed resources. |
depsOf | resource -> list | Returns the reconstructed intra-chart dependencies of resource. |
edges | list of { from; to; type; } | List of reconstructed intra-chart dependency edge records, where from and to are wrapped Kix resources and type names the rule that inferred the edge. |
autoRoot | resource | Automatically selects the chart’s sole Service, or (when there are no Services) its sole Deployment, StatefulSet, or DaemonSet. Throws an evaluation error if there are multiple Services, no Services and multiple workloads, or neither Services nor workloads. |
replaceResource | kind -> name -> newResource -> collection | Replaces a wrapped chart resource with a custom Kix resource and re-evaluates all downstream chart resources so they depend on newResource. |
mkParts | { root, extraParts ? { }, extraRequires ? [ ], out ? { } } -> parts | Produces the build return set (attrs // extraParts // { root = { resource = root; requires = ...; out = ...; }; }), wiring all other chart resources into root.requires and populating root.out.byKind.<Kind>.<name> (plus root.out.crds when the chart renders CRDs). root is required. When root is a workload (Deployment, StatefulSet, DaemonSet, Job, or CronJob) selected by exactly one Service in the chart, that Service’s name, fqdn, selector, ports, and url are also promoted onto root.out. |
Extracting CRDs only with scope.helm.importChartCrds
Section titled “Extracting CRDs only with scope.helm.importChartCrds”When you write a native Kix package for an operator but want to load its CRD definitions from the upstream Helm chart tarball, use scope.helm.importChartCrds:
1crdList = scope.helm.importChartCrds {2 inherit chart scope;3};scope.helm.importChartCrds accepts { chart, scope, releaseName ? "release", values ? { }, helmVersion ? "4" } and returns a list of wrapped CustomResourceDefinition resources. Pass helmVersion = "3"; to render the chart’s CRDs with Helm 3.
Helm versions
Section titled “Helm versions”kix.helmChart, scope.helm.importChart, and scope.helm.importChartCrds render charts with Helm 4 (4.3.1) by default. If an upstream chart relies on template behavior that changed in Helm 4, set helmVersion = "3"; to render that chart with Helm 3 (3.19.1). Upstream Helm 3 receives security fixes until 10 February 2027. Passing any other major version fails evaluation and lists the shipped versions.
The exact Helm release for each major version is pinned in kix/lib/helm-versions.json and shipped with Kix. A new version of Kix can change a Helm version in the Kix runtime (for example, a Helm security or patch update). Because helm template output feeds into resource identity hashes (kix.run/identity-hash), the Kix library and Kix must name the same Helm version. Each cluster pinned to a version of Kix builds with the matching version of the Kix library, and Kix stops when they differ (see When the Kix library does not match Kix). kix upgrade updates the Kix library tag in flake.nix and flake.lock when upgrading to a new version of Kix.
How helm template affects chart features
Section titled “How helm template affects chart features”Kix renders charts offline by running helm template with an isolated empty home directory, never contacting a cluster:
1helm template <releaseName> <chart> --values values.json --namespace <namespace> [--include-crds] [--no-hooks] [--kube-version <v>] [<extraFlags>...]Kix passes --include-crds when includeCrds = true (the default), --no-hooks when includeHooks = false, --kube-version <v> when kubeVersion is set on scope.helm.importChart, and then any extraFlags.
| Chart feature | Behavior in Kix | How to configure |
|---|---|---|
| Hooks | Kix renders hooks by default (includeHooks = true), drops test hooks (helm.sh/hook containing test), and strips helm.sh/* annotations (strip.helmAnnotations = true). Remaining hook objects are applied as ordinary resources: Kix ignores hook phases (pre-install, post-upgrade, and so on), weights, and delete policies, and chart workloads do not wait for hook Jobs automatically. Kix also strips ttlSecondsAfterFinished from Jobs and skips unchanged resources on later deploys, so finished hook Jobs stay on the cluster and do not rerun. | On scope.helm.importChart, pass extraEdges = [ { from = { kind = "Deployment"; name = "my-app"; }; to = { kind = "Job"; name = "my-app-migrate"; }; } ]; to make a workload wait for a migration Job, or set includeHooks = false to omit hooks. On kix.helmChart (which lacks includeHooks and extraEdges), filter hooks out with patchResources or use scope.helm.importChart. |
lookup | Always returns an empty map ({}) in both Helm 3.19.1 and 4.3.1. Templates that branch on lookup (for example, to reuse an existing generated password) take the empty branch on every build. | Not configurable; Kix cannot query cluster resources from lookup today. |
.Release.IsInstall / .Release.IsUpgrade | .Release.IsInstall is always true, and .Release.IsUpgrade is always false. | Not configurable. |
.Capabilities.KubeVersion | Uses Helm’s compiled-in default (v1.37.0 in Helm 4.3.1, v1.34.0 in Helm 3.19.1) unless overridden, and does not track the cluster’s Kubernetes version. scope.helm.importChartCrds always passes --kube-version 1.32.0. | Set kubeVersion on scope.helm.importChart (kix.helmChart has no kubeVersion argument). |
.Capabilities.APIVersions | Contains only built-in Kubernetes API groups (such as apps/v1). Custom resource groups (such as monitoring.coreos.com/v1) are absent, so .Capabilities.APIVersions.Has checks for CRDs evaluate to false. | Pass extraFlags = [ "--api-versions" "monitoring.coreos.com/v1" ]; on scope.helm.importChart. When the CRD belongs to another Kix package, build the custom resource in Kix instead (for example, with kix.monitor), because a chart-rendered custom resource lacks a dependency link to the other package’s CRD and fails validation check 21. |
CRDs in crds/ | Helm never templates files in crds/. By default (includeCrds = true), Kix passes --include-crds and manages those CRDs like any other resource: creating them on first deploy and updating them via server-side apply when they change (unlike upstream helm install, which skips existing CRDs and never upgrades or deletes them). Kix never deletes CRDs automatically during prune or kix gc. Templated CRDs under templates/ are always included. | Set includeCrds = false to omit files in crds/. |
Adopting a chart written for Helm 3
Section titled “Adopting a chart written for Helm 3”- Chart compatibility: Kix renders charts with Helm 4 (
4.3.1) by default. According to the upstream Helm overview, charts deployable with Helm 3 should be deployable with Helm 4, andapiVersion: v2charts inChart.yamlcontinue to work. - Default
KubeVersion: Helm4.3.1defaults.Capabilities.KubeVersiontov1.37.0(up fromv1.34.0in Helm3.19.1). If a chart sets akubeVersionconstraint inChart.yamlor branches on.Capabilities.KubeVersion, setkubeVersiononscope.helm.importChartto match your cluster’s Kubernetes version. - Install-time Helm 4 changes: Helm 4 moved post-renderers into plugins and made server-side apply the default for new installs (Helm overview). Neither change affects Kix, which runs
helm templatewithout post-renderers and applies manifests itself. - Pinning Helm 3: If a chart renders differently under Helm 4, set
helmVersion = "3";to render it with Helm3.19.1.
How project builders fetch and render charts
Section titled “How project builders fetch and render charts”How fetchHelmChart and importChart run depends on the project’s builder in kix.toml:
builder = "kix"(default): Kix runs thehelmprograms in the Kix runtime (3.19.1or4.3.1) to pull each chart tarball, verify its SRIhash, runhelm template, and store the rendered manifests in Kix’s local store (~/.cache/kix/store).builder = "nix": The machine’s Nix fetches the chart and runs the same Helm release (kix/lib/helm-versions.json) with the samehelm templateflags during evaluation (allow-import-from-derivationmust betrue, the Nix default). A chart renders the same way under either builder.
mkImport
Section titled “mkImport”Clusters frequently rely on services or platform components that live outside the Kix cluster configuration, such as a cloud-managed PostgreSQL instance (RDS or Cloud SQL), an external OIDC provider, or a CNI / storage driver pre-installed by a managed Kubernetes control plane (EKS, GKE, or k3s).
kix.mkImport creates an import definition that can be bound in instances.<namespace>.<name>.package (or inside a cluster flavor). Imports participate in dependency resolution, role binding, and contract checking without emitting workload manifests. At build time, Kix emits a kix.run/v1alpha1 PackageInstance marker with metadata.annotations."kix.run/mode" = "import" (and spec.mode = "import") so kix deploy can verify any expected in-cluster resources before deploying consumers.
1# Importing an external RDS PostgreSQL database in cluster configuration2{ ref, packages, kix, ... }:3{4 instances.app.rds-login = {5 package = packages.secret;6 config.source = ./secrets/rds-login.sops.yaml;7 config.keys = [ "username" "password" ];8 };9 instances.app.database.package = kix.mkImport {10 scope = "namespace";11 out = {12 host = "app.abc123.eu-west-1.rds.amazonaws.com";13 port = "5432";14 database = "app";15 tls = true;16 credentials = ref.app.rds-login;17 };18 };19}kix.mkImport arguments
Section titled “kix.mkImport arguments”| Argument | Type | Default | Description |
|---|---|---|---|
from | package or null | null | Optional Kix package evaluated against a synthetic import scope to derive its default out surface and root resource kind and apiVersion hints. Does not inherit meta.roles or crds from from.meta (unless from’s root.out exposes out.crds). |
out | attrset | { } | Output fields exposed to downstream consumers (host, fqdn, port, credentials, storageClassName, etc.). May contain ref.<namespace>.<instance> at any depth of plain attribute sets (see Referencing instances in out and namespace scope). When both from and out are set, out overrides matching keys on the package-derived out. |
kind | string or null | Derived from from’s root resource, or null | Optional Kubernetes kind of an existing in-cluster resource ("Service", "Deployment", "StorageClass", etc.). When present, Kix stamps kix.run/import-kind (and kix.run/import-name when out.name is set) on the PackageInstance import marker so kix deploy checks that the resource exists in the cluster. |
apiVersion | string or null | Derived from from’s root resource, or null | API version stamped as kix.run/import-apiversion on the import marker when kind is present. Not inferred from kind when from is null. |
namespace | string or null | null | Namespace of the existing in-cluster resource. Defaults to the import instance’s namespace when null. Set this when the cluster blocks writes to the resource’s namespace (such as kube-system on GKE Autopilot) so the import instance can live in another namespace. When namespace differs from the instance’s namespace, Kix stamps kix.run/import-namespace on the PackageInstance import marker so build validation and kix deploy look for the resource there. |
roles | list of strings | [ ] | Platform roles satisfied by this import ("cni", "dns", "loadBalancer", "metricsApi", "storageClasses", etc.). Not inherited from from.meta.roles. |
crds | list of { group, kind, plural, version, servedVersions?, crdScope?, factBehavior?, readiness?, usesAtLeast?, holdsData? } | [ ] | Pre-installed CRDs provided by this import (version is required on each entry). Wrapped as CRD reference handles, emitted as CRD ref markers while the import is active, and exposed to consumers at dep.out.crds.<Kind>. |
annotationDomains | list of strings | [ ] | Annotation domains read by controllers outside Kix (for example, "eks.amazonaws.com"). The architecture.annotationDomainOwnership rule allows annotations under these domains on any instance without requiring a dependency on this import. If a managed package also declares the domain in meta.annotationDomains, the managed package takes precedence and consumers must depend on it. Declaring the same domain on two imports fails evaluation. |
dnsPeers | list or null | null | DNS endpoints allowed on UDP and TCP port 53 by generated network policies when this import claims the "dns" role. Each entry is { namespace?; podSelector; } (namespace defaults to the import’s namespace) or { cidr; } (rejected by the cilium enforcer). When null, policies allow pods labeled k8s-app: kube-dns in kube-system. See DNS peers. |
scope | "cluster" | "namespace" | "cluster" | Which namespaces resolve a dependency to this import by name. The default offers it to every namespace, unlike a managed package with meta.scope unset; "namespace" keeps it to its own namespace, even against ref. When several imports answer one name, name the one you mean with deps.<arg> = ref.<namespace>.<instance>. |
Referencing instances in out and namespace scope
Section titled “Referencing instances in out and namespace scope”In a cluster definition, out may contain ref.<namespace>.<instance> at any depth of plain attribute sets. Write { ref, ... }: in the cluster module header so ref is in scope. Kix replaces each ref with that instance (so expressions such as dep.out.credentials.out.keyRef "password" work in the consumer without consumer changes) and adds the referenced instance to the import marker’s dependencies, so kix deploy applies the secret before the import.
A ref in out does not activate an optional instance. A ref to an inactive instance, or to the import itself, fails the build.
A pod reads Secrets only from its own namespace, and Kix refuses a Secret from another namespace at build time. Because of this, an import that carries a login in out.credentials (such as an external RDS or Cloud SQL database matching kix.contracts.postgresDatabase, an authenticated smtp server, or an external oidc provider) sits in the consumer’s namespace beside its secret, with scope = "namespace". An import without a login can keep the default scope = "cluster" and serve every namespace. When several namespaces connect to the same external service with their own secrets, a Nix let binding can share the common settings across the per-namespace imports.
Three ways to use kix.mkImport
Section titled “Three ways to use kix.mkImport”- Direct
outimport (out = { ... }): Provide the exact.outcontract expected by consumers (such ashost,port,database, andcredentialsfor an external database, orstorageClassName = "gp3"withroles = [ "storageClasses" ]). - Package-derived import (
from = packages.experimental.coredns; roles = [ "dns" ];): Evaluates the referenced Kix package in an import scope to extract its default.outsurface and rootkind/apiVersionwhile discarding its deployment manifests. Passrolesorcrdsexplicitly when the import should also claim platform roles or expose CRD ref markers. In this import scope,scopeprovidesinstanceName,namespaceName,namespace,selectorLabels,labelStyle,fail,rbac, the resource and workload builders (mkResource,mkClusterResource,mkCR,mkDeployment,mkStatefulSet,mkDaemonSet,mkJob,mkCronJob),mkServiceRef, andmkSecretRef. If the package reads any otherscopeattribute (such asscope.mkSecret,scope.mkCRD,scope.mkCRDRef, orscope.helm), Kix stops the build with an error. For those packages, omitfromand setout(andcrds, if needed) directly. - Hybrid import (
from = packages.experimental.coredns; roles = [ "dns" ]; out = { ... };): Starts fromfrom’s default.outsurface and overrides specific output fields inout.
Role shadowing and optional = true
Section titled “Role shadowing and optional = true”When a cluster flavor defines a pre-installed capability using kix.mkImport:
- An import instance with
optional = true(such asplatform-dnson cloud flavors) activates only when at least one active instance in the cluster depends on it through a required build argument (by name, alias, or role) or an explicitdeps.<arg> = ref.<namespace>.<instance>. Providing a core platform role does not by itself activate anoptional = trueimport; imports that must always be active (such asplatform-storage) setoptional = false. - If the cluster operator explicitly instantiates a managed Kix package that provides the same role (for example, deploying a managed
ciliumorcorednsinstance), the managed instance automatically shadows and deactivates the flavor’s"shadowable"import instance so the two never conflict.