vmconfig

package
v1.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinContext

func JoinContext(left, right context.Context) context.Context

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

func NewContext() context.Context

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

func ValidateContext(ctx context.Context) bool

ValidateContext returns true if the provided context contains the reconcilers map.

func WithContext

func WithContext(parent context.Context) context.Context

WithContext returns a new context with a new reconcilers map, with the provided context as the parent.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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