tester

package
Version: v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterState

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

ClusterState contains information about all containers in cluster

func NewClusterState

func NewClusterState(ignoreFunc IgnoringContainersFunc) *ClusterState

NewClusterState creates ClusterState

func (*ClusterState) ForgetPod

func (cs *ClusterState) ForgetPod(ns, podName string)

ForgetPod removes all information about pod state

func (*ClusterState) GetUnstableContainers

func (cs *ClusterState) GetUnstableContainers(requiredStabilityPeriod time.Duration) []ContainerAndState

GetUnstableContainers returns all Containers which are not ready or restarts in recent requiredStabilityPeriod

func (*ClusterState) UpdateState

func (cs *ClusterState) UpdateState(c Container, update StateUpdate)

UpdateState update state of the container

type Container

type Container struct {
	Ns            string
	PodName       string
	ContainerName string
}

Container represents information about container in pod

type ContainerAndState

type ContainerAndState struct {
	Container Container
	State     State
}

ContainerAndState aggregates Container and State

type IgnoringContainersFunc

type IgnoringContainersFunc func(c Container) bool

IgnoringContainersFunc defines function for ignoring containers

func IgnoreContainersByRegexp

func IgnoreContainersByRegexp(podPattern, nsPattern, containerPattern string) (IgnoringContainersFunc, error)

IgnoreContainersByRegexp provides ignore function which checks containers against patterns

type PodWatcher

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

PodWatcher allows to listen for changes in pods

func NewPodWatcher

func NewPodWatcher(podListWatcher cache.ListerWatcher, onPodUpdate func(pod *v1.Pod), onPodDelete func(ns, name string)) *PodWatcher

NewPodWatcher creates pod watcher.

onPodUpdate function will be called every time update for pod occurs, and onPodDelete on each delete event. Both functions should be fast, and O(1) as they are blocking event ingestion by shared informer.

func (*PodWatcher) StartListeningToEvents

func (w *PodWatcher) StartListeningToEvents() error

StartListeningToEvents starts listening on pod events

func (*PodWatcher) Stop

func (w *PodWatcher) Stop()

Stop stops watching on pod events. It has to be called to properly free up all resources. Be aware that resource release is only signaled but there is no way to wait till resources are actually released.

type State

type State struct {
	Ready      bool
	RestartCnt int32
	ReadySince time.Time
}

State stores information about container's state

type StateUpdate

type StateUpdate struct {
	Ready      bool
	RestartCnt int32
}

StateUpdate contains information about changes in container's State

Jump to

Keyboard shortcuts

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