Want to add a new feature (or fix bugs) in the operator? This document will help you understand how to build, test, and deploy the operator.
Before you begin, ensure you have have a development environment well suited for Go and Kubernetes development:
- Install Go version 1.21 or higher. We recommend using an interactive development environment (IDE) that supports go, such as GoLand or VSCode.
- Install a container engine that can build and run container images. We recommend docker or podman.
- Obtain access to a Kubernetes cluster that you have administrative permissions on. This can be a
"micro" distribution such as kind, or a fully managed cluster like
GKE. We recommend
kind
for local development.
This project builds a Kubernetes operator for Shipwright projects, such as build. It is scaffolded with Operator SDK and its related Kubernetes development framework, kubebuilder. Those who are new to Kubernetes concepts like controllers and custom resources are encouraged to try the Operator SDK go tutorial first.
Operator SDK and kubebuilder are strongly opinionated when it comes to project structure.
Contributors should use operator-sdk
commands or
kubebuilder
commands when adding new custom
resources or controllers. Code within the pkg/
directory is generally safe from these
generators and should be reserved for core reconciliation logic ("business logic").
This project also generates an operator bundle, which is used to deploy the operator on a cluster with Operator Lifecycle Manager (OLM). Refer to the OLM core tasks for the steps needed to deploy an operator with OLM.
Most features and bug fixes only require the operator and its related custom resource definitions to be deployed on Kubernetes. The local development guide describes how to build, deploy, and test your changes against a Kubernetes cluster.
Changes that modify the bundle
directory, however, may require the operator to be packaged and
deployed with Operator Lifecycle Manager. Refer to the
OLM development guide for instructions on how to build,
deploy, and test the operator with OLM.
For maintainers who are asked to issue releases, please refer to the release process document.