events

package
v0.0.0-...-4b75dde Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: Apache-2.0 Imports: 21 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.

View Source
const (
	// CertificateRotationFailure signifies that a certificate failed to rotate
	CertificateRotationFailure = "CertificateRotationFailure"
)

Kubernetes Event reasons

Variables

This section is empty.

Functions

This section is empty.

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 EventType

type EventType string

EventType represents the type of event we have received from Kubernetes: added, updated, or deleted

const (
	// Added is an EventType representing a new object being added.
	Added EventType = "added"

	// Updated is an EventType representing an object being updated.
	Updated EventType = "updated"

	// Deleted is an EventType represent an object being deleted.
	Deleted EventType = "deleted"
)

type Kind

type Kind string

Kind is used to record the kind of announcement

const (
	// ProxyUpdate is a special osm event kind that does not correspond to a k8s event, but instead is used as an
	// indicator for osm to trigger a broadcast to update all proxies.
	ProxyUpdate Kind = "proxy"

	// Pod is a Kind for Kubernetes pod events.
	Pod Kind = "pod"

	// Endpoint is the Kind for Kubernetes events.
	Endpoint Kind = "endpoint"

	// Namespace is the Kind for Kubernetes namespace events.
	Namespace Kind = "namespace"

	// Service is the Kind for Kubernetes service events.
	Service Kind = "service"

	// ServiceAccount is the Kind for Kubernetes service account events.
	ServiceAccount Kind = "serviceaccount"

	// Secret is the Kind for Kubernetes secret events.
	Secret Kind = "secret"

	// TrafficSplit is the Kind for Kubernetes traffic split events.
	TrafficSplit Kind = "trafficsplit"

	// RouteGroup is the Kind for Kubernetes route group events.
	RouteGroup Kind = "routegroup"

	// TCPRoute is the Kind for Kubernetes tcp route events.
	TCPRoute Kind = "tcproute"

	// TrafficTarget is the Kind for Kubernetes traffic target events.
	TrafficTarget Kind = "traffictarget"

	// Ingress is the Kind for Kubernetes ingress events.
	Ingress Kind = "ingress"

	// MeshConfig is the Kind for Kubernetes meshconfig events.
	MeshConfig Kind = "meshconfig"

	// MeshRootCertificate is the Kind for Kubernetes mrc events.
	MeshRootCertificate Kind = "meshrootcertificate"

	// Egress is the Kind for Kubernetes egress events.
	Egress Kind = "egress"

	// IngressBackend is the Kind for Kubernetes ingress backend events.
	IngressBackend Kind = "ingressbackend"

	// RetryPolicy is the Kind for Kubernetes retry policy events.
	RetryPolicy Kind = "retry"

	// UpstreamTrafficSetting is the Kind for Kubernetes UpstreamTrafficSetting events.
	UpstreamTrafficSetting Kind = "upstreamtrafficsetting"

	// Telemetry is the Kind for Kubernetes Telemetry events.
	Telemetry Kind = "telemetry"

	// ExtensionService is the Kind for Kubernetes ExtensionService events.
	ExtensionService Kind = "extensionservice"
)

func GetKind

func GetKind(obj interface{}) Kind

GetKind returns the Kind for the given k8s object.

func (Kind) Added

func (at Kind) Added() string

Added returns the string representation of the Kind combined with the added keyword to be used for a PubSub Topic.

func (Kind) Deleted

func (at Kind) Deleted() string

Deleted returns the string representation of the Kind combined with the deleted keyword to be used for a PubSub Topic.

func (Kind) String

func (at Kind) String() string

String returns the string representation of the Kind

func (Kind) Updated

func (at Kind) Updated() string

Updated returns the string representation of the Kind combined with the updated keyword to be used for a PubSub Topic.

type PubSubMessage

type PubSubMessage struct {
	Kind   Kind
	Type   EventType
	OldObj interface{}
	NewObj interface{}
}

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

func (*PubSubMessage) Topic

func (m *PubSubMessage) Topic() string

Topic returns the PubSub Topic for the given message.

Jump to

Keyboard shortcuts

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