mutation

package
v1.9.0-p01 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDefaultNetworkInterface

func AddDefaultNetworkInterface(
	ctx *pkgctx.WebhookRequestContext,
	client ctrlclient.Client,
	vm *vmopv1.VirtualMachine) bool

AddDefaultNetworkInterface adds default network interface to a VM if the NoNetwork annotation is not set and no NetworkInterface is specified. Return true if default NetworkInterface is added, otherwise return false.

func AddToManager

func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr ctrlmgr.Manager) error

AddToManager adds the webhook to the provided manager.

func CleanupApplyPowerStateChangeTimeAnno added in v1.10.0

func CleanupApplyPowerStateChangeTimeAnno(
	ctx *pkgctx.WebhookRequestContext,
	vm, oldVM *vmopv1.VirtualMachine) bool

func NewMutator

func NewMutator(client ctrlclient.Client) builder.Mutator

NewMutator returns the package's Mutator.

func ResolveClassAndClassName added in v1.10.0

func ResolveClassAndClassName(
	ctx *pkgctx.WebhookRequestContext,
	c ctrlclient.Client,
	vm *vmopv1.VirtualMachine) (bool, error)

ResolveClassAndClassName resolves the spec.class and spec.className of a VM.

  • If spec.className is specified, but spec.class is empty, then spec.class is set to the active instance of the class.
  • If a VM class instance is specified in spec.class but spec.className is empty, spec.className is set to the class that is the owner of the class instance.
  • If both spec.class and spec.className both are specified, then we ensure that both point to the same class.

func ResolveImageNameOnCreate added in v1.9.0

func ResolveImageNameOnCreate(
	ctx *pkgctx.WebhookRequestContext,
	c ctrlclient.Client,
	vm *vmopv1.VirtualMachine) (bool, error)

ResolveImageNameOnCreate ensures vm.spec.image is set to a non-empty value if vm.spec.imageName is also non-empty.

func SetCreatedAtAnnotations added in v1.9.0

func SetCreatedAtAnnotations(ctx context.Context, vm *vmopv1.VirtualMachine)

func SetDefaultBiosUUID added in v1.9.0

func SetDefaultBiosUUID(
	ctx *pkgctx.WebhookRequestContext,
	client ctrlclient.Client,
	vm *vmopv1.VirtualMachine) (bool, error)

SetDefaultBiosUUID sets a default bios uuid for a new VM. If CloudInit is the Bootstrap method, CloudInit InstanceID is also set to BiosUUID. Return true if a default bios uuid was set, otherwise false.

func SetDefaultCdromImgKindOnCreate added in v1.9.0

func SetDefaultCdromImgKindOnCreate(
	ctx *pkgctx.WebhookRequestContext,
	vm *vmopv1.VirtualMachine)

func SetDefaultCdromImgKindOnUpdate added in v1.9.0

func SetDefaultCdromImgKindOnUpdate(
	ctx *pkgctx.WebhookRequestContext,
	vm, oldVM *vmopv1.VirtualMachine) bool

func SetDefaultEncryptionClass added in v1.9.0

func SetDefaultEncryptionClass(
	ctx *pkgctx.WebhookRequestContext,
	k8sClient ctrlclient.Client,
	vm *vmopv1.VirtualMachine) (bool, error)

SetDefaultEncryptionClass assigns spec.crypto.encryptionClassName to the namespace's default EncryptionClass when creating a VM if spec.crypto is nil or spec.crypto.encryptionClassName is empty.

func SetDefaultInstanceUUID added in v1.9.0

func SetDefaultInstanceUUID(
	ctx *pkgctx.WebhookRequestContext,
	client ctrlclient.Client,
	vm *vmopv1.VirtualMachine) (bool, error)

SetDefaultInstanceUUID sets a default instance uuid for a new VM. Return true if a default instance uuid was set, otherwise false.

func SetDefaultNetworkOnUpdate added in v1.10.0

func SetDefaultNetworkOnUpdate(
	ctx *pkgctx.WebhookRequestContext,
	client ctrlclient.Client,
	vm *vmopv1.VirtualMachine) bool

func SetDefaultPowerState added in v1.9.0

func SetDefaultPowerState(
	ctx *pkgctx.WebhookRequestContext,
	client ctrlclient.Client,
	vm *vmopv1.VirtualMachine) bool

SetDefaultPowerState sets the default power state for a new VM. Return true if the default power state was set, otherwise false.

func SetImageNameFromCdrom added in v1.9.0

func SetImageNameFromCdrom(
	ctx *pkgctx.WebhookRequestContext,
	vm *vmopv1.VirtualMachine)

func SetLastResizeAnnotations added in v1.10.0

func SetLastResizeAnnotations(
	ctx *pkgctx.WebhookRequestContext,
	vm, oldVM *vmopv1.VirtualMachine) (bool, error)

SetLastResizeAnnotations sets the last resize annotation as needed when the class name changes.

func SetNextRestartTime added in v1.9.0

func SetNextRestartTime(
	ctx *pkgctx.WebhookRequestContext,
	newVM, oldVM *vmopv1.VirtualMachine) (bool, error)

SetNextRestartTime sets spec.nextRestartTime for a VM if the field's current value is equal to "now" (case-insensitive). Return true if set, otherwise false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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