kube

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: MIT Imports: 21 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 PatchNodeAnnotation

func PatchNodeAnnotation(client kubernetes.Interface, nodeName string, annotations map[string]string) error

PatchNodeAnnotation will send a node patch request for the annotation path. Since nodes are updated every 10seconds by default: https://github.com/kubernetes/client-go/issues/414 using Update will have the risk of failing

Types

type NodeEventHandler

type NodeEventHandler = func(eventType watch.EventType, old *v1.Node, new *v1.Node)

NodeEventHandler is the function to handle new events

type NodeWatcher

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

NodeWatcher has a watch on the clients nodes

func NewNodeWatcher

func NewNodeWatcher(client kubernetes.Interface, resyncPeriod time.Duration, handler NodeEventHandler, clusterName string) *NodeWatcher

NewNodeWatcher returns a new node wathcer.

func (*NodeWatcher) HasSynced

func (nw *NodeWatcher) HasSynced() bool

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

func (*NodeWatcher) Init

func (nw *NodeWatcher) Init()

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

func (*NodeWatcher) List

func (nw *NodeWatcher) List() ([]*v1.Node, error)

List lists all nodes from the store

func (*NodeWatcher) Run

func (nw *NodeWatcher) Run()

Run will not return unless writting in the stop channel

func (*NodeWatcher) Stop

func (nw *NodeWatcher) 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