kubernetes

package
v0.0.0-...-15868fb Latest Latest
Warning

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

Go to latest
Published: May 1, 2019 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Client = GetClientset

Client is for tests

View Source
var DynamicClient = GetDynamicClient

Functions

func AggregatePodWatcher

func AggregatePodWatcher(namespaces []string, aggregate chan watch.Event) (func(), error)

AggregatePodWatcher returns a watcher for multiple namespaces.

func GetClientset

func GetClientset() (kubernetes.Interface, error)

func GetDynamicClient

func GetDynamicClient() (dynamic.Interface, error)

func PodWatcher

func PodWatcher(namespace string) (watch.Interface, error)

PodWatcher returns a watcher that will report on all Pod Events (additions, modifications, etc.)

func WaitForDeploymentToStabilize

func WaitForDeploymentToStabilize(ctx context.Context, c kubernetes.Interface, ns, name string, timeout time.Duration) error

WaitForDeploymentToStabilize waits until the Deployment has a matching generation/replica count between spec and status.

func WaitForPodComplete

func WaitForPodComplete(ctx context.Context, pods corev1.PodInterface, podName string, timeout time.Duration) error

WaitForPodComplete waits until the Pod status is complete.

func WaitForPodInitialized

func WaitForPodInitialized(ctx context.Context, pods corev1.PodInterface, podName string) error

WaitForPodInitialized waits until init containers have started running

func WaitForPodScheduled

func WaitForPodScheduled(ctx context.Context, pods corev1.PodInterface, podName string) error

WaitForPodScheduled waits until the Pod is scheduled.

Types

type ColorPicker

type ColorPicker interface {
	Pick(pod *v1.Pod) color.Color
}

ColorPicker is used to associate colors for with pods so that the container logs can be output to the terminal with a consistent color being used to identify logs from each pod.

func NewColorPicker

func NewColorPicker(baseImageNames []string) ColorPicker

NewColorPicker creates a new ColorPicker. For each artifact, a color will be selected sequentially from `colorCodes`. If all colors are used, the first color will be used again. The formatter for the associated color will then be returned by `Pick` each time it is called for the artifact and can be used to write to out in that color.

type Forwarder

type Forwarder interface {
	Forward(context.Context, *portForwardEntry) error
	Terminate(*portForwardEntry)
}

Forwarder is an interface that can modify and manage port-forward processes

type ImageList

type ImageList struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ImageList implements PodSelector based on a list of images names.

func NewImageList

func NewImageList() *ImageList

NewImageList creates a new ImageList.

func (*ImageList) Add

func (l *ImageList) Add(image string)

Add adds an image to the list.

func (*ImageList) Remove

func (l *ImageList) Remove(image string)

Remove removes an image from the list.

func (*ImageList) Select

func (l *ImageList) Select(pod *v1.Pod) bool

Select returns true if one of the pod's images is in the list.

type LogAggregator

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

LogAggregator aggregates the logs for all the deployed pods.

func NewLogAggregator

func NewLogAggregator(out io.Writer, baseImageNames []string, podSelector PodSelector, namespaces []string) *LogAggregator

NewLogAggregator creates a new LogAggregator for a given output.

func (*LogAggregator) IsMuted

func (a *LogAggregator) IsMuted() bool

IsMuted says if the logs are to be muted.

func (*LogAggregator) Mute

func (a *LogAggregator) Mute()

Mute mutes the logs.

func (*LogAggregator) Start

func (a *LogAggregator) Start(ctx context.Context) error

Start starts a logger that listens to pods and tail their logs if they are matched by the `podSelector`.

func (*LogAggregator) Stop

func (a *LogAggregator) Stop()

Stop stops the logger.

func (*LogAggregator) Unmute

func (a *LogAggregator) Unmute()

Unmute unmutes the logs.

type PodSelector

type PodSelector interface {
	Select(pod *v1.Pod) bool
}

PodSelector is used to choose which pods to log.

type PortForwarder

type PortForwarder struct {
	Forwarder
	// contains filtered or unexported fields
}

PortForwarder is responsible for selecting pods satisfying a certain condition and port-forwarding the exposed container ports within those pods. It also tracks and manages the port-forward connections.

func NewPortForwarder

func NewPortForwarder(out io.Writer, podSelector PodSelector, namespaces []string) *PortForwarder

NewPortForwarder returns a struct that tracks and port-forwards pods as they are created and modified

func (*PortForwarder) Start

func (p *PortForwarder) Start(ctx context.Context) error

Start begins a pod watcher that port forwards any pods involving containers with exposed ports. TODO(r2d4): merge this event loop with pod watcher from log writer

func (*PortForwarder) Stop

func (p *PortForwarder) Stop()

Stop terminates all kubectl port-forward commands.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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