controller

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 19 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
	HttpClient    *http.Client
	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,
	httpClient *http.Client,
	recorder record.EventRecorder,
	logger logr.Logger,
	notifier notifications.Notifier,
	cloudProvider cloudprovider.CloudProvider,
) *ResourceManager

NewResourceManager creates a new ResourceManager

func (*ResourceManager) AddFinalizerToNode added in v1.9.1

func (rm *ResourceManager) AddFinalizerToNode(nodeName string) error

func (*ResourceManager) DeleteNode

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

DeleteNode deletes a node from Kubernetes by name.

func (*ResourceManager) DrainPods

func (rm *ResourceManager) DrainPods(nodeName string, unhealthyAfter time.Duration) (finished bool, errs []error)

DrainPods drains the pods off the named node.

func (*ResourceManager) GetDrainablePodsOnNode

func (rm *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 (rm *ResourceManager) GetNode(name string) (*v1.Node, error)

GetNode gets a node object from Kubernetes by name.

func (*ResourceManager) GetPodsOnNode

func (rm *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 (rm *ResourceManager) ListNodes(selector labels.Selector) ([]v1.Node, error)

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

func (*ResourceManager) LogEvent

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

LogEvent creates an event on the current object

func (*ResourceManager) LogWarningEvent

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

LogWarningEvent creates a warning event on the current object

func (*ResourceManager) RemoveFinalizerFromNode added in v1.9.1

func (rm *ResourceManager) RemoveFinalizerFromNode(nodeName string) error

func (*ResourceManager) UpdateObject

func (rm *ResourceManager) UpdateObject(obj client.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