Skip to content

Conversation

@mandre
Copy link
Collaborator

@mandre mandre commented Sep 9, 2025

Add a controller scaffolding tool that does most of the heavywork when writing a new controller. It asks a series of questions, then generates stubs for the API, controller implementation, tests and client code.

To run the scaffolding tool:

$ go run ./cmd/scaffold-controller

@github-actions github-actions bot added the semver:minor Backwards-compatible change label Sep 9, 2025
@mandre mandre force-pushed the scaffold-controller branch 2 times, most recently from a78704f to e50b078 Compare September 11, 2025 14:00
@mandre mandre changed the title WIP: Controller generator Controller generator Sep 11, 2025
@mandre mandre mentioned this pull request Sep 11, 2025
@mandre mandre mentioned this pull request Sep 12, 2025
@mandre mandre force-pushed the scaffold-controller branch 3 times, most recently from 97957e8 to b0cb9fc Compare September 15, 2025 12:34
@mandre
Copy link
Collaborator Author

mandre commented Sep 15, 2025

I've used this generator to work on the volumetype and volume controllers and I'm reasonably happy with its current status. I have yet to try with import dependencies and required create dependencies, but if there are bugs, we can always fix them later.

FWIW, this generator is a HUGE time saver when working on new controllers.

@mandre mandre added this to the Release 2.3 milestone Sep 16, 2025
There were a few additional resources we could generate based on the
list of resources passed to the generator. Let's do this. It minimizes
the needed steps when working on new controllers, and makes
contributions easier.
Run `make generate-resources`. Left it in a separate commit to see that
the files under the control of the generator didn't change in any
meaningful way.
For new controllers, we need to re-generate the OLM bundle manifest so
that it knows about the new CRDs. We now have a dedicated
`generate-bundle` target for it. We could it a dependency of the
`generate` target so that it's always up-to-date and checked in CI via
the `verify-generated` target, however I think it's a bad idea because
it would mean installing the operator-sdk in every CI run which is
costly for no real gain: the manifest is always generated (and thus
up-to-date) when building the OLM bundle.
Introduce a controller scaffolding tool that does most of the heavy work
when writing a new controller. It asks a series of questions, then
generates stubs for the API, controller implementation, tests and client
code.
@mandre mandre force-pushed the scaffold-controller branch from b0cb9fc to 5c76eac Compare September 25, 2025 14:33
@mandre
Copy link
Collaborator Author

mandre commented Sep 25, 2025

I'm going to merge this, as other PRs depend on it. If there are adjustment to make, we can do them in follow-up PRs.

@mandre mandre added this pull request to the merge queue Sep 25, 2025
Merged via the queue into k-orc:main with commit f93d141 Sep 25, 2025
8 checks passed
@mandre mandre deleted the scaffold-controller branch September 25, 2025 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver:minor Backwards-compatible change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant