events

package
v0.10.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package events implements the eventing framework to receive and relay kubernetes events, and a framework to publish events to the Kubernetes API server.

Index

Constants

View Source
const (
	// InvalidCLIParameters signifies invalid CLI parameters
	InvalidCLIParameters = "FatalInvalidCLIParameters"

	// InitializationError signifies an error during initialization
	InitializationError = "FatalInitializationError"

	// InvalidCertificateManager signifies that the certificate manager is invalid
	InvalidCertificateManager = "FatalInvalidCertificateManager"

	// CertificateIssuanceFailure signifies that a request to issue a certificate failed
	CertificateIssuanceFailure = "FatalCertificateIssuanceFailure"
)

Kubernetes Fatal Event reasons Fatal events are prefixed with 'Fatal' to help the event recording framework to wait for fatal events to be recorded prior to aborting.

Variables

This section is empty.

Functions

func Publish

func Publish(message PubSubMessage)

Publish is the Publish implementation for PubSub

func Subscribe

func Subscribe(aTypes ...announcements.AnnouncementType) chan interface{}

Subscribe is the Subscribe implementation for PubSub

func Unsub

func Unsub(unsubChan chan interface{})

Unsub is the Unsub implementation for PubSub. It is synchronized, upon exit the channel is guaranteed to be both unsubbed to all topics and closed. This is a necessary step to guarantee garbage collection

Types

type EventRecorder

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

EventRecorder is a type used to record Kubernetes events

func GenericEventRecorder

func GenericEventRecorder() *EventRecorder

GenericEventRecorder is a singleton that returns a generic EventRecorder type. The EventRecorder returned needs to be explicitly initialized by calling the 'Initialize' method on the object

func NewEventRecorder

func NewEventRecorder(object runtime.Object, kubeClient kubernetes.Interface, namespace string) (*EventRecorder, error)

NewEventRecorder returns a new EventRecorder object and an error in case of errors

func (*EventRecorder) ErrorEvent

func (e *EventRecorder) ErrorEvent(err error, reason string, messageFmt string, args ...interface{})

ErrorEvent records a Warning Kubernetes event

func (*EventRecorder) FatalEvent

func (e *EventRecorder) FatalEvent(err error, reason string, messageFmt string, args ...interface{})

FatalEvent records a Warning Kubernetes event

func (*EventRecorder) Initialize

func (e *EventRecorder) Initialize(object runtime.Object, kubeClient kubernetes.Interface, namespace string) error

Initialize initializes an uninitialized EventRecorder object

func (*EventRecorder) NormalEvent

func (e *EventRecorder) NormalEvent(reason string, messageFmt string, args ...interface{})

NormalEvent records a Normal Kubernetes event

func (*EventRecorder) WarnEvent

func (e *EventRecorder) WarnEvent(reason string, messageFmt string, args ...interface{})

WarnEvent records a Warning Kubernetes event

type PubSub

type PubSub interface {
	// Subscribe returns a channel subscribed to the specific type/s of announcement/s passed by parameter
	Subscribe(aTypes ...announcements.AnnouncementType) chan interface{}

	// Publish publishes the message to all subscribers that have subscribed to <message.AnnouncementType> topic
	Publish(message PubSubMessage)

	// Unsub unsubscribes and closes the channel on pubsub backend
	// Note this is a necessary step to ensure a channel can be
	// garbage collected when it is freed.
	Unsub(unsubChan chan interface{})
}

PubSub is a simple interface to call for pubsub functionality in front of a pubsub implementation

type PubSubMessage

type PubSubMessage struct {
	AnnouncementType announcements.AnnouncementType
	OldObj           interface{}
	NewObj           interface{}
}

PubSubMessage represents a common messages abstraction to pass through the PubSub interface

Jump to

Keyboard shortcuts

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