Documentation ¶
Overview ¶
Package events provides a Recorder and additional helpers to record Kubernetes Events on an external HTTP endpoint.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Recorder ¶
type Recorder struct { // URL address of the events endpoint. Webhook string // Name of the controller that emits events. ReportingController string // Retryable HTTP client. Client *retryablehttp.Client // EventRecorder is the Kubernetes event recorder. EventRecorder kuberecorder.EventRecorder // Scheme to look up the recorded objects. Scheme *runtime.Scheme // Log is the recorder logger. Log logr.Logger }
Recorder posts events to the Kubernetes API and any other event recorder webhook address, like the GitOps Toolkit notification-controller.
Use it by embedding EventRecorder in reconciler struct:
import ( ... kuberecorder "k8s.io/client-go/tools/record" ... ) type MyTypeReconciler { client.Client // ... etc. kuberecorder.EventRecorder }
Use NewRecorder to create a working Recorder.
func NewRecorder ¶
func NewRecorder(mgr ctrl.Manager, log logr.Logger, webhook, reportingController string) (*Recorder, error)
NewRecorder creates an event Recorder with a Kubernetes event recorder and an external event recorder based on the given webhook. The recorder performs automatic retries for connection errors and 500-range response codes from the external recorder.
func NewRecorderForScheme ¶ added in v0.51.1
func NewRecorderForScheme(scheme *runtime.Scheme, eventRecorder kuberecorder.EventRecorder, log logr.Logger, webhook, reportingController string) (*Recorder, error)
NewRecorderForScheme creates an event Recorder with a Kubernetes event recorder and an external event recorder based on the given webhook. The recorder performs automatic retries for connection errors and 500-range response codes from the external recorder.
func (*Recorder) AnnotatedEventf ¶ added in v0.13.0
func (r *Recorder) AnnotatedEventf( object runtime.Object, annotations map[string]string, eventtype, reason string, messageFmt string, args ...interface{})
AnnotatedEventf constructs an event from the given information and performs a HTTP POST to the webhook address. It also logs the event if debug logs are enabled in the logger.