context

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFinder added in v1.10.0

func GetFinder(ctx context.Context) *find.Finder

GetFinder returns the finder from a context. Nil is returned if the finder is not present in the context.

func GetRestClient added in v1.10.0

func GetRestClient(ctx context.Context) *rest.Client

func GetVMRecentTasks added in v1.10.0

func GetVMRecentTasks(ctx context.Context) []vimtypes.TaskInfo

func GetVMTags added in v1.10.0

func GetVMTags(ctx context.Context) []string

func GetVimClient added in v1.10.0

func GetVimClient(ctx context.Context) *vim25.Client

func HasVMRunningSnapshotTask added in v1.10.0

func HasVMRunningSnapshotTask(ctx context.Context) bool

HasVMRunningSnapshotTask returns true if the VM has a running snapshot-related task.

func HasVMRunningTask added in v1.10.0

func HasVMRunningTask(ctx context.Context, checkSharedLock bool) bool

HasVMRunningTask returns true if the VM has a running task that should block reconciling the VM's desired state.

func WithFinder added in v1.10.0

func WithFinder(ctx context.Context, finder *find.Finder) context.Context

WithFinder returns a new context with the finder inside of it.

func WithRestClient added in v1.10.0

func WithRestClient(
	parent context.Context,
	c *rest.Client) context.Context

func WithVMRecentTasks added in v1.10.0

func WithVMRecentTasks(
	parent context.Context,
	taskInfo []vimtypes.TaskInfo) context.Context

func WithVMTags added in v1.10.0

func WithVMTags(
	parent context.Context,
	tags []string) context.Context

func WithVimClient added in v1.10.0

func WithVimClient(
	parent context.Context,
	c *vim25.Client) context.Context

Types

type ControllerManagerContext

type ControllerManagerContext struct {
	context.Context

	// Namespace is the namespace in which the resource is located responsible
	// for running the controller manager.
	Namespace string

	// Name is the name of the controller manager.
	Name string

	// ServiceAccountName is the name of the pod's service account.
	ServiceAccountName string

	// LeaderElectionID is the information used to identify the object
	// responsible for synchronizing leader election.
	LeaderElectionID string

	// LeaderElectionNamespace is the namespace in which the LeaderElection
	// object is located.
	LeaderElectionNamespace string

	// WatchNamespace is the namespace the controllers watch for changes. If
	// no value is specified then all namespaces are watched.
	WatchNamespace string

	// Logger is the controller manager's logger.
	Logger logr.Logger

	// Recorder is used to record events.
	Recorder record.Recorder

	// MaxConcurrentReconciles is the maximum number of reconcile requests this
	// controller will receive concurrently.
	MaxConcurrentReconciles int

	// WebhookServiceNamespace is the namespace in which the webhook service
	// is located.
	WebhookServiceNamespace string

	// WebhookServiceName is the name of the webhook service.
	WebhookServiceName string

	// WebhookSecretNamespace is the namespace in which the webhook secret
	// is located.
	WebhookSecretNamespace string

	// WebhookSecretName is the name of the webhook secret.
	WebhookSecretName string

	// ContainerNode should be true if we're running guest cluster nodes in containers.
	ContainerNode bool

	// SyncPeriod determines the minimum frequency at which watched resources are
	// reconciled. A lower period will correct entropy more quickly, but reduce
	// responsiveness to change if there are many watched resources.
	SyncPeriod time.Duration

	// VMProvider is the controller manager's VM Provider.
	VMProvider providers.VirtualMachineProviderInterface

	// EnableClientVerification determines whether to use client certificate
	// verification for authentication to webhook requests.
	EnableWebhookClientVerification bool
}

ControllerManagerContext is the context of the controller that owns the controllers.

func (*ControllerManagerContext) String

func (c *ControllerManagerContext) String() string

String returns ControllerManagerName.

type VirtualMachineClassContext

type VirtualMachineClassContext struct {
	context.Context
	Logger  logr.Logger
	VMClass *vmopv1.VirtualMachineClass
}

VirtualMachineClassContext is the context used for VirtualMachineClassControllers.

func (*VirtualMachineClassContext) String

func (v *VirtualMachineClassContext) String() string

type VirtualMachineContext

type VirtualMachineContext struct {
	context.Context
	Logger logr.Logger
	VM     *vmopv1.VirtualMachine
	MoVM   mo.VirtualMachine
}

VirtualMachineContext is the context used for VirtualMachineControllers.

func (VirtualMachineContext) IsOffToOn added in v1.10.0

func (v VirtualMachineContext) IsOffToOn() bool

func (VirtualMachineContext) IsOnToOff added in v1.10.0

func (v VirtualMachineContext) IsOnToOff() bool

func (VirtualMachineContext) String

func (v VirtualMachineContext) String() string

type VirtualMachineGroupContext added in v1.10.0

type VirtualMachineGroupContext struct {
	context.Context
	Logger  logr.Logger
	VMGroup *vmopv1.VirtualMachineGroup
}

VirtualMachineGroupContext is the context used for VirtualMachineGroupControllers.

func (*VirtualMachineGroupContext) String added in v1.10.0

func (v *VirtualMachineGroupContext) String() string

type VirtualMachineGroupPublishRequestContext added in v1.10.0

type VirtualMachineGroupPublishRequestContext struct {
	context.Context
	Logger                logr.Logger
	VMGroupPublishRequest *vmopv1.VirtualMachineGroupPublishRequest
}

VirtualMachineGroupPublishRequestContext is the context used for the VirtualMachineGroupPublishRequest controller.

