kubecluster

package
v0.0.0-...-c22a57c Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeleteKey = "delete"
)

Variables

Listers which hold cached k8s objects for later lookup

Functions

func GetClusterName

func GetClusterName(client *kubernetes.Clientset) string

GetClusterName provides a unique cluster name

func GetK8sVersion

func GetK8sVersion(client *kubernetes.Clientset) string

GetK8sVersion - get the version of k8s running on the cluster

func NewK8sClient

func NewK8sClient(cPath string) (*kubernetes.Clientset, error)

NewK8SClient returns a kubernetes client based on a passed kubeconfig path. If a kubeconfig path is not passed (this is normal), the service account associated with the controller will be loaded automatically.

Types

type Informer

type Informer interface {
	Start()
	Stop()
}

Informer is capable of starting and stopping an running informer.

type InformerClient

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

InformerClient contains configuration for instantiating an informer. Use NewInformerClient to ensure valid configuration is provided.

func NewInformerClient

func NewInformerClient(client *kubernetes.Clientset, resource string, nsSelector string,
	pQueue workqueue.RateLimitingInterface, config config.Config) (*InformerClient, error)

NewInformerClient returns an InformerClient capable of starting an informer to watch all events a specific k8s object type. It returns an error when the request object type (specified in the resource argument is not known to watch-proxy. The arguments it takes are as follows.

  • client: kubernetes.Clientset used for generating REST clients capable for communicating with kubernetes
  • resource: the type of k8s object the informer will watch for events on. e.g. pods, deployments, or namespaces
  • nsSelector: scopes the informer to only watch objects in a specific namespace. An empty string represents all namespaces.
  • pQueue: processor queue where all events should be dropped for future processing.

func (InformerClient) Start

func (ic InformerClient) Start()

Start instantiates an informer and begins the watch for resource events. The informer's resulting controller is run in its own go routine and Start will block until a signal is sent to the InformerClient's Done channel. Upon that signal, the controller's go routine will is stopped Start will return.

func (InformerClient) Stop

func (ic InformerClient) Stop()

Stop tells the InformerClient's controller (watcher, indexer, etc) to stop.

type InformerClients

type InformerClients []*InformerClient

InformerClients is a wrapper around []*InformerClient to allow methods to be added such as the need to find an InformerClient within the list based on resource.

func RemoveInformerClient

func RemoveInformerClient(ics InformerClients, removeIc *InformerClient) InformerClients

RemoveInformerClient returns a new InformerClients slice with the passed removeIc (InformerClient) removed from the list.

func StartWatchers

func StartWatchers(client *kubernetes.Clientset, c config.Config,
	processorQueue workqueue.RateLimitingInterface) InformerClients

StartWatchers creates all informers needed to satisfy the desired objects to keep a watch on, as described in the config. It expects a kubernetes client for which rest clients will be derived, the configuration of watch-proxy, and a processing queue where all objects that triggered events will be stored.

func StopWatchers

func StopWatchers(ics InformerClients, config config.Config) InformerClients

StopWatchers looks through the StaleResources (watcher to stop) inside of the provided config. It sends a stop signal to all running watchers in this list and returns a list of all the watchers (or InformerClients) it stopped.

func (InformerClients) FindInformerClient

func (ics InformerClients) FindInformerClient(resource string) *InformerClient

FindInformerClient looks up an InformerClient responsible for handling the passes resource.

func (InformerClients) String

func (ics InformerClients) String() string

String pretty prints InformerClients.

Jump to

Keyboard shortcuts

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