k8s

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCurrentContext

func LoadCurrentContext(kubeconfig string) (*api.Context, error)

LoadCurrentContext loads a context in KUBECONFIG and returns it

Types

type Client

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

Client is a wrapper for a Kubernetes client

func NewClient

func NewClient(kubeconfig string) (*Client, error)

NewClient loads Kubernetes configuration by the kubeconfig and returns new Client

func (*Client) WatchLogs

func (c *Client) WatchLogs(ctx context.Context, namespace, pod, container string) (<-chan string, error)

WatchLogs watches container's logs of pod in namespace. It returns channels to subscribe log lines.

func (*Client) WatchPods

func (c *Client) WatchPods(ctx context.Context, namespace string) (<-chan *PodEvent, error)

WatchPods watches pods from Kubernetes API in namespace. It returns a channel to subscribe pods.

type PodEvent

type PodEvent struct {
	Type PodEventType
	Pod  *corev1.Pod
}

PodEvent represents an event of the pods in Kubernetes API

type PodEventType

type PodEventType int

PodEventType represents an event type of the pod

const (
	PodAdded    PodEventType = iota // The pod is added
	PodModified                     // The pod is updated
	PodDeleted                      // The pod is deleted
)

The event type of the pods

Jump to

Keyboard shortcuts

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