Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#3453 from Sajiyah-Salat/raising-ev…
Browse files Browse the repository at this point in the history
…ents-extended

📖 Update Raising events doc page
  • Loading branch information
k8s-ci-robot committed Jun 13, 2023
2 parents cf78f51 + 0920c99 commit bf654e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/book/src/reference/raising-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ Following is an example of a code implementation that raises an Event.

</aside>

## How to be able to raise Events?
### How to be able to raise Events?

Following are the steps with examples to help you raise events in your controller's reconciliations.
Events are published from a Controller using an [EventRecorder]`type CorrelatorOptions struct`,
Events are published from a Controller using an [EventRecorder][Events]`type CorrelatorOptions struct`,
which can be created for a Controller by calling `GetRecorder(name string)` on a Manager. See that we will change the implementation scaffolded in `cmd/main.go`:

```go
Expand All @@ -60,6 +60,7 @@ which can be created for a Controller by calling `GetRecorder(name string)` on a
```

### Allowing usage of EventRecorder on the Controller

To raise an event, you must have access to `record.EventRecorder` in the Controller. Therefore, firstly let's update the controller implementation:
```go
import (
Expand Down Expand Up @@ -89,6 +90,7 @@ which can be created for a Controller by calling `GetRecorder(name string)` on a
}
```
### Granting the required permissions

You must also grant the RBAC rules permissions to allow your project to create Events. Therefore, ensure that you add the [RBAC][rbac-markers] into your controller:
```go
...
Expand Down

0 comments on commit bf654e0

Please sign in to comment.