controller

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNamespacePredicate

func NewNamespacePredicate(namespace string) predicate.Predicate

NewNamespacePredicate returns a filtering predicate that will filter out events that do not belong to the provided namespace.

Types

type ResourceManager

type ResourceManager struct {
	Client        client.Client
	RawClient     kubernetes.Interface
	Recorder      record.EventRecorder
	Logger        logr.Logger
	Notifier      notifications.Notifier
	CloudProvider cloudprovider.CloudProvider
	Namespace     string
}

ResourceManager is a struct which provides some consistency across controllers. It contains all of the common fields that controllers will need to use. It provides helpers that use the controller-runtime client.Client interface to interact with Kubernetes.

func NewResourceManager

func NewResourceManager(
	client client.Client,
	rawClient kubernetes.Interface,
	recorder record.EventRecorder,
	logger logr.Logger,
	notifier notifications.Notifier,
	cloudProvider cloudprovider.CloudProvider,
) *ResourceManager

NewResourceManager creates a new ResourceManager

func (*ResourceManager) DeleteNode

func (t *ResourceManager) DeleteNode(name string) error

DeleteNode deletes a node from Kubernetes by name.

func (*ResourceManager) DrainPods

func (t *ResourceManager) DrainPods(nodeName string) (finished bool, errs []error)

DrainPods drains the pods off the named node.

func (*ResourceManager) GetDrainablePodsOnNode

func (t *ResourceManager) GetDrainablePodsOnNode(nodeName string) (pods []v1.Pod, err error)

GetDrainablePodsOnNode gets a list of pods on a named node that we can evict or delete from the node.

func (*ResourceManager) GetNode

func (t *ResourceManager) GetNode(name string) (*v1.Node, error)

GetNode gets a node object from Kubernetes by name.

func (*ResourceManager) GetPodsOnNode

func (t *ResourceManager) GetPodsOnNode(nodeName string) (pods []v1.Pod, err error)

GetPodsOnNode gets a list of the pods running on the given node, optionally filtered by the given label selector.

func (*ResourceManager) ListNodes

func (t *ResourceManager) ListNodes(selector labels.Selector) ([]v1.Node, error)

ListNodes lists nodes from Kubernetes, optionally filtered by a selector.

func (*ResourceManager) LogEvent

func (t *ResourceManager) LogEvent(obj runtime.Object, reason, messageFmt string, args ...interface{})

LogEvent creates an event on the current object

func (*ResourceManager) LogWarningEvent

func (t *ResourceManager) LogWarningEvent(obj runtime.Object, reason, messageFmt string, args ...interface{})

LogWarningEvent creates a warning event on the current object

func (*ResourceManager) UpdateObject

func (t *ResourceManager) UpdateObject(obj runtime.Object) error

UpdateObject updates the given object in the API

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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