Skip to content

Commit 97957e8

Browse files
committed
Document the controller scaffolding
1 parent 66c9896 commit 97957e8

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

cmd/scaffold-controller/main.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,6 @@ import (
1919
"golang.org/x/text/language"
2020
)
2121

22-
// TODO:
23-
// - generate bundle manifest with make (it requires installing openshift-sdk, wich would need to be installed on every CI run. Perhaps not worth it.)
24-
// - Documentation
25-
26-
// Then, one needs to:
27-
// Add to `cmd/resource-generator/main.go` and run `make generate`
28-
// Add the new client to `internal/scope/scope.go`
29-
// Add to `cmd/manager/main.go`
30-
// Implement TODOs
31-
// Run the tests
32-
// Update README
33-
3422
//go:embed data
3523
var data embed.FS
3624

website/docs/development/index.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
11
# Developing controllers
22

33
This documentation goes over the different steps needed to write a new controller from scratch.
4+
5+
## Using the controller scaffolding generator
6+
7+
ORC comes with a controller scaffolding tool that does most of the heavy work when writing a new controller.
8+
It asks a series of questions, then generates stubs for the API, controller implementation, tests and client code.
9+
10+
To run the scaffolding tool:
11+
```bash
12+
$ go run ./cmd/scaffold-controller
13+
```
14+
15+
Once it returned successfully, there are still a few manual steps:
16+
17+
* Add the new resource to `cmd/resource-generator/main.go` and run `make generate`.
18+
* Add the new client to `internal/scope/scope.go`, `internal/scope/provider.go`, and `internal/scope/mock.go`.
19+
* Add the controller to `cmd/manager/main.go`.
20+
* Implement all the TODOs. Search the code for `TODO(scaffolding)` to find them all.
21+
* Iterate on your controller and get all the tests running.
22+
* Run `make generate-bundle` to generate the OLM bundle manifests.
23+
* Update the `README.md` file to list the new controller.
24+
25+
The following pages go into the details for writing controllers.

0 commit comments

Comments
 (0)