vmlifecycle

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OvfEnvironmentTransportGuestInfo is the OVF transport type that uses
	// GuestInfo. The other valid type is "iso".
	OvfEnvironmentTransportGuestInfo = "com.vmware.guestInfo"
)

Variables

View Source
var CloudInitUserDataSecretKeys = []string{"user-data", "value"}

CloudInitUserDataSecretKeys are the Secret keys that in v1a1 we'd check for the userdata. Specifically, CAPBK uses "value" for its key, while "user-data" is the preferred key nowadays. The 'value' key lookup will eventually be deprecated.

View Source
var (
	// VMStatusPropertiesSelector is the minimum properties needed to be retrieved in order to populate
	// the Status. Callers may provide a MO with more. This often saves us a second round trip in the
	// common steady state.
	VMStatusPropertiesSelector = []string{
		"config.changeTrackingEnabled",
		"config.extraConfig",
		"guest",
		"summary",
	}
)

Functions

func CreateVirtualMachine

func CreateVirtualMachine(
	vmCtx context.VirtualMachineContextA2,
	clClient contentlibrary.Provider,
	restClient *rest.Client,
	finder *find.Finder,
	createArgs *CreateArgs) (*types.ManagedObjectReference, error)

func GetCloudInitGuestInfoCustSpec

func GetCloudInitGuestInfoCustSpec(
	config *types.VirtualMachineConfigInfo,
	metadata, userdata string) (*types.VirtualMachineConfigSpec, error)

func GetCloudInitMetadata

func GetCloudInitMetadata(
	uid string,
	hostname string,
	netplan *network.Netplan,
	sshPublicKeys string) (string, error)

func GetCloudInitPrepCustSpec

func GetCloudInitPrepCustSpec(
	config *types.VirtualMachineConfigInfo,
	metadata, userdata string) (*types.VirtualMachineConfigSpec, *types.CustomizationSpec, error)

func GetMergedvAppConfigSpec

func GetMergedvAppConfigSpec(inProps map[string]string, vmProps []vimTypes.VAppPropertyInfo) *vimTypes.VmConfigSpec

GetMergedvAppConfigSpec prepares a vApp VmConfigSpec which will set the provided key/value fields. Only fields marked userConfigurable and pre-existing on the VM (ie. originated from the OVF Image) will be set, and all others will be ignored.

func GetOVFVAppConfigForConfigSpec

func GetOVFVAppConfigForConfigSpec(
	config *vimTypes.VirtualMachineConfigInfo,
	vAppConfigSpec *vmopv1.VirtualMachineBootstrapVAppConfigSpec,
	vAppData map[string]string,
	vAppExData map[string]map[string]string,
	templateRenderFn TemplateRenderFunc) vimTypes.BaseVmConfigSpec

func IsCustomizationPendingExtraConfig

func IsCustomizationPendingExtraConfig(extraConfig []vimTypes.BaseOptionValue) bool

func MarkBootstrapCondition added in v1.8.6

func MarkBootstrapCondition(
	vm *vmopv1.VirtualMachine,
	configInfo *types.VirtualMachineConfigInfo)

func MarkCustomizationInfoCondition

func MarkCustomizationInfoCondition(vm *vmopv1.VirtualMachine, guestInfo *types.GuestInfo)

func MarkVMToolsRunningStatusCondition

func MarkVMToolsRunningStatusCondition(
	vm *vmopv1.VirtualMachine,
	guestInfo *types.GuestInfo)

func UpdateNetworkStatusConfig added in v1.8.6

func UpdateNetworkStatusConfig(vm *vmopv1.VirtualMachine, args BootstrapArgs)

UpdateNetworkStatusConfig updates the provided VM's status.network.config field with information from the provided bootstrap arguments. This is useful for folks booting VMs without bootstrap engines who may wish to manually configure the VM's networking with the valid IP configuration for this VM.

func UpdateStatus

func UpdateStatus(
	vmCtx context.VirtualMachineContextA2,
	k8sClient ctrlclient.Client,
	vcVM *object.VirtualMachine,
	moVM *mo.VirtualMachine) error

Types

type BootstrapArgs

type BootstrapArgs struct {
	BootstrapData

	TemplateRenderFn TemplateRenderFunc
	NetworkResults   network.NetworkInterfaceResults
	Hostname         string
	DNSServers       []string
	SearchSuffixes   []string
}

func GetBootstrapArgs added in v1.8.6

func GetBootstrapArgs(
	ctx context.VirtualMachineContextA2,
	k8sClient ctrl.Client,
	networkResults network.NetworkInterfaceResults,
	bootstrapData BootstrapData) (BootstrapArgs, error)

GetBootstrapArgs returns the information used to bootstrap the VM via one of the many, possible bootstrap engines.

type BootstrapData

type BootstrapData struct {
	Data       map[string]string
	VAppData   map[string]string
	VAppExData map[string]map[string]string

	CloudConfig *cloudinit.CloudConfigSecretData
	Sysprep     *sysprep.SecretData
}

type CloudInitMetadata

type CloudInitMetadata struct {
	InstanceID    string          `yaml:"instance-id,omitempty"`
	LocalHostname string          `yaml:"local-hostname,omitempty"`
	Hostname      string          `yaml:"hostname,omitempty"`
	Network       network.Netplan `yaml:"network,omitempty"`
	PublicKeys    string          `yaml:"public-keys,omitempty"`
}

type CreateArgs

type CreateArgs struct {
	UseContentLibrary bool
	ProviderItemID    string

	ConfigSpec          *types.VirtualMachineConfigSpec
	StorageProvisioning string
	FolderMoID          string
	ResourcePoolMoID    string
	HostMoID            string
	StorageProfileID    string
	DatastoreMoID       string // gce2e only: used only if StorageProfileID is unset
}

CreateArgs contains the arguments needed to create a VM.

type TemplateRenderFunc

type TemplateRenderFunc func(string, string) string

func GetTemplateRenderFunc

func GetTemplateRenderFunc(
	vmCtx context.VirtualMachineContextA2,
	bsArgs *BootstrapArgs,
) TemplateRenderFunc

Jump to

Keyboard shortcuts

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