This is the Kubernetes operator of Kairos, for day-2 operations of Kairos clusters. It provides custom resources for running operations on nodes, upgrading Kairos, and building OS artifacts.
For user documentation (installation, usage, examples), see the Kairos Operator docs.
For one-shot semantics and reusing manifests (generateName, kubectl create), see the One-off sections in the OSArtifact, NodeOp, and NodeOpUpgrade pages under the operator documentation.
Found a bug, or want to request a feature? Open it on kairos-io/kairos, including issues about this repository. Every Kairos issue lives in one place, so you never have to work out which repository to file against.
This project is managed with kubebuilder.
api/v1alpha1/-NodeOpandNodeOpUpgradetypes (node operations and upgrades).api/v1alpha2/-OSArtifacttypes (OS image building: iso, cloud, azure, gce, netboot, uki).internal/controller/- reconcilers:nodeop_controller.go,nodeopupgrade_controller.go,osartifact_controller.go, plus internalnodelabeler_controller.go/nodelabeler_daemonset_controller.go(no CRD, manages the labeler DaemonSet).config/- kustomize manifests: CRDs, RBAC, deployment, dev overrides.charts/- Helm chart for deploying the operator.test/e2e/- ginkgo end-to-end suites.examples/- sample CRs.
API types live in api/ (see layout above). Add new fields to the appropriate version's types; new CRDs go into a new version package.
When you change API types, regenerate the generated code and CRDs, then sync the CRDs into the Helm chart:
make update-crdsThis runs make generate (DeepCopy), make manifests (CRDs), and make sync-crds (copies config/crd/bases/ into charts/kairos-operator/crds/). You can also run the pieces individually:
make generate # DeepCopy
make manifests # CRDs
make sync-crds # copy config/crd/bases/ -> charts/kairos-operator/crds/Commit the regenerated files and the synced chart CRDs together. Use make diff-crds to check sync locally.
There are multiple test suites in this project:
Unit tests (using envtest):
make testController tests (OSArtifact tests requiring a real cluster):
make controller-testsThis will set up a kind cluster, install the CRDs, and run OSArtifact controller tests. It does not deploy the operator.
End-to-end tests:
make test-e2eOr using ginkgo directly:
ginkgo test/e2eAll controller tests (including NodeOp, NodeOpUpgrade, and OSArtifact):
ginkgo internal/controllerNote: OSArtifact controller tests require USE_EXISTING_CLUSTER=true and will be skipped in the unit test suite. Use make controller-tests to run them: it sets up a Kind cluster and installs CRDs but does not deploy the operator, so the test (using a direct client) is the only actor.
make runruns the operator against your local cluster.make deploy-devdeploys the dev config.make install/make uninstallmanage CRDs.- Unit tests use envtest; controller tests (
make controller-tests) and e2e tests spin up a Kind cluster.
Contributions are welcome! This repo follows the main Kairos contributing guide.
- Fork the repository, then clone your fork locally. Configure your fork as the
originremote and the original repository asupstream. - Create a feature branch:
git checkout -b feat/my-change - Make your changes (see Repository layout above). For API type changes, follow API changes & CRD sync.
- Verify locally before submitting:
make lint(static analysis), plus the test suites in Running tests. - Open a PR against
main. CI runs the same suites, including theCRDs synccheck.