Documentation ¶
Index ¶
- func GetIsPodUpdatedPredicateFromRuntimeObject(obj runtime.Object) (func(*corev1.Pod) error, error)
- func GetNumObjectsMatchingSelector(c dynamic.Interface, namespace string, resource schema.GroupVersionResource, ...) (int, error)
- func GetReplicasOnce(rw ReplicasWatcher) (int, error)
- func GetResourceVersionFromRuntimeObject(obj runtime.Object) (uint64, error)
- func GetSpecFromRuntimeObject(obj runtime.Object) (interface{}, error)
- func IsEqualRuntimeObjectsSpec(runtimeObj1, runtimeObj2 runtime.Object) (bool, error)
- func ListRuntimeObjectsForKind(d dynamic.Interface, gvr schema.GroupVersionResource, ...) ([]runtime.Object, error)
- type ConstReplicas
- type NodeCounter
- type ReplicasWatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetIsPodUpdatedPredicateFromRuntimeObject ¶
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 ¶
GetResourceVersionFromRuntimeObject returns resource version of given runtime object.
func GetSpecFromRuntimeObject ¶
GetSpecFromRuntimeObject returns spec of given runtime object.
func IsEqualRuntimeObjectsSpec ¶
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.