Description
Context
The current Kubebuilder documentation lacks a dedicated section on how to distribute operators built with Kubebuilder. We would like either to add how to build the bundle to publish the solution in OperatorHub.io (https://operatorhub.io/) or enabling deployment with OLM (Operator Lifecycle Manager). (https://olm.operatorframework.io/) since those are common needs.
Users, can build the solution with Kubebuilder and use Operator-SDK just to generate the bundle, give a look at operator-sdk generate bundle --help
Proposal
1. Add a new section in the Kubebuilder Book:
Location: https://book.kubebuilder.io/reference/reference
Title: Distributing Your Project
This section should be added under the reference material, and include:
- An overview of the default distribution assumptions and options.
- Link to this example for inspiration:
https://github.com/kubernetes-sigs/kubebuilder/blob/master/testdata/project-v4/README.md#project-distribution
2. Add a Subsection:
Title: Publishing Kubebuilder Projects to OperatorHub.io
This should provide:
- A step-by-step guide for using
operator-sdk generate bundle
- Explanation of how Kubebuilder’s
config/manifests
output aligns with the expected bundle format. - Instructions for generating and validating:
- ClusterServiceVersion (CSV)
annotations.yaml
bundle.Dockerfile
- Overview of how the bundle enables deployment with OLM:
Provide Makefile Target that downloads the latest SDK bin in the bin/ dir and allows generating the bundle, something like:
##@ Distribution
BUNDLE_OUTPUT_DIR ?= bundle
BUNDLE_VERSION ?= 0.1.0
BUNDLE_IMG ?= controller-bundle:$(BUNDLE_VERSION)
.PHONY: bundle
bundle: manifests kustomize ## Generate operator bundle using operator-sdk
operator-sdk generate bundle \
--version $(BUNDLE_VERSION) \
--kustomize-dir config/manifests \
--output-dir $(BUNDLE_OUTPUT_DIR) \
--package $(shell basename $$PWD) \
--channels alpha \
--default-channel alpha