Introducing a new way to review your PRs.

Read the announcement

replicatedhq / kurl

Production-grade, airgapped Kubernetes installer combining upstream k8s with overlays and popular components

View on GitHub

19 documents · Updated Nov 23, 2026

docs / os-matrix-validation

OS matrix validation

The OS matrix is the registry that models each supported host operating system and its effect on kURL support. It connects a host identity to test images, setup actions, capability limits, package behavior, preflight results, and build outputs so one OS entry can drive all related support checks.

Registry model

The registry gives each OS a test identity and, when needed, an installer identity. A pool is an ordered view of OS entries used to define a test group. This separates the OS itself from the set of tests that use it.

The main identity fields have these roles:

  • id is the OS identity written to TestGrid.
  • key is an internal unique key. It defaults to id and allows two entries to use one TestGrid identity with different pinned details.
  • name, version, and vmimageuri describe the host shown in a test definition.
  • preinit describes commands that prepare the host before a test. preinitStyle preserves whether the commands are empty, quoted, or a YAML block.
  • distro, versionMajor, and packageFamily identify the host for installer and package rules.

The current registry includes broad OS families such as Amazon Linux, CentOS, Oracle Linux, Rocky Linux, and Ubuntu. Pools such as os-latest, os-full, and os-customer-common select different test views without changing the OS definition itself. os-matrix.yaml• L37-275

References: os-matrix.yaml• L24-35 pkg/…/osmatrix.go• L59-105

Capability rules

Capability fields turn host limits into rules that can be applied to installer specifications. A Kubernetes floor excludes a host when the requested Kubernetes version is lower than that floor. An explicit dockerSupported: false excludes a host when the test uses Docker.

The capability result is a de-duplicated list of TestGrid OS IDs. If one OS fails both rules, it appears once. An OS with no Kubernetes floor is not excluded by Kubernetes version, and an unset Docker value does not declare that Docker is unsupported.

Kubernetes version checks use the major and minor parts. A version that cannot be read as a major-minor value is treated as newest, so it does not add a capability exclusion. The registry currently gives Ubuntu 24.04, Ubuntu 26.04, and Amazon Linux 2023 a Kubernetes floor of 1.24 and marks them as not supporting Docker. os-matrix.yaml• L205-248

References: pkg/…/capability.go• L5-74 pkg/…/capability_test.go• L52-112 os-matrix.yaml• L205-248

Package and build rules

Package and build fields describe which host support paths must be produced for an OS. hostPackagesShipped enables Ubuntu host-package predicates and install calls. packageFamily identifies the package branch used for package manifests. bundleDockerfile selects an Ubuntu Kubernetes package bundle and its matching build target.

These rules keep host package support and Kubernetes package builds aligned with the registry. The modern Ubuntu bundle uses the OS version as its base-image tag and creates the package archive for the requested Kubernetes version. Older or unmarked Ubuntu entries remain part of the general Ubuntu package list but do not receive a modern bundle target. pkg/…/shell.go• L17-29 pkg/…/makefile.go• L27-55 pkg/…/dockerfile.go• L9-81

References: os-matrix.yaml• L178-235 pkg/…/shell.go• L61-139 pkg/…/makefile.go• L5-55 pkg/…/dockerfile.go• L9-81

Preflight rules

Preflight rules expose host compatibility limits before installation or test work starts. The shared installer preflight runs OS support, Kubernetes version, and container-runtime checks for init, join, and upgrade flows. scripts/…/preflights.sh• L2-18

The OS guard accepts the matrix-generated Ubuntu support list and explicit supported cases for other distro families. It warns for known legacy systems and continues with best-effort installation. It stops for an unknown OS. The Kubernetes guard currently blocks target Kubernetes versions below 1.24 on Amazon Linux 2023. scripts/…/preflights.sh• L81-117

The matrix also derives Docker support failures from OS entries with dockerSupported: false. It derives Kubernetes support failures from entries with minKubernetes and uses one shared floor for the generated check. The Docker check warns when Docker is not supported and recommends containerd. scripts/…/preflights.sh• L199-215

The generated outcome matches the host OS by its installer distro and version. Its message uses preflightName when present, which lets a display name such as AmazonLinux differ from the TestGrid name Amazon Linux. A two-part Kubernetes floor such as 1.24 is shown as 1.24.0 in the preflight message. pkg/…/host-preflights.yaml• L542-594

The relationship between registry constraints and host preflight outcomes is:

flowchart LR
    R[OS matrix entry] --> D{Docker supported?}
    R --> K{Kubernetes floor?}
    D -->|false| DF[Docker support fail outcome]
    K -->|yes| KF[Kubernetes support fail outcome]
    DF --> H[Host preflight]
    KF --> H
    R --> S[Installer OS guard]
    S --> H

References: pkg/…/preflight.go• L5-92 scripts/…/preflights.sh• L81-117 scripts/…/preflights.sh• L199-215 pkg/…/host-preflights.yaml• L542-594 os-matrix.yaml• L205-248

Rendering and generated outputs

