Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareResourceVersion ¶
CompareResourceVersion compares two ResourceVersions for objects of the same resource. Returns -1 if a < b, 0 if a == b, +1 if a > b.
Compares as integers, not lexically (e.g. "9" < "10"). Mirrors k8s.io/apimachinery/pkg/util/resourceversion once we upgrade past v0.34. TODO: Remove this once we upgrade past v0.34.
Types ¶
type InvalidResourceVersion ¶
type InvalidResourceVersion struct {
RV string
}
InvalidResourceVersion is returned when a resource version is not a well-formed positive integer.
func (InvalidResourceVersion) Error ¶
func (i InvalidResourceVersion) Error() string
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker remembers the ResourceVersion of the last successful write this controller made for each object key, so sync can short-circuit (with a brief requeue) when the informer cache hasn't yet observed our previous write.
Without this guard, a reconcile enqueued while a prior write is still propagating to the informer can read pre-write state and act on stale inputs — or, worse, overwrite the informer cache directly (the writeBackToInformer anti-pattern).
TODO: if Argo Rollouts moves to controller-runtime, replace this with the cached client's ReadYourOwnWrites option once kubernetes-sigs/controller-runtime#3473 lands.
func (*Tracker) IsCacheStale ¶
IsCacheStale reports whether cachedRV is strictly older than the last ResourceVersion we wrote for key. Returns false when we have no record, when the cache is at or ahead of our last write, or when either ResourceVersion is malformed (fail open).