kubernetes

package
v0.0.0-...-fdc6b19 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetReadinessState deprecated

func GetReadinessState(node *apiv1.Node) (isNodeReady bool, lastTransitionTime time.Time, err error)

GetReadinessState gets readiness state for the node

Deprecated: Use GetNodeReadiness instead.

func GetUnreadyNodeCopy

func GetUnreadyNodeCopy(node *apiv1.Node, reason NodeNotReadyReason) *apiv1.Node

GetUnreadyNodeCopy create a copy of the given node and override its NodeReady condition to False

func IsNodeReadyAndSchedulable

func IsNodeReadyAndSchedulable(node *apiv1.Node) bool

IsNodeReadyAndSchedulable returns true if the node is ready and schedulable.

func NewConfigMapListerForNamespace

func NewConfigMapListerForNamespace(kubeClient client.Interface, stopchannel <-chan struct{},
	namespace string) v1lister.ConfigMapLister

NewConfigMapListerForNamespace builds a configmap lister for the passed namespace (including all).

func ScheduledPods

func ScheduledPods(allPods []*apiv1.Pod) []*apiv1.Pod

ScheduledPods is a helper method that returns all scheduled pods from given pod list.

func UnschedulablePods

func UnschedulablePods(allPods []*apiv1.Pod) []*apiv1.Pod

UnschedulablePods is a helper method that returns all unschedulable pods from given pod list.

Types

type AllPodLister

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

AllPodLister lists all pods.

func (*AllPodLister) List

func (lister *AllPodLister) List() ([]*apiv1.Pod, error)

List returns all scheduled pods.

type ListerRegistry

type ListerRegistry interface {
	AllNodeLister() NodeLister
	ReadyNodeLister() NodeLister
	AllPodLister() PodLister
	PodDisruptionBudgetLister() PodDisruptionBudgetLister
	DaemonSetLister() v1appslister.DaemonSetLister
	ReplicationControllerLister() v1lister.ReplicationControllerLister
	JobLister() v1batchlister.JobLister
	ReplicaSetLister() v1appslister.ReplicaSetLister
	StatefulSetLister() v1appslister.StatefulSetLister
}

ListerRegistry is a registry providing various listers to list pods or nodes matching conditions

func NewListerRegistry

func NewListerRegistry(allNode NodeLister, readyNode NodeLister, allPodLister PodLister, podDisruptionBudgetLister PodDisruptionBudgetLister,
	daemonSetLister v1appslister.DaemonSetLister, replicationControllerLister v1lister.ReplicationControllerLister,
	jobLister v1batchlister.JobLister, replicaSetLister v1appslister.ReplicaSetLister,
	statefulSetLister v1appslister.StatefulSetLister) ListerRegistry

NewListerRegistry returns a registry providing various listers to list pods or nodes matching conditions

func NewListerRegistryWithDefaultListers

func NewListerRegistryWithDefaultListers(informerFactory informers.SharedInformerFactory) ListerRegistry

NewListerRegistryWithDefaultListers returns a registry filled with listers of the default implementations

type NodeLister

type NodeLister interface {
	List() ([]*apiv1.Node, error)
	Get(name string) (*apiv1.Node, error)
}

NodeLister lists nodes.

func NewAllNodeLister

func NewAllNodeLister(nl v1lister.NodeLister) NodeLister

NewAllNodeLister builds a node lister that returns all nodes (ready and unready).

func NewNodeLister

func NewNodeLister(nl v1lister.NodeLister, filter func(*apiv1.Node) bool) NodeLister

NewNodeLister builds a node lister.

func NewReadyNodeLister

func NewReadyNodeLister(nl v1lister.NodeLister) NodeLister

NewReadyNodeLister builds a node lister that returns only ready nodes.

type NodeNotReadyReason

type NodeNotReadyReason string

NodeNotReadyReason reprents a reason for node to be unready. While it is simply a string on the node object, custom type ensures no one accidentally performs any string operation on variables of this type and allows them to be treated as enums.

const (
	// ResourceUnready is a fake identifier used internally by Cluster Autoscaler
	// to indicate nodes that appear Ready in the API, but are treated as
	// still upcoming due to a missing resource (e.g. GPU).
	ResourceUnready NodeNotReadyReason = "cluster-autoscaler.kubernetes.io/resource-not-ready"

	// IgnoreTaint is a fake identifier used internally by Cluster Autoscaler
	// to indicate nodes that appear Ready in the API, but are treated as
	// still upcoming due to applied ignore taint.
	IgnoreTaint NodeNotReadyReason = "cluster-autoscaler.kubernetes.io/ignore-taint"
)

type NodeReadiness

type NodeReadiness struct {
	// Is the node ready or not.
	Ready bool
	// Time of the last state transition related to readiness.
	LastTransitionTime time.Time
	// Reason for the node to be unready. Defined only when Ready is false.
	Reason NodeNotReadyReason
}

NodeReadiness represents the last known node readiness.

func GetNodeReadiness

func GetNodeReadiness(node *apiv1.Node) (NodeReadiness, error)

GetNodeReadiness gets readiness for the node

type PodDisruptionBudgetLister

type PodDisruptionBudgetLister interface {
	List() ([]*policyv1.PodDisruptionBudget, error)
}

PodDisruptionBudgetLister lists pod disruption budgets.

func NewPodDisruptionBudgetLister

func NewPodDisruptionBudgetLister(pdbLister v1policylister.PodDisruptionBudgetLister) PodDisruptionBudgetLister

NewPodDisruptionBudgetLister builds a pod disruption budget lister.

type PodDisruptionBudgetListerImpl

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

PodDisruptionBudgetListerImpl lists pod disruption budgets

func (*PodDisruptionBudgetListerImpl) List

List returns all pdbs

type PodLister

type PodLister interface {
	List() ([]*apiv1.Pod, error)
}

PodLister lists all pods. To filter out the scheduled or unschedulable pods the helper methods ScheduledPods and UnschedulablePods should be used.

func NewAllPodLister

func NewAllPodLister(pl v1lister.PodLister) PodLister

NewAllPodLister builds AllPodLister

Jump to

Keyboard shortcuts

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