Documentation
¶
Index ¶
- func JoinContext(left, right context.Context) context.Context
- func NewContext() context.Context
- func Register(ctx context.Context, r Reconciler) context.Context
- func ValidateContext(ctx context.Context) bool
- func WithContext(parent context.Context) context.Context
- type Reconciler
- type ReconcilerWithContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JoinContext ¶
JoinContext returns a new context that contains a reference to the reconcilers map from the specified context. This function panics if the provided context does not contain a reconcilers map. This function is thread-safe.
func NewContext ¶
NewContext returns a new context with a new reconcilers map.
func Register ¶
func Register(ctx context.Context, r Reconciler) context.Context
Register registers the reconciler in the provided context. Please note, if two reconcilers have the same name, the last one registered takes precedence.
func ValidateContext ¶
ValidateContext returns true if the provided context contains the reconcilers map.
Types ¶
type Reconciler ¶
type Reconciler interface {
// Name returns the unique name used to identify the reconciler.
Name() string
// Reconcile should be called prior to creating a VirtualMachine or updating
// its configuration.
Reconcile(
ctx context.Context,
k8sClient ctrlclient.Client,
vimClient *vim25.Client,
vm *vmopv1.VirtualMachine,
moVM mo.VirtualMachine,
configSpec *vimtypes.VirtualMachineConfigSpec) error
// OnResult should be called after creating a VirtualMachine or updating its
// configuration.
OnResult(
ctx context.Context,
vm *vmopv1.VirtualMachine,
moVM mo.VirtualMachine,
resultErr error) error
}
Reconciler is a type that modifies a VirtualMachine's configuration before and/or after creating or updating the underlying, platform resource.
func FromContext ¶
func FromContext(ctx context.Context) []Reconciler
FromContext returns the list of registered reconcilers.
type ReconcilerWithContext ¶
type ReconcilerWithContext interface {
Reconciler
// WithContext returns a context used to share state between the Reconcile
// and OnResult methods.
WithContext(context.Context) context.Context
}
ReconcilerWithContext is a Reconciler that has state to share between its Reconcile and OnResult methods and does so via the context.