Skip to content

Commit

Permalink
Update CODE_GENERATION.md to use rate limiting
Browse files Browse the repository at this point in the history
Updates the code generation docs to pass the default managed rate
limiter to controllers.

Signed-off-by: hasheddan <[email protected]>
  • Loading branch information
hasheddan committed Feb 20, 2021
1 parent 7f29cf3 commit 7c2b0ff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CODE_GENERATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ of the provider. Create a file called `pkg/controller/<serviceid>/setup.go` and
add the setup function like the following:
```golang
// SetupStage adds a controller that reconciles Stage.
func SetupStage(mgr ctrl.Manager, l logging.Logger) error {
func SetupStage(mgr ctrl.Manager, l logging.Logger, limiter workqueue.RateLimiter) error {
name := managed.ControllerName(svcapitypes.StageGroupKind)
return ctrl.NewControllerManagedBy(mgr).
Named(name).
Expand Down Expand Up @@ -159,7 +159,7 @@ Likely, we need to do this injection before every SDK call. The following is an
example for hook functions injected:
```golang
// SetupStage adds a controller that reconciles Stage.
func SetupStage(mgr ctrl.Manager, l logging.Logger) error {
func SetupStage(mgr ctrl.Manager, l logging.Logger, limiter workqueue.RateLimiter) error {
name := managed.ControllerName(svcapitypes.StageGroupKind)
opts := []option{
func(e *external) {
Expand Down Expand Up @@ -258,7 +258,7 @@ it's not that long.
In order to override default no-op late initialization code, we'll use the same
mechanism as others:
```golang
func SetupStage(mgr ctrl.Manager, l logging.Logger) error {
func SetupStage(mgr ctrl.Manager, l logging.Logger, limiter workqueue.RateLimiter) error {
name := managed.ControllerName(svcapitypes.StageGroupKind)
opts := []option{
func(e *external) {
Expand All @@ -283,7 +283,7 @@ and our `spec`. Here is an [example](https://github.com/crossplane/provider-aws/
After writing the function, you can use it instead of the default `alwaysUpToDate`
similar to others:
```golang
func SetupStage(mgr ctrl.Manager, l logging.Logger) error {
func SetupStage(mgr ctrl.Manager, l logging.Logger, limiter workqueue.RateLimiter) error {
name := managed.ControllerName(svcapitypes.StageGroupKind)
opts := []option{
func(e *external) {
Expand Down

0 comments on commit 7c2b0ff

Please sign in to comment.