kube

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client(token, apiURL, caURL string) (*kubernetes.Clientset, error)

Client returns a Kubernetes client (clientset) from token, apiURL and caURL

func ClientFromConfig

func ClientFromConfig(path string) (*kubernetes.Clientset, error)

ClientFromConfig returns a Kubernetes client (clientset) from the kubeconfig path or from the in-cluster service account environment.

func GetClientConfig added in v0.2.0

func GetClientConfig(path string) (*rest.Config, error)

GetClientConfig returns a Kubernetes client Config.

Types

type PodEventHandler

type PodEventHandler = func(eventType watch.EventType, old *v1.Pod, new *v1.Pod)

PodEventHandler is the function to handle new events

type PodWatcher

type PodWatcher struct {
	ListHealthy  bool
	WatchHealthy bool
	// contains filtered or unexported fields
}

PodWatcher has a watch on the clients pods

func NewPodWatcher

func NewPodWatcher(client kubernetes.Interface, resyncPeriod time.Duration, handler PodEventHandler, labelSelector string) *PodWatcher

NewPodWatcher returns a new pod wathcer.

func (*PodWatcher) HasSynced

func (pw *PodWatcher) HasSynced() bool

HasSynced calls controllers HasSync method to determine whether the watcher cache is synced.

func (*PodWatcher) Healthy

func (pw *PodWatcher) Healthy() bool

Healthy is true when both list and watch handlers are running without errors.

func (*PodWatcher) Init

func (pw *PodWatcher) Init()

Init sets up the list, watch functions and the cache.

func (*PodWatcher) List

func (pw *PodWatcher) List() ([]*v1.Pod, error)

List lists all pods from the store

func (*PodWatcher) Run

func (pw *PodWatcher) Run()

Run will not return unless writting in the stop channel

func (*PodWatcher) Stop

func (pw *PodWatcher) Stop()

Stop stop the watcher via the respective channel

Jump to

Keyboard shortcuts

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