How installers choose and install components
The rules an installer follows to choose components from the catalog API, order them and check them once installed, with cases to test an installer against.
An installer reads the API of a catalog release and decides which components to install. This page gives the rules. Two installers that follow them choose the same components for the same configuration. Each rule has a case in conformance/select/ to test against.
What an installer starts from
Section titled “What an installer starts from”- The API of one catalog release:
catalog.jsonand each component's file. - The profile,
single-nodeormulti-node. - The distribution,
k3s,rke2orkubesolo. - The platform of the cluster's nodes, such as
linux/amd64. - The
enableanddisablelists that the person writes. Each item is a component id, such asvictoria-logs, or a capability, such aslogs.
What the installer works out
Section titled “What the installer works out”The API holds facts. An installer works out two lists for each component from them, and the rules below use both.
Tested on
Section titled “Tested on”testedOn is where a component passed its test, as distributions, each with the platforms it passed on. For each distribution in the distributions of catalog.json, take the component's measurements with that distribution and its pinned distributionVersion. A platform is in testedOn when the newest passing run on it has the component's sourceDigest and is no older than the newest failed run on it. A pass on the same day as a failure wins. A distribution without such a platform isn't in testedOn, so testedOn can be empty.
Install order
Section titled “Install order”installOrder is what installing the component installs on a profile: the components it needs, then the component. Go through its requires in order. A {component: <id>} entry names that component. A {capability: <capability>} entry names the first component in id order whose provides.capability matches and is recommended on the profile, or else the first that is optional. Put the order of each named component first, without repeats, then the component. A profile where the component is unsupported has no installOrder.
A name that is a component id names that component. Any other name is a capability, from provides.capability, and names one of the components that offer it and aren't unsupported on the profile. The installer sorts those components and takes the first:
- Components whose
testedOnlists the distribution with the platform come first. - Then components
recommendedon the profile. - Then id order.
A name that matches no capability or component id is an error, in enable and in disable.
Choose the components
Section titled “Choose the components”The installer takes these steps in order.
-
Defaults. Start from every component
recommendedon the profile. An installer may add components it needs on top of the defaults, by id or capability. They count as defaults. -
Enable. Add each component that
enablenames. It counts as enabled. -
Disable. Take out each chosen component that a
disableitem names. An id takes out that component, and a capability takes out every chosen component of that capability. A known name that matches nothing chosen does nothing. -
Leave out what can't be installed here. Take out the components below and list each with its reason. The test cases name a reason by its code, and the installer words it for the person.
When Code Left out distributionsdoesn't list the distributiondistributionsAlways. An enabled component also gets a left-outwarningdefaultsisunsupportedon the profileunsupportedAlways. An enabled component also gets a left-outwarningA chosen component that
testedOndoesn't list with the distribution and the platform stays chosen, with anuntestedwarning. This covers a component never tested there, one whose latest run there failed and one changed since its last passing run. -
Order. Go through the chosen components in id order. For each one, take its
installOrderfor the profile, which lists its dependencies and then the component. Add each id that isn't in the result yet. A component in the result that wasn't chosen is there as a dependency.A component in
installOrdermay be disabled, left out or untested:The needed component Result Is disabled, or left out for distributionsorunsupportedError needs-disabledHas a testedOnwithout the distribution and the platformThe needed component is installed, with an untestedwarningFor example, say VictoriaLogs needs the VictoriaMetrics operator, which is tested only on k3s. On rke2, the installer installs the operator with VictoriaLogs and warns that the operator is untested there, whether VictoriaLogs is a default or enabled.
The result has the components in install order, each with why it's installed (default, enabled or dependency), the components left out with their reasons and the warnings. Because each installOrder already places a component after its dependencies, the result does too. It doesn't depend on the order of enable or disable.
Errors
Section titled “Errors”The installer stops and installs nothing on these errors. The kind names the error in the test cases.
kind | When | Tell the person |
|---|---|---|
unknown | A name matches no capability or component id | The name |
needs-disabled | A chosen component needs one that is disabled, or left out for distributions or unsupported | Both components |
Install and check
Section titled “Install and check”Install the components in the order of the result, and remove the installed components that the result doesn't have. Component file format describes the releases of each one, the digests that pin them and the other fields an installer reads.
Once a component is installed, run each of its health checks. A check with a condition is one kubectl wait: --for=condition=<condition>, then the objects of resource, then -n <namespace> when it has one, and --timeout=<timeout>. Give the objects as <resource>/<name>, as <resource> -l <key>=<value>,… for a selector, or as <resource> --all for all: true. Wait until the objects exist before you wait on the condition, because kubectl wait fails at once when there is none. A check of a Deployment, DaemonSet or StatefulSet has no condition. It is ready when the rollout is complete, so run kubectl rollout status <resource>/<name>, or kubectl rollout status <resource> -l <key>=<value>,… for a selector, with -n <namespace> and --timeout=<timeout>. kubectl compares observedGeneration with generation, so the pods of an earlier rollout never make a new one ready. <resource> comes from the kind:
kind | <resource> |
|---|---|
APIService | apiservices.apiregistration.k8s.io |
DaemonSet | daemonsets.apps |
Deployment | deployments.apps |
GatewayClass | gatewayclasses.gateway.networking.k8s.io |
Node.longhorn.io | nodes.longhorn.io |
Pod | pods |
StatefulSet | statefulsets.apps |
For example, Longhorn's nodes-ready check runs:
kubectl wait --for=condition=Ready nodes.longhorn.io --all -n longhorn-system --timeout=60sAn installer may use its own time limit in place of timeout. When a check fails, show the reason and message of the object, as kubectl describe does, and then its advice. The advice says what to do, not what went wrong.
Test cases
Section titled “Test cases”conformance/select/ has one case for each rule above. The directory is in the repository and in bundle.tar.gz, so an installer that pins a catalog commit or release reads the cases of that version. schema/v1/select-case.schema.json defines the format.
description: A default not tested on the distribution is installed with a warning.components: # each component with only the fields selection reads, and the testedOn # and installOrder that the installer works out - id: traefik provides: {capability: ingress} defaults: {single-node: recommended, multi-node: recommended} distributions: [k3s, rke2, kubesolo] testedOn: - {distribution: k3s, platforms: [linux/amd64]} - {distribution: rke2, platforms: [linux/amd64]} - {distribution: kubesolo, platforms: [linux/amd64]} - id: victoria-logs provides: {capability: logs} defaults: {single-node: recommended, multi-node: recommended} distributions: [k3s, rke2, kubesolo] testedOn: - {distribution: k3s, platforms: [linux/amd64]} - {distribution: kubesolo, platforms: [linux/amd64]}config: profile: multi-node distribution: rke2 platform: linux/amd64 # add: what the installer adds to the defaults # enable, disable: the person's listswant: components: # in install order - {id: traefik, why: default} - {id: victoria-logs, why: default} warnings: # in any order - {kind: untested, component: victoria-logs, distribution: rke2} # leftOut: {<id>: {reason: …, …}} # error: {kind: unknown, name: …}, in place of the restTo run a case:
- Take
componentsas the catalog, withtestedOnandinstallOrderas given. The capability of each component is itsprovides.capability. A profile withoutinstallOrdermeans the component alone. - Choose with
config. - Compare the result with
want. A list or map thatwantleaves out is empty. Compare each reason, warning and error by its code and fields, not by the words an installer shows.