Documentation ¶
Index ¶
- Constants
- Variables
- func KeyFromObject(o metav1.Object) string
- type ControlleeExpectations
- type ControllerExpectations
- func (r *ControllerExpectations) CreationObserved(controllerKey string)
- func (r *ControllerExpectations) DeleteExpectations(controllerKey string)
- func (r *ControllerExpectations) DeletionObserved(controllerKey string)
- func (r *ControllerExpectations) ExpectCreations(controllerKey string, adds int) error
- func (r *ControllerExpectations) ExpectDeletions(controllerKey string, dels int) error
- func (r *ControllerExpectations) GetExpectations(controllerKey string) (*ControlleeExpectations, bool, error)
- func (r *ControllerExpectations) LowerExpectations(controllerKey string, add, del int)
- func (r *ControllerExpectations) RaiseExpectations(controllerKey string, add, del int)
- func (r *ControllerExpectations) SatisfiedExpectations(controllerKey string) bool
- func (r *ControllerExpectations) SetExpectations(controllerKey string, add, del int) error
- type ControllerExpectationsInterface
- type UIDSet
- type UIDTrackingControllerExpectations
- func (u *UIDTrackingControllerExpectations) DeleteExpectations(rcKey string)
- func (u *UIDTrackingControllerExpectations) DeletionObserved(rcKey, deleteKey string)
- func (u *UIDTrackingControllerExpectations) ExpectDeletions(rcKey string, deletedKeys []string) error
- func (u *UIDTrackingControllerExpectations) GetUIDs(controllerKey string) sets.String
Constants ¶
const ( // If a watch drops a delete event for a pod, it'll take this long // before a dormant controller waiting for those packets is woken up anyway. It is // specifically targeted at the case where some problem prevents an update // of expectations, without it the controller could stay asleep forever. This should // be set based on the expected latency of watch events. // // Currently a controller can service (create *and* observe the watch events for said // creation) about 10 pods a second, so it takes about 1 min to service // 500 pods. Just creation is limited to 20qps, and watching happens with ~10-30s // latency/pod at the scale of 3000 pods over 100 nodes. ExpectationsTimeout = 5 * time.Minute )
Variables ¶
var ExpKeyFunc = func(obj interface{}) (string, error) { if e, ok := obj.(*ControlleeExpectations); ok { return e.key, nil } return "", fmt.Errorf("could not find key for obj %#v", obj) }
ExpKeyFunc to parse out the key from a ControlleeExpectation
var UIDSetKeyFunc = func(obj interface{}) (string, error) { if u, ok := obj.(*UIDSet); ok { return u.key, nil } return "", fmt.Errorf("could not find key for obj %#v", obj) }
UIDSetKeyFunc to parse out the key from a UIDSet.
Functions ¶
func KeyFromObject ¶
Types ¶
type ControlleeExpectations ¶
type ControlleeExpectations struct {
// contains filtered or unexported fields
}
ControlleeExpectations track controllee creates/deletes.
func (*ControlleeExpectations) Add ¶
func (e *ControlleeExpectations) Add(add, del int64)
Add increments the add and del counters.
func (*ControlleeExpectations) Fulfilled ¶
func (e *ControlleeExpectations) Fulfilled() bool
Fulfilled returns true if this expectation has been fulfilled.
func (*ControlleeExpectations) GetExpectations ¶
func (e *ControlleeExpectations) GetExpectations() (int64, int64)
GetExpectations returns the add and del expectations of the controllee.
type ControllerExpectations ¶
ControllerExpectations is a cache mapping controllers to what they expect to see before being woken up for a sync.
func NewControllerExpectations ¶
func NewControllerExpectations() *ControllerExpectations
NewControllerExpectations returns a store for ControllerExpectations.
func (*ControllerExpectations) CreationObserved ¶
func (r *ControllerExpectations) CreationObserved(controllerKey string)
CreationObserved atomically decrements the `add` expectation count of the given controller.
func (*ControllerExpectations) DeleteExpectations ¶
func (r *ControllerExpectations) DeleteExpectations(controllerKey string)
DeleteExpectations deletes the expectations of the given controller from the TTLStore.
func (*ControllerExpectations) DeletionObserved ¶
func (r *ControllerExpectations) DeletionObserved(controllerKey string)
DeletionObserved atomically decrements the `del` expectation count of the given controller.
func (*ControllerExpectations) ExpectCreations ¶
func (r *ControllerExpectations) ExpectCreations(controllerKey string, adds int) error
func (*ControllerExpectations) ExpectDeletions ¶
func (r *ControllerExpectations) ExpectDeletions(controllerKey string, dels int) error
func (*ControllerExpectations) GetExpectations ¶
func (r *ControllerExpectations) GetExpectations(controllerKey string) (*ControlleeExpectations, bool, error)
GetExpectations returns the ControlleeExpectations of the given controller.
func (*ControllerExpectations) LowerExpectations ¶
func (r *ControllerExpectations) LowerExpectations(controllerKey string, add, del int)
Decrements the expectation counts of the given controller.
func (*ControllerExpectations) RaiseExpectations ¶
func (r *ControllerExpectations) RaiseExpectations(controllerKey string, add, del int)
Increments the expectation counts of the given controller.
func (*ControllerExpectations) SatisfiedExpectations ¶
func (r *ControllerExpectations) SatisfiedExpectations(controllerKey string) bool
SatisfiedExpectations returns true if the required adds/dels for the given controller have been observed. Add/del counts are established by the controller at sync time, and updated as controllees are observed by the controller manager.
func (*ControllerExpectations) SetExpectations ¶
func (r *ControllerExpectations) SetExpectations(controllerKey string, add, del int) error
SetExpectations registers new expectations for the given controller. Forgets existing expectations.
type ControllerExpectationsInterface ¶
type ControllerExpectationsInterface interface { GetExpectations(controllerKey string) (*ControlleeExpectations, bool, error) SatisfiedExpectations(controllerKey string) bool DeleteExpectations(controllerKey string) SetExpectations(controllerKey string, add, del int) error ExpectCreations(controllerKey string, adds int) error ExpectDeletions(controllerKey string, dels int) error CreationObserved(controllerKey string) DeletionObserved(controllerKey string) RaiseExpectations(controllerKey string, add, del int) LowerExpectations(controllerKey string, add, del int) }
ControllerExpectationsInterface is an interface that allows users to set and wait on expectations. Only abstracted out for testing. Warning: if using KeyFunc it is not safe to use a single ControllerExpectationsInterface with different types of controllers, because the keys might conflict across types.
type UIDSet ¶
UIDSet holds a key and a set of UIDs. Used by the UIDTrackingControllerExpectations to remember which UID it has seen/still waiting for.
type UIDTrackingControllerExpectations ¶
type UIDTrackingControllerExpectations struct { ControllerExpectationsInterface // contains filtered or unexported fields }
UIDTrackingControllerExpectations tracks the UID of the pods it deletes. This cache is needed over plain old expectations to safely handle graceful deletion. The desired behavior is to treat an update that sets the DeletionTimestamp on an object as a delete. To do so consistently, one needs to remember the expected deletes so they aren't double counted. TODO: Track creates as well (#22599)
func NewUIDTrackingControllerExpectations ¶
func NewUIDTrackingControllerExpectations(ce ControllerExpectationsInterface) *UIDTrackingControllerExpectations
NewUIDTrackingControllerExpectations returns a wrapper around ControllerExpectations that is aware of deleteKeys.
func (*UIDTrackingControllerExpectations) DeleteExpectations ¶
func (u *UIDTrackingControllerExpectations) DeleteExpectations(rcKey string)
DeleteExpectations deletes the UID set and invokes DeleteExpectations on the underlying ControllerExpectationsInterface.
func (*UIDTrackingControllerExpectations) DeletionObserved ¶
func (u *UIDTrackingControllerExpectations) DeletionObserved(rcKey, deleteKey string)
DeletionObserved records the given deleteKey as a deletion, for the given rc.
func (*UIDTrackingControllerExpectations) ExpectDeletions ¶
func (u *UIDTrackingControllerExpectations) ExpectDeletions(rcKey string, deletedKeys []string) error
ExpectDeletions records expectations for the given deleteKeys, against the given controller.
func (*UIDTrackingControllerExpectations) GetUIDs ¶
func (u *UIDTrackingControllerExpectations) GetUIDs(controllerKey string) sets.String
GetUIDs is a convenience method to avoid exposing the set of expected uids. The returned set is not thread safe, all modifications must be made holding the uidStoreLock.