types

package
v0.23.0-rc.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base interface {
	Name() string
}

type ControllerModifier

type ControllerModifier interface {
	ModifyController(ctx *synccontext.RegisterContext, builder *builder.Builder) (*builder.Builder, error)
}

ControllerModifier is used to modify the created controller for the syncer

type ControllerStarter

type ControllerStarter interface {
	Register(ctx *synccontext.RegisterContext) error
}

ControllerStarter is a generic controller that can be used if the syncer abstraction does not fit the use case

type FakeSyncer

type FakeSyncer interface {
	Object

	FakeSyncToVirtual(ctx *synccontext.SyncContext, req types.NamespacedName) (ctrl.Result, error)
	FakeSync(ctx *synccontext.SyncContext, vObj client.Object) (ctrl.Result, error)
}

type GenericTranslator

type GenericTranslator interface {
	Translator

	// EventRecorder returns
	EventRecorder() record.EventRecorder
}

GenericTranslator provides some helper functions to ease sync down translation

type Importer

type Importer interface {
	// Import imports the given host object into the virtual cluster
	Import(ctx *synccontext.SyncContext, pObj client.Object) (bool, error)

	// IgnoreHostObject is used to ignore certain objects during the import process
	IgnoreHostObject(ctx *synccontext.SyncContext, pObj client.Object) bool
}

type IndicesRegisterer

type IndicesRegisterer interface {
	RegisterIndices(ctx *synccontext.RegisterContext) error
}

IndicesRegisterer registers additional indices for the controller

type ManagerProvider

type ManagerProvider interface {
	ConfigureAndStartManager(ctx *synccontext.RegisterContext) (*synccontext.RegisterContext, error)
}

ManagerProvider allows you to change fields in the RegisterContext for particular syncer. E.g. fromHostSyncer uses it to change default ctx.PhysicalManager to the custom one that watches for multiple namespaces in the host.

type Object

type Object interface {
	Base
	Resource() client.Object
}

type ObjectExcluder

type ObjectExcluder interface {
	ExcludeVirtual(vObj client.Object) bool
	ExcludePhysical(vObj client.Object) bool
}

ObjectExcluder can be used to add custom object exclude logic to the syncer

type Options

type Options struct {
	// DisableUIDDeletion disables automatic deletion of physical objects if the uid between physical
	// and virtual doesn't match anymore.
	DisableUIDDeletion bool

	IsClusterScopedCRD bool

	SkipMappingsRecording bool

	// ObjectCaching enables an object cache that allows to view the old object states
	ObjectCaching bool
}

type OptionsProvider

type OptionsProvider interface {
	Options() *Options
}

type Starter

type Starter interface {
	ReconcileStart(ctx *synccontext.SyncContext, req ctrl.Request) (bool, error)
	ReconcileEnd()
}

type Sync

type Sync[T client.Object] interface {
	// SyncToHost is called when a virtual object was created and needs to be synced down to the physical cluster
	SyncToHost(ctx *synccontext.SyncContext, event *synccontext.SyncToHostEvent[T]) (ctrl.Result, error)
	// Sync is called to sync a virtual object with a physical object
	Sync(ctx *synccontext.SyncContext, event *synccontext.SyncEvent[T]) (ctrl.Result, error)
	// SyncToVirtual is called when a host object exists but the virtual object does not exist
	SyncToVirtual(ctx *synccontext.SyncContext, event *synccontext.SyncToVirtualEvent[T]) (ctrl.Result, error)
}

type Syncer

type Syncer interface {
	Object
	synccontext.Mapper

	Syncer() Sync[client.Object]
}

type Translator

type Translator interface {
	Object
	syncercontext.Mapper
}

Translator is used to translate names as well as metadata between virtual and physical objects

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL