Documentation ¶
Overview ¶
Package recorder defines interfaces for working with Kubernetes event recorders.
You can use these to emit Kubernetes events associated with a particular Kubernetes object.
Example (Event) ¶
package main import ( corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/recorder" ) var ( recorderProvider recorder.Provider somePod *corev1.Pod ) func main() { // recorderProvider is a recorder.Provider recorder := recorderProvider.GetEventRecorderFor("my-controller") // emit an event with a fixed message recorder.Event(somePod, corev1.EventTypeWarning, "WrongTrousers", "It's the wrong trousers, Gromit!") }
Output:
Example (Eventf) ¶
package main import ( corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/recorder" ) var ( recorderProvider recorder.Provider somePod *corev1.Pod ) func main() { // recorderProvider is a recorder.Provider recorder := recorderProvider.GetEventRecorderFor("my-controller") // emit an event with a variable message mildCheese := "Wensleydale" recorder.Eventf(somePod, corev1.EventTypeNormal, "DislikesCheese", "Not even %s?", mildCheese) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider interface { // NewRecorder returns an EventRecorder with given name. GetEventRecorderFor(name string) record.EventRecorder }
Provider knows how to generate new event recorders with given name.
Click to show internal directories.
Click to hide internal directories.