client

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocalStoragePodFilter

func LocalStoragePodFilter(p apiv1.Pod) (bool, error)

LocalStoragePodFilter returns true if the supplied pod does not have local storage, i.e. does not use any 'empty dir' volumes.

func MirrorPodFilter

func MirrorPodFilter(p apiv1.Pod) (bool, error)

MirrorPodFilter returns true if the supplied pod is not a mirror pod, i.e. a pod created by a manifest on the node rather than the API server.

func UnreplicatedPodFilter

func UnreplicatedPodFilter(p apiv1.Pod) (bool, error)

UnreplicatedPodFilter returns true if the pod is replicated, i.e. is managed by a controller (deployment, daemonset, statefulset, etc) of some sort.

Types

type ClientConfig

type ClientConfig interface {
	GetKubeConfig() string
	GetAPIServerURL() string
	GetRequestTimeout() time.Duration
	GetNodeReadyTimeout() time.Duration
	GetDeletionTimeout() time.Duration
	GetMaxGracePeriod() time.Duration
}

type ClientGenerator

type ClientGenerator interface {
	KubeClient() (kubernetes.Interface, error)
	NodeManagerClient() (managednodeClientset.Interface, error)
	ApiExtentionClient() (apiextension.Interface, error)

	PodList(nodeName string, podFilter PodFilterFunc) ([]apiv1.Pod, error)
	NodeList() (*apiv1.NodeList, error)
	GetNode(nodeName string) (*apiv1.Node, error)
	SetProviderID(nodeName, providerID string) error
	UncordonNode(nodeName string) error
	CordonNode(nodeName string) error
	MarkDrainNode(nodeName string) error
	DrainNode(nodeName string, ignoreDaemonSet, deleteLocalData bool) error
	DeleteNode(nodeName string) error
	AnnoteNode(nodeName string, annotations map[string]string) error
	LabelNode(nodeName string, labels map[string]string) error
	TaintNode(nodeName string, taints ...apiv1.Taint) error
	GetSecret(secretName, namespace string) (*apiv1.Secret, error)
	DeleteSecret(secretName, namespace string) error
	WaitNodeToBeReady(nodeName string) error
}

ClientGenerator provides clients

func NewClientGenerator

func NewClientGenerator(cfg ClientConfig) ClientGenerator

type PodFilterFunc

type PodFilterFunc func(p apiv1.Pod) (bool, error)

A PodFilterFunc returns true if the supplied pod passes the filter.

func NewDaemonSetPodFilter

func NewDaemonSetPodFilter(ctx context.Context, client kubernetes.Interface) PodFilterFunc

NewDaemonSetPodFilter returns a FilterFunc that returns true if the supplied pod is not managed by an extant DaemonSet.

func NewPodFilters

func NewPodFilters(filters ...PodFilterFunc) PodFilterFunc

NewPodFilters returns a FilterFunc that returns true if all of the supplied FilterFuncs return true.

func NewStatefulSetPodFilter

func NewStatefulSetPodFilter(ctx context.Context, client kubernetes.Interface) PodFilterFunc

NewStatefulSetPodFilter returns a FilterFunc that returns true if the supplied pod is not managed by an extant StatefulSet.

func UnprotectedPodFilter

func UnprotectedPodFilter(annotations ...string) PodFilterFunc

UnprotectedPodFilter returns a FilterFunc that returns true if the supplied pod does not have any of the user-specified annotations for protection from eviction

Jump to

Keyboard shortcuts

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