The matrix is rendered into committed support artifacts so TestGrid definitions and OS-sensitive installer paths use the same model. Whole-file outputs include pool OS definitions and selected Ubuntu bundle Dockerfiles. Marked regions in maintained files carry derived shell predicates, package calls, capability exclusions, preflight outcomes, containerd guards, Make targets, and package manifest cases.

Generation preserves pool order and the chosen preinit presentation. It also preserves non-generated content in marked files. The intended change path is to edit os-matrix.yaml and run the generator rather than hand-editing a derived artifact.

The generation flow has four high-level stages:

  1. Load and validate the registry.
  2. Render pool definitions and selected bundle files.
  3. Refresh marked OS-derived regions in support files.
  4. Write or compare the resulting files.
flowchart TD
    M[os-matrix.yaml] --> P[Parse and validate]
    P --> A[Render whole-file artifacts]
    P --> S[Refresh marked regions]
    A --> W[Write or check]
    S --> W
    W --> T[TestGrid and installer support files]

The command supports generate to write outputs, check to report drift, and snapshot to report the canonical TestGrid coverage view. The coverage snapshot compares each test specification and its excluded OS ID set. It protects the set of test combinations even when exclusion comments or list order change. cmd/…/main.go• L1-17 pkg/…/generate.go• L17-46 pkg/…/generate.go• L65-127 pkg/…/matrix.go• L13-64

References: cmd/…/main.go• L36-113 pkg/…/generate.go• L17-46 pkg/…/generate.go• L178-267 pkg/…/matrix.go• L25-64

Validation rules

Validation rejects a registry entry before it can produce unsafe or inconsistent output. The rules protect both the data model and the downstream formats that consume its values.

The registry requires these conditions:

  • OS IDs and keys are safe slugs and keys are unique.
  • Pool names are safe slugs and every pool reference resolves to an OS key.
  • Version values use safe characters. Ubuntu versions also use a numeric major.minor form because they become shell and image identifiers.
  • Names and cloud image URIs use restricted character sets.
  • Optional installer fields use safe forms when present.
  • A quoted preinit script cannot contain a newline. A multi-line script must use block style.
  • All non-empty Kubernetes floors are equal because one generated Kubernetes preflight check represents one floor.

Validation also checks the allowed preinit styles. Path checks protect generated paths from escaping the repository, while field checks prevent registry values from changing generated shell, YAML, Dockerfile, or path meaning. pkg/…/osmatrix.go• L19-42 pkg/…/osmatrix.go• L123-200 pkg/…/generate.go• L159-175

References: pkg/…/osmatrix.go• L123-200 pkg/…/generate.go• L159-175 pkg/…/validate_test.go• L8-143

Change checklist

When these files or sections are changed, remember to consider these:

  • An OS identity or pool change can alter both rendered TestGrid OS definitions and the OS-to-test coverage snapshot.
  • A minKubernetes or dockerSupported change must update the matching generated capability exclusion regions, host-preflight outcomes, and installer preflight behavior.
  • A new Ubuntu host-package entry must align versionMajor, packageFamily, and hostPackagesShipped with the generated shell, containerd, and manifest paths.
  • A bundleDockerfile change must keep the generated bundle path and the matching Make target aligned with the OS version.
  • A changed preinit script must keep preinitStyle compatible with its line shape.
  • A changed Kubernetes floor must keep one shared floor across every constrained OS.
  • A changed supported Ubuntu entry must keep the generated bailIfUnsupportedOS branch aligned with the matrix.

Important failure modes

TriggerConsequenceGuard
A pool names an unknown OS keyGeneration cannot render that poolRegistry indexing rejects unresolved pool references
Two entries resolve to the same keyOne OS definition would hide anotherParse validation rejects duplicate keys
Constrained OS entries use different Kubernetes floorsOne preflight exclusion clause would give the wrong result for some hostsValidation rejects divergent floors
A generated region is staleTestGrid or installer support can use old OS rulesos-matrix-gen check reports stale artifacts
A supported Ubuntu version is missing from the generated installer OS guardThe installer rejects a host that the matrix marks as supportedRegenerate the OS matrix output and run the generated-file check
A capability exclusion region loses its category marker after all constraints are removedA later new constraint may not regenerate into that regionCapability anchors preserve the tracked category
A registry value contains shell or YAML control charactersGenerated output can be malformed or unsafeField-specific validation rejects unsafe values

Key files

FileWhy to read it
os-matrix.yamlDefines the supported host identities, capability limits, package choices, pools, and generated-output selections.
pkg/…/osmatrix.goDefines the registry model, lookup rules, and boundary validation.
pkg/…/capability.goExplains how Kubernetes and Docker constraints become excluded TestGrid OS IDs.
pkg/…/preflight.goShows how capability fields become host-preflight failure outcomes.
scripts/…/preflights.shShows how generated OS support and matrix-related runtime checks affect installation before host setup continues.
pkg/…/generate.goMaps registry data to whole-file artifacts and marked generated regions.
cmd/…/main.goDefines the generate, check, and snapshot commands used to maintain derived output.
pkg/…/host-preflights.yamlShows where the generated Docker and Kubernetes host support outcomes run.
pkg/…/matrix.goDefines the coverage snapshot that guards TestGrid OS combinations.