Skip to content

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

1 watching

Forks

Repository files navigation

Kairos Operator

Tests

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.

Development notes

This project is managed with kubebuilder.

Repository layout

  • api/v1alpha1/ - NodeOp and NodeOpUpgrade types (node operations and upgrades).
  • api/v1alpha2/ - OSArtifact types (OS image building: iso, cloud, azure, gce, netboot, uki).
  • internal/controller/ - reconcilers: nodeop_controller.go, nodeopupgrade_controller.go, osartifact_controller.go, plus internal nodelabeler_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 changes & CRD sync

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-crds

This 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.

Running tests

There are multiple test suites in this project:

Unit tests (using envtest):

make test

Controller tests (OSArtifact tests requiring a real cluster):

make controller-tests

This 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-e2e

Or using ginkgo directly:

ginkgo test/e2e

All controller tests (including NodeOp, NodeOpUpgrade, and OSArtifact):

ginkgo internal/controller

Note: 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.

Local development

  • make run runs the operator against your local cluster.
  • make deploy-dev deploys the dev config.
  • make install / make uninstall manage CRDs.
  • Unit tests use envtest; controller tests (make controller-tests) and e2e tests spin up a Kind cluster.

Contributing

Contributions are welcome! This repo follows the main Kairos contributing guide.

Workflow

  1. Fork the repository, then clone your fork locally. Configure your fork as the origin remote and the original repository as upstream.
  2. Create a feature branch: git checkout -b feat/my-change
  3. Make your changes (see Repository layout above). For API type changes, follow API changes & CRD sync.
  4. Verify locally before submitting: make lint (static analysis), plus the test suites in Running tests.
  5. Open a PR against main. CI runs the same suites, including the CRDs sync check.

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages