Skip to content

Commit 9623a8b

Browse files
authored
Merge pull request #4884 from rayowang/distributing-kubebuilder-project
📖 guide for building a bundle with kubebuilder-based projects for management by OLM and/or publication on OperatorHub.io
2 parents e76b8a1 + 4109d2e commit 9623a8b

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

docs/book/src/faq.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,36 @@ type StructName struct {
158158
- Users still receive error notifications from the Kubernetes API for invalid `timeField` values.
159159
- Developers can directly use the parsed TimeField in their code without additional parsing, reducing errors and improving efficiency.
160160
161+
## How to build a bundle with Kubebuilder-based projects to be managed by OLM and/or published in OperatorHub.io?
162+
163+
You’ll need to create an [OLM bundle][olm-bundle-docs] to publish your operator.
164+
You can use the [Operator SDK][operator-sdk] and the command `operator-sdk generate kustomize manifests` to generate the files.
165+
After running the above command, you will find the `ClusterServiceVersion (CSV) ` in the path `config/manifests/bases/`. After that, you can run the bundle generation command:
166+
```
167+
kustomize build config/manifests | \
168+
operator-sdk generate bundle \
169+
--version 0.1.0 \
170+
--package my-operator \
171+
--channels alpha \
172+
--default-channel alpha
173+
174+
```
175+
176+
Now you will have the bundle structure such as:
177+
178+
```
179+
bundle
180+
├── manifests
181+
│   ├── app.mydomain.com_myapps.yaml
182+
│   ├── kubebuilderdemo-controller-manager-metrics-service_v1_service.yaml
183+
│   ├── kubebuilderdemo-metrics-reader_rbac.authorization.k8s.io_v1_clusterrole.yaml
184+
│   ├── kubebuilderdemo-myapp-admin-role_rbac.authorization.k8s.io_v1_clusterrole.yaml
185+
│   ├── kubebuilderdemo-myapp-editor-role_rbac.authorization.k8s.io_v1_clusterrole.yaml
186+
│   ├── kubebuilderdemo-myapp-viewer-role_rbac.authorization.k8s.io_v1_clusterrole.yaml
187+
│   └── my-example-operator.clusterserviceversion.yaml
188+
└── metadata
189+
└── annotations.yaml
190+
```
161191
162192
163193
[k8s-obj-creation]: https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/#how-to-create-objects
@@ -168,4 +198,6 @@ type StructName struct {
168198
[permission-issue]: https://github.com/kubernetes/kubernetes/issues/82573
169199
[permission-PR]: https://github.com/kubernetes/kubernetes/pull/89193
170200
[controller-gen]: ./reference/controller-gen.html
171-
[controller-tool-pr]: https://github.com/kubernetes-sigs/controller-tools/pull/536
201+
[controller-tool-pr]: https://github.com/kubernetes-sigs/controller-tools/pull/536
202+
[olm-bundle-docs]: https://operator-framework.github.io/operator-controller/
203+
[operator-sdk]: https://operatorhub.io/docs/

0 commit comments

Comments
 (0)