event

package
v0.18.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

LevelMap is a map of event type to Level

Functions

This section is empty.

Types

type Action

type Action struct {
	// Command is the command to be executed, with the bot.CrossPlatformBotName prefix.
	Command          string
	ExecutorBindings []string
	DisplayName      string
}

Action describes an automated action for a given event.

type Event

type Event struct {
	metaV1.TypeMeta
	Code            string
	Title           string
	Name            string
	Namespace       string
	Messages        []string
	Type            config.EventType
	Reason          string
	Error           string
	Level           config.Level
	Cluster         string
	Channel         string
	TimeStamp       time.Time
	Count           int32
	Action          string
	Skip            bool `json:",omitempty"`
	Resource        string
	Recommendations []string
	Warnings        []string
	Actions         []Action

	// The following fields are ignored when marshalling the event by purpose.
	// We send the whole Event struct via sink.Elasticsearch integration.
	// When using ELS dynamic mapping, we should avoid complex, dynamic objects, which could result into type conflicts.
	ObjectMeta metaV1.ObjectMeta `json:"-"`
	Object     interface{}       `json:"-"`
}

Event stores data about a given event for Kubernetes object.

WARNING: When adding a new field, check if we shouldn't ignore it when marshalling and sending to ELS.

func New

func New(objectMeta metaV1.ObjectMeta, object interface{}, eventType config.EventType, resource string) (Event, error)

New extract required details from k8s object and returns new Event object

func (*Event) HasRecommendationsOrWarnings

func (e *Event) HasRecommendationsOrWarnings() bool

HasRecommendationsOrWarnings returns true if event has recommendations or warnings.

Jump to

Keyboard shortcuts

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