events

package
v0.0.0-...-0597a29 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

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

type InMemoryRecorder interface {
	Events() []*corev1.Event
	Recorder
}

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

func NewLoggingEventRecorder(component string) 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) Recorder

NewRecorder returns new event recorder.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL