Skip to content

Commit

Permalink
Update creating-events
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajiyah-Salat committed Apr 30, 2023
1 parent ac4dd5d commit 76a174b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/book/src/reference/creating-events
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Recent Events for an object can be viewed by running `kubectl describe`

{% method %}

###how to implement the solution to raise an event:

a) You need to pass the recorder when you set up the recorder for the controller when the event will be raised see: https://github.com/kubernetes-sigs/kubebuilder/blob/master/testdata/project-v4-with-deploy-image/main.go#L103
b) You need to add the makers to add the RBAC permissions to allow your Operator/controller to raise the event see: https://github.com/kubernetes-sigs/kubebuilder/blob/master/testdata/project-v4-with-deploy-image/controllers/memcached_controller.go#L66 and run make manifests
c) You can check an example of the event being called in: https://github.com/kubernetes-sigs/kubebuilder/blob/master/testdata/project-v4-with-deploy-image/controllers/memcached_controller.go#L299-L303

Events are published from a Controller using an [EventRecorder](https://github.com/kubernetes/client-go/blob/master/tools/record/event.go#L56),
which can be created for a Controller by calling `GetRecorder(name string)` on a Manager.

Expand Down

0 comments on commit 76a174b

Please sign in to comment.