watcher

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWatchChannelClosed = errors.New("watcher channel has closed")

ErrWatchChannelClosed should restart watcher

Functions

func InjectionConfigsFromConfigMap

func InjectionConfigsFromConfigMap(cm v1.ConfigMap) ([]*config.InjectionConfig, error)

InjectionConfigsFromConfigMap parse items in a configmap into a list of InjectionConfigs

Types

type Config

type Config struct {
	Namespace       string
	ConfigMapLabels map[string]string
}

Config is a configuration struct for the Watcher type

func NewConfig

func NewConfig() *Config

NewConfig returns a new initialized Config

type Event

type Event uint8

Event is what happened to the config (add/delete/update)

const (
	// EventAdd is a new ConfigMap
	EventAdd Event = iota
	// EventUpdate is an Updated ConfigMap
	EventUpdate
	// EventDelete is a deleted ConfigMap
	EventDelete
)

type K8sConfigMapWatcher

type K8sConfigMapWatcher struct {
	Config
	// contains filtered or unexported fields
}

K8sConfigMapWatcher is a struct that connects to the API and collects, parses, and emits sidecar configurations

func New

func New(cfg Config) (*K8sConfigMapWatcher, error)

New creates a new K8sConfigMapWatcher

func (*K8sConfigMapWatcher) Get

func (c *K8sConfigMapWatcher) Get() (cfgs []*config.InjectionConfig, err error)

Get fetches all matching ConfigMaps

func (*K8sConfigMapWatcher) Watch

func (c *K8sConfigMapWatcher) Watch(notifyMe chan<- interface{}, stopCh <-chan struct{}) error

Watch watches for events impacting watched ConfigMaps and emits their events across a channel

type Message

type Message struct {
	Event           Event
	InjectionConfig config.InjectionConfig
}

Message is a message that describes a change and payload to a sidecar configuration

Jump to

Keyboard shortcuts

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