func (VirtualMachineGroupPublishRequestContext) String added in v1.10.0

type VirtualMachinePublishRequestContext

type VirtualMachinePublishRequestContext struct {
	context.Context
	Logger             logr.Logger
	VMPublishRequest   *vmopv1.VirtualMachinePublishRequest
	VM                 *vmopv1.VirtualMachine
	ContentLibrary     *imgregv1a1.ContentLibrary
	ContentLibraryV1A2 *imgregv1.ContentLibrary
	ContentLibraryType imgregv1.LibraryType
	ItemID             string
	// SkipPatch indicates whether we should skip patching the object after reconcile
	// because Status is updated separately in the publishing case due to CL API limitations.
	SkipPatch bool
}

VirtualMachinePublishRequestContext is the context used for VirtualMachinePublishRequestControllers.

func (*VirtualMachinePublishRequestContext) String

type VirtualMachineReplicaSetContext added in v1.9.0

type VirtualMachineReplicaSetContext struct {
	context.Context
	Logger     logr.Logger
	ReplicaSet *vmopv1.VirtualMachineReplicaSet
}

VirtualMachineReplicaSetContext is the context used for VirtualMachineReplicaSetContext reconciliation.

func (*VirtualMachineReplicaSetContext) String added in v1.9.0

type VirtualMachineServiceContext

type VirtualMachineServiceContext struct {
	context.Context
	Logger    logr.Logger
	VMService *vmopv1.VirtualMachineService
}

VirtualMachineServiceContext is the context used for VirtualMachineServiceController.

func (*VirtualMachineServiceContext) String

type VirtualMachineSetResourcePolicyContext

type VirtualMachineSetResourcePolicyContext struct {
	context.Context
	Logger         logr.Logger
	ResourcePolicy *vmopv1.VirtualMachineSetResourcePolicy
}

VirtualMachineSetResourcePolicyContext is the context used for VirtualMachineControllers.

func (*VirtualMachineSetResourcePolicyContext) String

type VirtualMachineSnapshotContext added in v1.10.0

type VirtualMachineSnapshotContext struct {
	context.Context
	Logger                 logr.Logger
	VirtualMachineSnapshot *vmopv1.VirtualMachineSnapshot
	VM                     *vmopv1.VirtualMachine
	StorageClassesToSync   sets.Set[string]
}

VirtualMachineSnapshotContext is the context used for VirtualMachineSnapShotControllers.

func (*VirtualMachineSnapshotContext) String added in v1.10.0

type VolumeContext

type VolumeContext struct {
	context.Context
	Logger logr.Logger
	VM     *vmopv1.VirtualMachine
}

VolumeContext is the context used for VolumeController.

func (*VolumeContext) String

func (v *VolumeContext) String() string

type WebConsoleRequestContext

type WebConsoleRequestContext struct {
	context.Context
	Logger            logr.Logger
	WebConsoleRequest *v1alpha1.WebConsoleRequest
	VM                *v1alpha1.VirtualMachine
}

WebConsoleRequestContext is the context used for WebConsoleRequestControllers.

func (*WebConsoleRequestContext) String

func (v *WebConsoleRequestContext) String() string

type WebConsoleRequestContextV1 added in v1.9.0

type WebConsoleRequestContextV1 struct {
	context.Context
	Logger            logr.Logger
	WebConsoleRequest *vmopv1.VirtualMachineWebConsoleRequest
	VM                *vmopv1.VirtualMachine
}

WebConsoleRequestContextV1 is the context used for WebConsoleRequestControllers.

func (*WebConsoleRequestContextV1) String added in v1.9.0

func (v *WebConsoleRequestContextV1) String() string

type WebhookContext

type WebhookContext struct {
	context.Context

	// Name is the name of the webhook.
	Name string

	// Namespace is the namespace the webhook is running in.
	Namespace string

	// ServiceAccountName is the service account name of the pod.
	ServiceAccountName string

	// Logger is the webhook's logger.
	Logger logr.Logger

	// Recorder is used to record events.
	Recorder record.Recorder

	// EnableClientVerification determines whether to use client certificate
	// verification for authentication to webhook requests.
	EnableWebhookClientVerification bool
}

WebhookContext is the context of a webhook.

func (*WebhookContext) String

func (c *WebhookContext) String() string

String returns WebhookName.

type WebhookRequestContext

type WebhookRequestContext struct {
	// WebhookContext is the context of the webhook that spawned this request context.
	*WebhookContext

	// Obj is the resource associated with the webhook request.
	Obj *unstructured.Unstructured

	// RawObj is the raw object from the webhook request.
	RawObj []byte

	// OldObj is set only for Update requests.
	OldObj *unstructured.Unstructured

	// Operation is the operation.
	Op admissionv1.Operation

	// IsPrivilegedAccount is if this request is from a privileged account, ex.
	// - kube-admin
	// - system:masters
	// - VM Op service account
	// - in the privileged account env var
	IsPrivilegedAccount bool

	// IsVMOperatorAccount is if this request is from VM Operator.
	IsVMOperatorAccount bool

	// UserInfo is the user information associated with the webhook request.
	UserInfo authv1.UserInfo

	// Logger is the logger associated with the webhook request.
	Logger logr.Logger
}

WebhookRequestContext is a Go context used with a webhook request.

func (*WebhookRequestContext) String

func (c *WebhookRequestContext) String() string

String returns Obj.GroupVersionKind Obj.Namespace/Obj.Name.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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