events

package
v0.0.0-...-45f8ed2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package events provides events status for a namespace.

Index

Constants

View Source
const (
	EventNormal  = corev1.EventTypeNormal
	EventWarning = corev1.EventTypeWarning
)

Values for EventType. These constants are copied from k8s.io/api/core/v1 as a convenience.

Variables

This section is empty.

Functions

func WatchEventStatus

func WatchEventStatus(ctx context.Context, client kubernetes.Interface, namespace string) (chan *EventStatus, func(), error)

WatchEventStatus returns a channel on which the status of the events in the supplied namespace are written.

Types

type EventStatus

type EventStatus struct {
	Name      string // name of event
	UID       types.UID
	Namespace string
	Message   string
	Type      string
	Event     corev1.Event // copy of the raw event
}

A EventStatus represents the status of a single Event.

func EventToStatus

func EventToStatus(event *corev1.Event) *EventStatus

EventToStatus returns a pointer to a new EventStatus for an event.

func GetEventStatus

func GetEventStatus(ctx context.Context, client kubernetes.Interface, namespace string) ([]*EventStatus, error)

GetEventStatus returns the status of the events found in the supplied namespace.

func (*EventStatus) Equal

func (e *EventStatus) Equal(q *EventStatus) bool

func (*EventStatus) String

func (e *EventStatus) String() string

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

A Watcher watches event updates.

func NewWatcher

func NewWatcher(ctx context.Context, client kubernetes.Interface, cancel func()) (*Watcher, error)

NewWatcher returns a Watcher on the provided client or an error. The cancel function is called when the Watcher determines an event has permanently failed. The Watcher will exit if the context provided is canceled, an error is encountered, or Cleanup is called.

func (*Watcher) Cleanup

func (w *Watcher) Cleanup(err error) error

Cleanup should be called when the Watcher is no longer needed. If the Watcher encountered an error the provided err is logged and the Watcher error is returned, otherwise err is returned.

func (*Watcher) SetProgress

func (w *Watcher) SetProgress(value bool)

SetProgress determins if progress output should be displayed while watching.

Jump to

Keyboard shortcuts

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