Documentation
¶
Index ¶
- Variables
- func OwnerRefName(obj client.Object, kind string) string
- func OwnerReference(gvk schema.GroupVersionKind, name string, uid types.UID) metav1.OwnerReference
- func ReplaceOwnerReferences(obj client.Object, refs ...metav1.OwnerReference)
- func TransformStripNode(obj any) (any, error)
- func UpdateStatusWithRetry(ctx context.Context, c client.Client, obj client.Object, f MutateFn, ...) error
- func UpdateWithRetry(ctx context.Context, c client.Client, obj client.Object, f MutateFn, ...) error
- type MutateFn
- type UpdateOption
- type UpdateOptionApplier
- type UpdateOptions
Constants ¶
This section is empty.
Variables ¶
var ErrCanNotMutateNameOrNamespace = errors.New("MutateFn cannot mutate object name and/or object namespace")
Functions ¶
func OwnerRefName ¶ added in v1.78.0
OwnerRefName returns the name of obj's owner reference of the given kind, or an empty string when it has none. It is how a switch to a different owner is detected.
func OwnerReference ¶ added in v1.78.0
func OwnerReference(gvk schema.GroupVersionKind, name string, uid types.UID) metav1.OwnerReference
OwnerReference builds a non-controller owner reference that blocks the owner's deletion, so an object cannot be deleted from under the dependent still using it.
func ReplaceOwnerReferences ¶ added in v1.78.0
func ReplaceOwnerReferences(obj client.Object, refs ...metav1.OwnerReference)
ReplaceOwnerReferences swaps obj's owner references of the same kinds as refs for refs themselves, leaving references of every other kind untouched. Replacing per kind is what drops the reference to an owner the object has just switched away from.
func TransformStripNode ¶ added in v1.78.0
TransformStripNode is the cache transform for Nodes. The manager cache holds every node of the cluster, and most of a Node is what deckhouse-controller never reads: the managed fields, the image list, the conditions and the volume lists. They are dropped before the object is committed to the cache; the metadata, the spec and the rest of the status stay. Code that needs a dropped field reads the node from the API, not from the cache.
A field is written only when there is something to drop, which keeps the transform idempotent and free of writes for an object that comes through again (see TransformStripManagedFields in controller-runtime). Anything else, a deletion tombstone included, passes as is.
func UpdateStatusWithRetry ¶
Types ¶
type UpdateOption ¶
type UpdateOption func(optionsApplier UpdateOptionApplier)
func WithOnErrorBackoff ¶
func WithOnErrorBackoff(b *wait.Backoff) UpdateOption
func WithRetryOnConflictBackoff ¶
func WithRetryOnConflictBackoff(b *wait.Backoff) UpdateOption
func (UpdateOption) Apply ¶
func (opt UpdateOption) Apply(o UpdateOptionApplier)
type UpdateOptionApplier ¶
type UpdateOptions ¶
type UpdateOptions struct {
OnErrorBackoff wait.Backoff
RetryOnConflictBackoff wait.Backoff
// contains filtered or unexported fields
}
func (*UpdateOptions) WithOnErrorBackoff ¶
func (o *UpdateOptions) WithOnErrorBackoff(b *wait.Backoff)
func (*UpdateOptions) WithRetryOnConflictBackoff ¶
func (o *UpdateOptions) WithRetryOnConflictBackoff(b *wait.Backoff)