Documentation ¶
Index ¶
- func ExtractContainersFromPod(pod *corev1.Pod) map[string]*Container
- type Container
- type ContainerList
- func (cl *ContainerList) AddContainer(c *Container)
- func (cl ContainerList) EnsureContainer(c *Container) error
- func (cl *ContainerList) EnsurePodStatus(pod *corev1.Pod) error
- func (cl *ContainerList) GetContainer(uid string) (*Container, bool)
- func (cl *ContainerList) RemoveContainer(uid string) error
- func (cl *ContainerList) UpdateContainer(c *Container) error
- type Loggregator
- type LoggregatorAppMeta
- type LoggregatorLogger
- type PodWatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Container ¶
type Container struct { PodName string Namespace string Name string PodUID string UID string InitContainer bool State *corev1.ContainerState LoggregatorOptions config.LoggregatorOptions Loggregator *Loggregator AppMeta *LoggregatorAppMeta }
type ContainerList ¶
type ContainerList struct { Containers map[string]*Container KubeConfig *rest.Config LoggregatorOptions config.LoggregatorOptions Tails sync.WaitGroup }
func (*ContainerList) AddContainer ¶
func (cl *ContainerList) AddContainer(c *Container)
func (ContainerList) EnsureContainer ¶
func (cl ContainerList) EnsureContainer(c *Container) error
EnsureContainer make sure the container exists in the list and we are monitoring it.
func (*ContainerList) EnsurePodStatus ¶
func (cl *ContainerList) EnsurePodStatus(pod *corev1.Pod) error
EnsurePodStatus handles a pod event by adding or removing container tailing goroutines. Every running container in the monitored namespace has its own goroutine that reads its log stream. When a container is stopped we stop the relevant gorouting (if it is still running, it could already be stopped because of an error).
func (*ContainerList) GetContainer ¶
func (cl *ContainerList) GetContainer(uid string) (*Container, bool)
func (*ContainerList) RemoveContainer ¶
func (cl *ContainerList) RemoveContainer(uid string) error
func (*ContainerList) UpdateContainer ¶
func (cl *ContainerList) UpdateContainer(c *Container) error
UpdateContainer decides whether a container should be added, left alone or removed from the container list. It does that but checking the state of of the container.
type Loggregator ¶
type Loggregator struct { Meta *LoggregatorAppMeta ConnectionOptions config.LoggregatorOptions KubeClient *kubernetes.Clientset LoggregatorClient *loggregator.IngressClient }
func NewLoggregator ¶
func NewLoggregator(m *LoggregatorAppMeta, kubeClient *kubernetes.Clientset, connectionOptions config.LoggregatorOptions) *Loggregator
func (*Loggregator) Envelope ¶
func (l *Loggregator) Envelope(message []byte) *loggregator_v2.Envelope
func (*Loggregator) SetupLoggregatorClient ¶
func (l *Loggregator) SetupLoggregatorClient() error
func (*Loggregator) Tail ¶
func (l *Loggregator) Tail(namespace, pod, container string) error
type LoggregatorAppMeta ¶
type LoggregatorLogger ¶
type LoggregatorLogger struct{}
func (LoggregatorLogger) Panicf ¶
func (LoggregatorLogger) Panicf(message string, args ...interface{})
func (LoggregatorLogger) Printf ¶
func (LoggregatorLogger) Printf(message string, args ...interface{})
type PodWatcher ¶
type PodWatcher struct { Config config.ConfigType Containers ContainerList Manager eirinix.Manager }
func NewPodWatcher ¶
func NewPodWatcher(config config.ConfigType) *PodWatcher
func (*PodWatcher) EnsureLogStream ¶
func (pw *PodWatcher) EnsureLogStream(manager eirinix.Manager) error
EnsureLogStream ensures that the already running pod logs are tracked and sets the latest RV found to be able to track future changes. It gets the current RV to start watching on and reads the pods currently running in the namespace to process them with EnsurePodStatus. This allows the PodWatcher to stream logs of currently running pods if restarted (or updated).
func (*PodWatcher) Finish ¶
func (pw *PodWatcher) Finish()