kube_events_manager

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: Apache-2.0 Imports: 22 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KubeEventCh chan KubeEvent
)

Functions

This section is empty.

Types

type KubeEvent

type KubeEvent struct {
	ConfigId  string
	Events    []string
	Namespace string
	Kind      string
	Name      string
}

KubeEvent contains event type and k8s object identification

type KubeEventsInformer

type KubeEventsInformer struct {
	ConfigId           string
	Kind               string
	EventTypes         []OnKubernetesEventType
	JqFilter           string
	Checksum           map[string]string
	SharedInformer     cache.SharedInformer
	SharedInformerStop chan struct{}
}

func NewKubeEventsInformer

func NewKubeEventsInformer() *KubeEventsInformer

func (*KubeEventsInformer) HandleKubeEvent

func (ei *KubeEventsInformer) HandleKubeEvent(obj interface{}, kind string, newChecksum string, eventType string, sendSignal bool, debug bool) error

HandleKubeEvent sends new KubeEvent to KubeEventCh obj doesn't contains Kind information, so kind is passed from Run() argument. TODO refactor: pass KubeEvent as argument TODO add delay to merge Added and Modified events (node added and then labels applied — one hook run on Added+Modifed is enough)

func (*KubeEventsInformer) InitializeItemsList

func (ei *KubeEventsInformer) InitializeItemsList(list runtime.Object, debug bool) error

func (*KubeEventsInformer) Run

func (ei *KubeEventsInformer) Run()

func (*KubeEventsInformer) ShouldHandleEvent

func (ei *KubeEventsInformer) ShouldHandleEvent(checkEvent OnKubernetesEventType) bool

func (*KubeEventsInformer) Stop

func (ei *KubeEventsInformer) Stop()

type KubeEventsManager

type KubeEventsManager interface {
	Run(eventTypes []OnKubernetesEventType, kind, namespace string, labelSelector *metaV1.LabelSelector, jqFilter string, debug bool) (string, error)
	Stop(configId string) error
}

func Init

func Init() (KubeEventsManager, error)

type KubeNamespaceSelector

type KubeNamespaceSelector struct {
	MatchNames []string `json:"matchNames"`
	Any        bool     `json:"any"`
}

type MainKubeEventsManager

type MainKubeEventsManager struct {
	KubeEventsInformersByConfigId map[string]*KubeEventsInformer
}

func NewMainKubeEventsManager

func NewMainKubeEventsManager() *MainKubeEventsManager

func (*MainKubeEventsManager) Run

func (em *MainKubeEventsManager) Run(eventTypes []OnKubernetesEventType, kind, namespace string, labelSelector *metaV1.LabelSelector, jqFilter string, debug bool) (string, error)

func (*MainKubeEventsManager) Stop

func (em *MainKubeEventsManager) Stop(configId string) error

type OnKubernetesEventConfig

type OnKubernetesEventConfig struct {
	Name              string                  `json:"name"`
	EventTypes        []OnKubernetesEventType `json:"event"`
	Kind              string                  `json:"kind"`
	Selector          *metav1.LabelSelector   `json:"selector"`
	NamespaceSelector *KubeNamespaceSelector  `json:"namespaceSelector"`
	JqFilter          string                  `json:"jqFilter"`
	AllowFailure      bool                    `json:"allowFailure"`
	DisableDebug      bool                    `json:"disableDebug"`
}

type OnKubernetesEventType

type OnKubernetesEventType string
const (
	KubernetesEventOnAdd    OnKubernetesEventType = "add"
	KubernetesEventOnUpdate OnKubernetesEventType = "update"
	KubernetesEventOnDelete OnKubernetesEventType = "delete"
)

Jump to

Keyboard shortcuts

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