Documentation ¶
Index ¶
- func GetControllerReferenceForCurrentPod(ctx context.Context, client kubernetes.Interface, targetNamespace string, ...) (*corev1.ObjectReference, error)
- func RecommendedClusterSingletonCorrelatorOptions() record.CorrelatorOptions
- type InMemoryRecorder
- type LoggingEventRecorder
- func (r *LoggingEventRecorder) ComponentName() string
- func (r *LoggingEventRecorder) Event(reason, message string)
- func (r *LoggingEventRecorder) Eventf(reason, messageFmt string, args ...interface{})
- func (r *LoggingEventRecorder) ForComponent(component string) Recorder
- func (r *LoggingEventRecorder) Shutdown()
- func (r *LoggingEventRecorder) Warning(reason, message string)
- func (r *LoggingEventRecorder) Warningf(reason, messageFmt string, args ...interface{})
- func (r *LoggingEventRecorder) WithComponentSuffix(suffix string) Recorder
- func (r *LoggingEventRecorder) WithContext(ctx context.Context) Recorder
- type Recorder
- func NewKubeRecorder(client corev1client.EventInterface, sourceComponentName string, ...) Recorder
- func NewKubeRecorderWithOptions(client corev1client.EventInterface, options record.CorrelatorOptions, ...) Recorder
- func NewLoggingEventRecorder(component string, clock clock.PassiveClock) Recorder
- func NewRecorder(client corev1client.EventInterface, sourceComponentName string, ...) Recorder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetControllerReferenceForCurrentPod ¶
func GetControllerReferenceForCurrentPod(ctx context.Context, client kubernetes.Interface, targetNamespace string, reference *corev1.ObjectReference) (*corev1.ObjectReference, error)
GetControllerReferenceForCurrentPod provides an object reference to a controller managing the pod/container where this process runs. The pod name must be provided via the POD_NAME name. Even if this method returns an error, it always return valid reference to the namespace. It allows the callers to control the logging and decide to fail or accept the namespace.
func RecommendedClusterSingletonCorrelatorOptions ¶
func RecommendedClusterSingletonCorrelatorOptions() record.CorrelatorOptions
RecommendedClusterSingletonCorrelatorOptions provides recommended event correlator options for components that produce many events (like operators).
Types ¶
type InMemoryRecorder ¶
func NewInMemoryRecorder ¶
func NewInMemoryRecorder(sourceComponent string, clock clock.PassiveClock) InMemoryRecorder
NewInMemoryRecorder provides event recorder that stores all events recorded in memory and allow to replay them using the Events() method. This recorder should be only used in unit tests.
type LoggingEventRecorder ¶
type LoggingEventRecorder struct {
// contains filtered or unexported fields
}
func (*LoggingEventRecorder) ComponentName ¶
func (r *LoggingEventRecorder) ComponentName() string
func (*LoggingEventRecorder) Event ¶
func (r *LoggingEventRecorder) Event(reason, message string)
func (*LoggingEventRecorder) Eventf ¶
func (r *LoggingEventRecorder) Eventf(reason, messageFmt string, args ...interface{})
func (*LoggingEventRecorder) ForComponent ¶
func (r *LoggingEventRecorder) ForComponent(component string) Recorder
func (*LoggingEventRecorder) Shutdown ¶
func (r *LoggingEventRecorder) Shutdown()
func (*LoggingEventRecorder) Warning ¶
func (r *LoggingEventRecorder) Warning(reason, message string)
func (*LoggingEventRecorder) Warningf ¶
func (r *LoggingEventRecorder) Warningf(reason, messageFmt string, args ...interface{})
func (*LoggingEventRecorder) WithComponentSuffix ¶
func (r *LoggingEventRecorder) WithComponentSuffix(suffix string) Recorder
func (*LoggingEventRecorder) WithContext ¶
func (r *LoggingEventRecorder) WithContext(ctx context.Context) Recorder
type Recorder ¶
type Recorder interface { Event(reason, message string) Eventf(reason, messageFmt string, args ...interface{}) Warning(reason, message string) Warningf(reason, messageFmt string, args ...interface{}) // ForComponent allows to fiddle the component name before sending the event to sink. // Making more unique components will prevent the spam filter in upstream event sink from dropping // events. ForComponent(componentName string) Recorder // WithComponentSuffix is similar to ForComponent except it just suffix the current component name instead of overriding. WithComponentSuffix(componentNameSuffix string) Recorder // WithContext allows to set a context for event create API calls. WithContext(ctx context.Context) Recorder // ComponentName returns the current source component name for the event. // This allows to suffix the original component name with 'sub-component'. ComponentName() string Shutdown() }
Recorder is a simple event recording interface.
func NewKubeRecorder ¶
func NewKubeRecorder(client corev1client.EventInterface, sourceComponentName string, involvedObjectRef *corev1.ObjectReference, clock clock.PassiveClock) Recorder
NewKubeRecorder returns new event recorder with default correlator options.
func NewKubeRecorderWithOptions ¶
func NewKubeRecorderWithOptions(client corev1client.EventInterface, options record.CorrelatorOptions, sourceComponentName string, involvedObjectRef *corev1.ObjectReference, clock clock.PassiveClock) Recorder
NewKubeRecorder returns new event recorder with tweaked correlator options.
func NewLoggingEventRecorder ¶
func NewLoggingEventRecorder(component string, clock clock.PassiveClock) Recorder
NewLoggingEventRecorder provides event recorder that will log all recorded events via klog.
func NewRecorder ¶
func NewRecorder(client corev1client.EventInterface, sourceComponentName string, involvedObjectRef *corev1.ObjectReference, clock clock.PassiveClock) Recorder
NewRecorder returns new event recorder.