events

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 15 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EventsMap = map[EventName]*EventSchema{
	"ExampleEvent": {
		Name:                "ExampleEvent",
		Reason:              "ExampleEvent",
		Action:              "ExampleEvent",
		Type:                EventTypeWarning,
		ReportingController: "controller",
		Message:             "ExampleEvent message.",
	},
}

Functions

func GetEventKey added in v0.1.8

func GetEventKey(event *corev1.Event) string

getEventKey builds unique event key based on source, involvedObject, reason, message

func IsEventDisabled added in v0.1.0

func IsEventDisabled(name EventName) bool

Types

type Event

type Event struct {
	// Object is the reference of the k8s object which this event corresponds to
	Object runtime.Object
	// RelatedObject is the ref to related object (optional)
	RelatedObject runtime.Object
	// ReportingInstance is the name of the reporting instance
	ReportingInstance string
	// Name is the name of the event to be looked up in event schema
	Name EventName
}

type EventConfig added in v0.1.0

type EventConfig struct {
	DisabledEvents []string
}

type EventName added in v0.1.0

type EventName string
var (
	EventExampleEvent EventName = "ExampleEvent"
)

type EventRecorder

type EventRecorder interface {
	// RecordEvent is used to record a new event
	RecordEvent(context.Context, *Event) error
	// WithSlice returns a new recorder with slice name added
	WithSlice(string) EventRecorder
	// WithNamespace returns a new recorder with namespace name added
	WithNamespace(string) EventRecorder
	// WithProject returns a new recorder with project name added
	WithProject(string) EventRecorder
}

EventRecorder is used to record events from a component

func NewEventRecorder added in v0.1.0

type EventRecorderOptions added in v0.1.0

type EventRecorderOptions struct {
	// Version is the version of the component
	Version string
	// Cluster  is the name of the cluster
	Cluster string
	// Project is the name of the project
	Project string
	// Slice is the name of the slice (optional)
	Slice string
	// Namespace is the namespace this event recorder corresponds to (optional)
	Namespace string
	// Component is the component which uses the event recorder
	Component string
}

type EventSchema added in v0.1.0

type EventSchema struct {
	Name                EventName
	Reason              string
	Action              string
	Type                EventType
	ReportingController string `yaml:"reportingController"`
	Message             string
}

func GetEvent added in v0.1.0

func GetEvent(name EventName, eventsMap map[EventName]*EventSchema) (*EventSchema, error)

type EventType added in v0.1.0

type EventType string
var (
	EventTypeWarning EventType = "Warning"
	EventTypeNormal  EventType = "Normal"
)

Jump to

Keyboard shortcuts

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