Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoUpdateNeeded = errors.New("no update needed")
Functions ¶
func CreateExporters ¶
func CreateExporters(ctx *synccontext.ControllerContext) error
func CreateImporters ¶
func CreateImporters(ctx *synccontext.ControllerContext) error
func IgnoreAcceptableErrors ¶ added in v0.21.0
func IgnoreAcceptableErrors(err error) error
Types ¶
type HostToVirtual ¶ added in v0.20.0
type HostToVirtual func(ctx context.Context, req types.NamespacedName, pObj client.Object) types.NamespacedName
type ObjectPatcher ¶ added in v0.20.0
type ObjectPatcher interface {
// ServerSideApply applies the translated object into the target cluster (either host or virtual), which
// was built from originalObj. There might be also an existingOtherObj which was server side applied before, which
// is not guaranteed to exist as this function is called during creation as well.
//
// For export syncers:
// * originalObj is the virtual object
// * translatedObj is the translated virtual object to host (rewritten metadata)
// * existingOtherObj is the existing host object (can be nil if there is none yet)
//
// For import syncers:
// * originalObj is the host object
// * translatedObj is the translated host object to virtual (rewritten metadata)
// * existingOtherObj is the existing virtual object (can be nil if there is none yet)
ServerSideApply(ctx *synccontext.SyncContext, originalObj, translatedObj, existingOtherObj client.Object) error
// ReverseUpdate updates the destObj before running ServerSideApply. This can be useful to sync back
// certain fields. Be careful that everything synced through this function **needs** to be excluded in
// the ServerSideApply function. Both objects are guaranteed to exist for this function. Users can use
// ErrNoUpdateNeeded to skip reverse update.
//
// For export syncers:
// * destObj is the virtual object
// * sourceObj is the host object
//
// For import syncers:
// * destObj is the host object
// * sourceObj is the virtual object
ReverseUpdate(ctx *synccontext.SyncContext, destObj, sourceObj client.Object) error
}
ObjectPatcher is the heart of the export and import syncers. The following functions are executed based on the lifecycle: During Creation: * ServerSideApply with nil existingOtherObj During Update: * ReverseUpdate * ServerSideApply
type ObjectPatcherAndMetadataTranslator ¶ added in v0.20.0
type ObjectPatcherAndMetadataTranslator interface {
TranslateMetadata(ctx *synccontext.SyncContext, pObj client.Object) client.Object
ObjectPatcher
}
type Patcher ¶ added in v0.20.0
type Patcher struct {
// contains filtered or unexported fields
}
func NewPatcher ¶ added in v0.20.0
func NewPatcher(fromClient, toClient client.Client, statusIsSubresource bool, log log.Logger) *Patcher
func (*Patcher) ApplyPatches ¶ added in v0.20.0
func (s *Patcher) ApplyPatches(ctx *synccontext.SyncContext, fromObj, toObj client.Object, modifier ObjectPatcherAndMetadataTranslator) (client.Object, error)
func (*Patcher) ApplyReversePatches ¶ added in v0.20.0
func (s *Patcher) ApplyReversePatches(ctx *synccontext.SyncContext, fromObj, otherObj client.Object, modifier ObjectPatcherAndMetadataTranslator) (controllerutil.OperationResult, error)
type VirtualToHost ¶ added in v0.20.0
type VirtualToHost func(ctx context.Context, req types.NamespacedName, vObj client.Object) types.NamespacedName
Click to show internal directories.
Click to hide internal directories.