Documentation ¶
Overview ¶
Package events provides a Recorder and additional helpers to record Kubernetes Events on an external HTTP endpoint.
Index ¶
- Constants
- type Event
- type Recorder
- func (r *Recorder) EventErrorf(object corev1.ObjectReference, metadata map[string]string, reason string, ...) error
- func (r *Recorder) EventInfof(object corev1.ObjectReference, metadata map[string]string, reason string, ...) error
- func (r *Recorder) Eventf(object corev1.ObjectReference, metadata map[string]string, ...) error
Constants ¶
const ( // EventSeverityTrace represents a trace event, usually // informing about actions taken during reconciliation. EventSeverityTrace string = "trace" // EventSeverityInfo represents an informational event, usually // informing about changes. EventSeverityInfo string = "info" // EventSeverityError represent an error event, usually a warning // that something goes wrong. EventSeverityError string = "error" )
These constants define valid event severity values.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { // The object that this event is about. // +required InvolvedObject corev1.ObjectReference `json:"involvedObject"` // Severity type of this event (trace, info, error) // +kubebuilder:validation:Enum=trace,info;error // +required Severity string `json:"severity"` // The time at which this event was recorded. // +required Timestamp metav1.Time `json:"timestamp"` // A human-readable description of this event. // Maximum length 39,000 characters. // +kubebuilder:validation:MaxLength=39000 // +required Message string `json:"message"` // A machine understandable string that gives the reason // for the transition into the object's current status. // +required Reason string `json:"reason"` // Metadata of this event, e.g. apply change set. // +optional Metadata map[string]string `json:"metadata,omitempty"` // Name of the controller that emitted this event, e.g. `source-controller`. // +required ReportingController string `json:"reportingController"` // ID of the controller instance, e.g. `source-controller-xyzf`. // +optional ReportingInstance string `json:"reportingInstance,omitempty"` }
Event is a report of an event issued by a controller. +kubebuilder:object:generate=true
func (*Event) DeepCopy ¶ added in v0.9.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Event.
func (*Event) DeepCopyInto ¶ added in v0.9.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
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 }
Recorder posts events to the webhook address.
func NewRecorder ¶
NewRecorder creates an event Recorder with default settings. The recorder performs automatic retries for connection errors and 500-range response codes.
func (*Recorder) EventErrorf ¶
func (r *Recorder) EventErrorf( object corev1.ObjectReference, metadata map[string]string, reason string, messageFmt string, args ...interface{}) error
EventErrorf records an event with error severity.
func (*Recorder) EventInfof ¶
func (r *Recorder) EventInfof( object corev1.ObjectReference, metadata map[string]string, reason string, messageFmt string, args ...interface{}) error
EventInfof records an event with information severity.