Documentation ¶
Index ¶
- func GetControllerReferenceForCurrentPod(client kubernetes.Interface, targetNamespace string, ...) (*corev1.ObjectReference, error)
- 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) Warning(reason, message string)
- func (r *LoggingEventRecorder) Warningf(reason, messageFmt string, args ...interface{})
- func (r *LoggingEventRecorder) WithComponentSuffix(suffix string) Recorder
- type Recorder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetControllerReferenceForCurrentPod ¶
func GetControllerReferenceForCurrentPod(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.
Types ¶
type InMemoryRecorder ¶
func NewInMemoryRecorder ¶
func NewInMemoryRecorder(sourceComponent string) 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) 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
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 // ComponentName returns the current source component name for the event. // This allows to suffix the original component name with 'sub-component'. ComponentName() string }
Recorder is a simple event recording interface.
func NewKubeRecorder ¶
func NewKubeRecorder(client corev1client.EventInterface, sourceComponentName string, involvedObjectRef *corev1.ObjectReference) Recorder
NewKubeRecorder returns new event recorder.
func NewLoggingEventRecorder ¶
NewLoggingEventRecorder provides event recorder that will log all recorded events via klog.
func NewRecorder ¶
func NewRecorder(client corev1client.EventInterface, sourceComponentName string, involvedObjectRef *corev1.ObjectReference) Recorder
NewRecorder returns new event recorder.