Documentation ¶
Index ¶
- Variables
- func BuildCustomExporter(registerCtx *synccontext.RegisterContext, controllerID string, ...) (syncertypes.Object, error)
- func BuildCustomImporter(registerCtx *synccontext.RegisterContext, controllerID string, ...) (syncertypes.Object, error)
- func CreateExporters(ctx *config.ControllerContext) error
- func CreateImporters(ctx *config.ControllerContext) error
- type HostToVirtual
- type ObjectPatcher
- type ObjectPatcherAndMetadataTranslator
- type Patcher
- type VirtualToHost
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoUpdateNeeded = errors.New("no update needed")
Functions ¶
func BuildCustomExporter ¶ added in v0.20.0
func BuildCustomExporter( registerCtx *synccontext.RegisterContext, controllerID string, objectPatcher ObjectPatcher, gvk schema.GroupVersionKind, namespacedTranslator translator.NamespacedTranslator, replaceWhenInvalid bool, ) (syncertypes.Object, error)
func BuildCustomImporter ¶ added in v0.20.0
func BuildCustomImporter( registerCtx *synccontext.RegisterContext, controllerID string, objectPatcher ObjectPatcher, hostToVirtual HostToVirtual, virtualToHost VirtualToHost, gvk schema.GroupVersionKind, replaceWhenInvalid bool, ) (syncertypes.Object, error)
func CreateExporters ¶
func CreateExporters(ctx *config.ControllerContext) error
func CreateImporters ¶
func CreateImporters(ctx *config.ControllerContext) 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 context.Context, 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 context.Context, 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 { translator.MetadataTranslator ObjectPatcher }
type Patcher ¶ added in v0.20.0
type Patcher struct {
// contains filtered or unexported fields
}
func NewPatcher ¶ added in v0.20.0
func (*Patcher) ApplyPatches ¶ added in v0.20.0
func (*Patcher) ApplyReversePatches ¶ added in v0.20.0
func (s *Patcher) ApplyReversePatches(ctx context.Context, 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.