Documentation ¶
Overview ¶
Package mergepatch implements merge patch support for managed topology.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthoritativePaths ¶
AuthoritativePaths instruct the Helper to enforce changes for paths when computing a patch (instead of using two way merge that preserves values from existing objects). NOTE: AuthoritativePaths will be superseded by IgnorePaths in case a path exists in both.
func (AuthoritativePaths) ApplyToHelper ¶
func (i AuthoritativePaths) ApplyToHelper(opts *HelperOptions)
ApplyToHelper applies this configuration to the given helper options.
type Helper ¶
type Helper struct {
// contains filtered or unexported fields
}
Helper helps with a patch that yields the modified document when applied to the original document.
func NewHelper ¶
func NewHelper(original, modified client.Object, c client.Client, opts ...HelperOption) (*Helper, error)
NewHelper will return a patch that yields the modified document when applied to the original document. NOTE: patch helper consider changes only in metadata.labels, metadata.annotation and spec. NOTE: In the case of ClusterTopologyReconciler, original is the current object, modified is the desired object, and the patch returns all the changes required to align current to what is defined in desired; fields not managed by the topology controller are going to be preserved without changes.
func (*Helper) HasChanges ¶
HasChanges return true if the patch has changes.
func (*Helper) HasSpecChanges ¶
HasSpecChanges return true if the patch has changes to the spec field.
type HelperOption ¶
type HelperOption interface { // ApplyToHelper applies this configuration to the given helper options. ApplyToHelper(*HelperOptions) }
HelperOption is some configuration that modifies options for Helper.
type HelperOptions ¶
type HelperOptions struct {
// contains filtered or unexported fields
}
HelperOptions contains options for Helper.
func (*HelperOptions) ApplyOptions ¶
func (o *HelperOptions) ApplyOptions(opts []HelperOption) *HelperOptions
ApplyOptions applies the given patch options on these options, and then returns itself (for convenient chaining).
type IgnorePaths ¶
IgnorePaths instruct the Helper to ignore given paths when computing a patch.
func (IgnorePaths) ApplyToHelper ¶
func (i IgnorePaths) ApplyToHelper(opts *HelperOptions)
ApplyToHelper applies this configuration to the given helper options.