controller

package
v1.10.7 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 20 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCyclopsManagedNodePredicate added in v1.10.5

func NewCyclopsManagedNodePredicate() predicate.TypedPredicate[*corev1.Node]

NewCyclopsManagedNodePredicate returns a predicate that passes only Node events where the node carries the Cyclops managed annotation.

func NewNamespacePredicate

func NewNamespacePredicate[object client.Object](namespace string) predicate.TypedPredicate[object]

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) AddAnnotationToNode added in v1.10.2

func (rm *ResourceManager) AddAnnotationToNode(nodeName, annotationName, annotationValue string) error

func (*ResourceManager) AddFinalizerToNode added in v1.9.1

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

func (*ResourceManager) AddNodegroupAnnotationToNode added in v1.10.2

func (rm *ResourceManager) AddNodegroupAnnotationToNode(nodeName, nodegroupName 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) GetNodegroupFromNodeAnnotation added in v1.10.2

func (rm *ResourceManager) GetNodegroupFromNodeAnnotation(nodeName string) (string, error)

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) GetUndisruptablePods added in v1.10.2

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

GetUndisruptablePods gets a list of pods on a named node that cannot evicted or deleted from the node.

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) NodeContainsNonCyclingFinalizer added in v1.10.2

func (rm *ResourceManager) NodeContainsNonCyclingFinalizer(nodeName string) (bool, error)

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