runtimeobjects

package
v0.0.0-...-0df8d46 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 27 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIsPodUpdatedPredicateFromRuntimeObject

func GetIsPodUpdatedPredicateFromRuntimeObject(obj runtime.Object) (func(*corev1.Pod) error, error)

GetIsPodUpdatedPredicateFromRuntimeObject returns a func(*corev1.Pod) bool predicate that can be used to check if given pod represents the desired state of pod.

func GetNumObjectsMatchingSelector

func GetNumObjectsMatchingSelector(c dynamic.Interface, namespace string, resource schema.GroupVersionResource, labelSelector labels.Selector) (int, error)

GetNumObjectsMatchingSelector returns number of objects matching the given selector.

func GetReplicasOnce

func GetReplicasOnce(rw ReplicasWatcher) (int, error)

GetReplicasOnce starts ReplicasWatcher and gets a number of replicas.

func GetResourceVersionFromRuntimeObject

func GetResourceVersionFromRuntimeObject(obj runtime.Object) (uint64, error)

GetResourceVersionFromRuntimeObject returns resource version of given runtime object.

func GetSpecFromRuntimeObject

func GetSpecFromRuntimeObject(obj runtime.Object) (interface{}, error)

GetSpecFromRuntimeObject returns spec of given runtime object.

func IsEqualRuntimeObjectsSpec

func IsEqualRuntimeObjectsSpec(runtimeObj1, runtimeObj2 runtime.Object) (bool, error)

IsEqualRuntimeObjectsSpec returns true if given runtime objects have identical specs.

func ListRuntimeObjectsForKind

func ListRuntimeObjectsForKind(d dynamic.Interface, gvr schema.GroupVersionResource, labelSelector, fieldSelector string) ([]runtime.Object, error)

ListRuntimeObjectsForKind returns objects of given gvr that satisfy given labelSelector and fieldSelector.

Types

type ConstReplicas

type ConstReplicas struct {
	ReplicasCount int
}

ConstReplicas is a ReplicasWatcher implementation that returns a constant value.

func (*ConstReplicas) Replicas

func (c *ConstReplicas) Replicas() int

func (*ConstReplicas) Start

func (c *ConstReplicas) Start(_ <-chan struct{}) error

type NodeCounter

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

NodeCounter counts a number of node objects matching nodeSelector and affinity.

func NewNodeCounter

func NewNodeCounter(client clientset.Interface, nodeSelector labels.Selector, affinity *corev1.Affinity, tolerations []corev1.Toleration) *NodeCounter

NewNodeCounter returns a new nodeCounter that return a number of objects matching nodeSelector and affinity.

func (*NodeCounter) Replicas

func (n *NodeCounter) Replicas() int

func (*NodeCounter) Start

func (n *NodeCounter) Start(stopCh <-chan struct{}) error

type ReplicasWatcher

type ReplicasWatcher interface {
	Replicas() int
	// Start must block until Replicas() returns a correct value.
	Start(stopCh <-chan struct{}) error
}

ReplicasWatcher is a struct that allows to check a number of replicas at a given time. Usage: var rw ReplicasWatcher = (...)

if err := rw.Start(stopCh); err != nil {
  panic(err);
}

// Get number of replicas as needed. val = rw.Replicas() ... val = rw.Replicas()

func GetReplicasFromRuntimeObject

func GetReplicasFromRuntimeObject(c clientset.Interface, obj runtime.Object) (ReplicasWatcher, error)

GetReplicasFromRuntimeObject returns replicas number from given runtime object.

Jump to

Keyboard shortcuts

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