promtailconfig

package
v0.0.0-...-fff67ff Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortKeys

func SortKeys(keys []Key)

Types

type Handler

type Handler interface {
	AddConfig(key Key, yamlContent string)
	DelConfig(key Key)
}

Handler is an interface that delivers operations required to sync between events created by pods with related configmap and the actual promtail's configmap.

func NewPeriodicHandler

func NewPeriodicHandler(initialDelay time.Duration, period time.Duration, promMap *PromtailConfigMap) (Handler, error)

type Key

type Key struct {
	Namespace     string
	Labels        string
	ContainerName string
}

Key allows to identify a promtail config for a specific ContainerName running in a pod selectable by Labels in Namespace. Key's values must be rendered as comments into the final config map so it's possible to load the map from a config file and recreate existing keys. To make the Keys easily comparable and possible to use as map keys, Labels are not stored as "map[string]string", but just string of format "k1=v1,k2=v2,..."

func NewKey

func NewKey(pod *v1.Pod, containerName string) *Key

type PeriodicHandler

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

PeriodicHandler is an implementation of handler, that loads promtail's configmap at the beginning, parses it and stores with appropriate Keys in the snippet field. Then it allows for AddConfig/DelConfig calls to be made. PeriodicHandler has a configurable timer, that periodically renders all the data in snippets and produces a new value for the promtail's configmap.

func (*PeriodicHandler) AddConfig

func (p *PeriodicHandler) AddConfig(key Key, yamlContent string)

func (*PeriodicHandler) DelConfig

func (p *PeriodicHandler) DelConfig(key Key)

type PromtailConfigMap

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

func NewPromtailConfigMap

func NewPromtailConfigMap(k8sClient k8sclient.Interface, namespace, name, configKeyName string) (*PromtailConfigMap, error)

func (*PromtailConfigMap) Load

func (p *PromtailConfigMap) Load() (map[Key]string, error)

func (*PromtailConfigMap) Update

func (p *PromtailConfigMap) Update(newSnippets map[Key]string) error

Jump to

Keyboard shortcuts

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