How-to guide / Start and inspect a Kix project
Upgrade a project to a new version of Kix
These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.
A project names its version of Kix in the tag of its Kix library input,
which flake.lock records. kix upgrade moves it to a newer one. It builds every cluster before and after, so you see what the
new version changes before you deploy.
Where the version lives
Section titled “Where the version lives”The tag of the kix input in flake.nix names the project’s version of
Kix, and flake.lock records it:
1inputs.kix.url = "github:kix-run/kix/v0.10.0";kix upgrade updates that tag and refreshes flake.lock. If flake.nix
contains another matching URL for the same repository and Kix cannot tell which
input owns it, kix upgrade stops and asks you to edit inputs.kix.url
yourself. To upgrade some clusters while keeping others on their current
version, see
Keep clusters on different versions of Kix.
Pin a project that has no version
Section titled “Pin a project that has no version”When flake.lock pins no version of Kix, for example because the project has
no flake.lock or its kix input has no tag, Kix stops and asks you to pin
one. Run kix upgrade --to with the version the project uses now:
❱ kix upgrade --to 0.10.0 With no version to compare against, kix upgrade builds nothing. It writes
the tag into flake.nix, creates or updates flake.lock, and names the files
to commit. To try a prerelease, name it in full, such as --to 0.11.0-rc.1.
Pin the version the project uses now rather than a newer one. A later
kix upgrade then builds the project with both versions and shows what the
newer one changes.
Upgrade a project from Kix 0.9
Section titled “Upgrade a project from Kix 0.9”A project set up for Kix 0.9 names its version in a kix line in
kix.toml, and the Kix library input in flake.nix usually has no tag. Kix
now reads the version from flake.lock, and every command stops with error
[K4476] while the kix line is there. Move the project over in this order,
so that the last step shows what the new version changes.
First, install Kix 0.10 or later and check that kix --version prints it.
Kix 0.9 installs it with kix self update. You can also use the install script from
Install and run Kix.
Run every step below with the new version of Kix. kix upgrade in Kix 0.9 writes
the kix line back into kix.toml, so the next command stops with
[K4476] again.
Next, note the version in the kix line, such as kix = "0.9", and delete
the line from kix.toml.
Then, if flake.nix names the Kix library input kixpkgs, rename it to
kix. Kix stops with error [K9179] until you do. Rename every use of the
input, including inputs.kixpkgs.lib.mkFlake and any
kixpkgs.inputs.nixpkgs.follows line:
1{2 inputs = {3 nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";4 kix.url = "github:kix-run/kix";5 kix.inputs.nixpkgs.follows = "nixpkgs";6 };7
8 outputs = inputs: inputs.kix.lib.mkFlake {9 inherit inputs;10 clusters.production = ./clusters/production.nix;11 };12}After that, pin the project to the version it uses now, the one the kix line
named. A minor version such as 0.9 pins its newest release:
❱ kix upgrade --to 0.9 This builds nothing. It adds the tag to the url of the kix input and
writes flake.lock. Commit kix.toml, flake.nix, and flake.lock.
Finally, move to the new version:
❱ kix upgrade kix upgrade builds every cluster with the version you pinned and with the
new one, and lists what changed, as in Run the upgrade.
Preview the upgrade
Section titled “Preview the upgrade”Start from a clean git working tree, so that you can see each file the upgrade changes. Then preview it:
❱ kix upgrade --dry-run The preview opens with the version the project uses and the release it would
move to, such as Kix 0.10.0 -> 0.12.1 (preview, no files changed). It lists
the release notes that apply to your project under Config changes required,
Behavior & data changes, Security fixes, and Notes. It changes nothing.
To move to a release other than the newest, pass --to, such as
--to 0.10 for the newest 0.10 release. To wait until a release has been out
for a while, set min-age for the project in kix.toml:
1[upgrade]2min-age = "7d"Run the upgrade
Section titled “Run the upgrade”❱ kix upgrade When every cluster builds with the new version, kix upgrade pins the project
to it in flake.nix and flake.lock. Read the Manifest changes
summary for each cluster, then commit the changed files with
kix-upgrade.json. When no object changed and nothing needs a review, the
run ends with Upgraded to Kix 0.12.1. Ready to deploy.
Fix a build that fails
Section titled “Fix a build that fails”When a cluster does not build with the new version, kix upgrade moves one
minor release at a time and stops at the first release the cluster does not
build with. It prints the end of each error, the matching config changes,
and where the full build log is, and leaves the project pinned to that
release:
1Stopped at Kix 0.11.2 (step 1 of 2 toward 0.12.1).2flake.nix and flake.lock are pinned to 0.11.2 so you can fix this step first.3Next: fix the error above, then run `kix upgrade` to continue to 0.12.1.Make the edit the release note describes, then run kix upgrade again. It
tries that release again and continues to the newest one.
Review what needs a person
Section titled “Review what needs a person”kix upgrade exits with status 3 when the project builds but you should
read what changed before you deploy. It ends with a numbered list under
Upgraded to Kix 0.12.1, but review before deploying:. An item names:
- objects that changed in any cluster; read them, or run
kix plan <cluster>to see what deploying would change in the live cluster, - objects marked
[review: <Kind>], such as a Secret, a ClusterRole, or an Ingress whose TLS settings changed, - a change that alters behavior with no build error, or
- a release that every cluster must deploy before the project upgrades
further. Commit the step, deploy every cluster, then run
kix upgradeagain.kix deployrefuses a cluster that would skip that release.
To see the field changes for a cluster, compare the new build with the cluster before you deploy:
❱ kix plan my-cluster Acknowledge a change to stored data
Section titled “Acknowledge a change to stored data”When a change moves or reinterprets the data a package stores, kix deploy
blocks deploys for the upgraded clusters until someone acknowledges the change.
The error prints the release note. Read it, take any backup it asks for, and
acknowledge the change by ID:
❱ kix upgrade --acknowledge K0012 Commit kix-upgrade.json, so that whoever deploys next sees the
acknowledgement.