mutation

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: 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 NewMutator

func NewMutator(client ctrlclient.Client) builder.Mutator

NewMutator returns the package's Mutator.

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 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 SetLastResizeAnnotation added in v1.9.0

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

SetLastResizeAnnotation 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