cluster-api: sigs.k8s.io/cluster-api/util/patch Index | Files

package patch

import "sigs.k8s.io/cluster-api/util/patch"

Index

Package Files

options.go patch.go utils.go

type Helper Uses

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

Helper is a utility for ensuring the proper patching of objects.

func NewHelper Uses

func NewHelper(obj client.Object, crClient client.Client) (*Helper, error)

NewHelper returns an initialized Helper

func (*Helper) Patch Uses

func (h *Helper) Patch(ctx context.Context, obj client.Object, opts ...Option) error

Patch will attempt to patch the given object, including its status.

type HelperOptions Uses

type HelperOptions struct {
    // IncludeStatusObservedGeneration sets the status.observedGeneration field
    // on the incoming object to match metadata.generation, only if there is a change.
    IncludeStatusObservedGeneration bool

    // ForceOverwriteConditions allows the patch helper to overwrite conditions in case of conflicts.
    // This option should only ever be set in controller managing the object being patched.
    ForceOverwriteConditions bool

    // OwnedConditions defines condition types owned by the controller.
    // In case of conflicts for the owned conditions, the patch helper will always use the value provided by the controller.
    //
    // DEPRECATED: Use ForceOverwriteConditions.
    OwnedConditions []clusterv1.ConditionType
}

HelperOptions contains options for patch options.

type Option Uses

type Option interface {
    // ApplyToHelper applies this configuration to the given Helper options.
    ApplyToHelper(*HelperOptions)
}

Option is some configuration that modifies options for a patch request.

type WithForceOverwriteConditions Uses

type WithForceOverwriteConditions struct{}

WithForceOverwriteConditions allows the patch helper to overwrite conditions in case of conflicts. This option should only ever be set in controller managing the object being patched.

func (WithForceOverwriteConditions) ApplyToHelper Uses

func (w WithForceOverwriteConditions) ApplyToHelper(in *HelperOptions)

ApplyToHelper applies this configuration to the given HelperOptions.

type WithOwnedConditions Uses

type WithOwnedConditions struct {
    Conditions []clusterv1.ConditionType
}

WithOwnedConditions allows to define condition types owned by the controller. In case of conflicts for the owned conditions, the patch helper will always use the value provided by the controller.

DEPRECATED: Use WithForceOverwriteConditions.

func (WithOwnedConditions) ApplyToHelper Uses

func (w WithOwnedConditions) ApplyToHelper(in *HelperOptions)

ApplyToHelper applies this configuration to the given HelperOptions.

type WithStatusObservedGeneration Uses

type WithStatusObservedGeneration struct{}

WithStatusObservedGeneration sets the status.observedGeneration field on the incoming object to match metadata.generation, only if there is a change.

func (WithStatusObservedGeneration) ApplyToHelper Uses

func (w WithStatusObservedGeneration) ApplyToHelper(in *HelperOptions)

ApplyToHelper applies this configuration to the given HelperOptions.

Package patch imports 14 packages (graph) and is imported by 40 packages. Updated 2020-10-29. Refresh now. Tools for package owners.