1 package v1beta1 2 3 import ( 4 corev1 "k8s.io/api/core/v1" 5 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 6 ) 7 8 // VSphereMachineProviderSpec is the type that will be embedded in a Machine.Spec.ProviderSpec field 9 // for an VSphere virtual machine. It is used by the vSphere machine actuator to create a single Machine. 10 // Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer). 11 // +openshift:compatibility-gen:level=2 12 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 13 type VSphereMachineProviderSpec struct { 14 metav1.TypeMeta `json:",inline"` 15 // +optional 16 metav1.ObjectMeta `json:"metadata,omitempty"` 17 // UserDataSecret contains a local reference to a secret that contains the 18 // UserData to apply to the instance 19 // +optional 20 UserDataSecret *corev1.LocalObjectReference `json:"userDataSecret,omitempty"` 21 // CredentialsSecret is a reference to the secret with vSphere credentials. 22 // +optional 23 CredentialsSecret *corev1.LocalObjectReference `json:"credentialsSecret,omitempty"` 24 // Template is the name, inventory path, or instance UUID of the template 25 // used to clone new machines. 26 Template string `json:"template"` 27 // Workspace describes the workspace to use for the machine. 28 // +optional 29 Workspace *Workspace `json:"workspace,omitempty"` 30 // Network is the network configuration for this machine's VM. 31 Network NetworkSpec `json:"network"` 32 // NumCPUs is the number of virtual processors in a virtual machine. 33 // Defaults to the analogue property value in the template from which this 34 // machine is cloned. 35 // +optional 36 NumCPUs int32 `json:"numCPUs,omitempty"` 37 // NumCPUs is the number of cores among which to distribute CPUs in this 38 // virtual machine. 39 // Defaults to the analogue property value in the template from which this 40 // machine is cloned. 41 // +optional 42 NumCoresPerSocket int32 `json:"numCoresPerSocket,omitempty"` 43 // MemoryMiB is the size of a virtual machine's memory, in MiB. 44 // Defaults to the analogue property value in the template from which this 45 // machine is cloned. 46 // +optional 47 MemoryMiB int64 `json:"memoryMiB,omitempty"` 48 // DiskGiB is the size of a virtual machine's disk, in GiB. 49 // Defaults to the analogue property value in the template from which this 50 // machine is cloned. 51 // This parameter will be ignored if 'LinkedClone' CloneMode is set. 52 // +optional 53 DiskGiB int32 `json:"diskGiB,omitempty"` 54 // Snapshot is the name of the snapshot from which the VM was cloned 55 // +optional 56 Snapshot string `json:"snapshot"` 57 // CloneMode specifies the type of clone operation. 58 // The LinkedClone mode is only support for templates that have at least 59 // one snapshot. If the template has no snapshots, then CloneMode defaults 60 // to FullClone. 61 // When LinkedClone mode is enabled the DiskGiB field is ignored as it is 62 // not possible to expand disks of linked clones. 63 // Defaults to FullClone. 64 // When using LinkedClone, if no snapshots exist for the source template, falls back to FullClone. 65 // +optional 66 CloneMode CloneMode `json:"cloneMode,omitempty"` 67 } 68 69 // CloneMode is the type of clone operation used to clone a VM from a template. 70 type CloneMode string 71 72 const ( 73 // FullClone indicates a VM will have no relationship to the source of the 74 // clone operation once the operation is complete. This is the safest clone 75 // mode, but it is not the fastest. 76 FullClone CloneMode = "fullClone" 77 // LinkedClone means resulting VMs will be dependent upon the snapshot of 78 // the source VM/template from which the VM was cloned. This is the fastest 79 // clone mode, but it also prevents expanding a VMs disk beyond the size of 80 // the source VM/template. 81 LinkedClone CloneMode = "linkedClone" 82 ) 83 84 // NetworkSpec defines the virtual machine's network configuration. 85 type NetworkSpec struct { 86 // Devices defines the virtual machine's network interfaces. 87 Devices []NetworkDeviceSpec `json:"devices"` 88 } 89 90 // NetworkDeviceSpec defines the network configuration for a virtual machine's 91 // network device. 92 type NetworkDeviceSpec struct { 93 // NetworkName is the name of the vSphere network to which the device 94 // will be connected. 95 NetworkName string `json:"networkName"` 96 } 97 98 // WorkspaceConfig defines a workspace configuration for the vSphere cloud 99 // provider. 100 type Workspace struct { 101 // Server is the IP address or FQDN of the vSphere endpoint. 102 // +optional 103 Server string `gcfg:"server,omitempty" json:"server,omitempty"` 104 // Datacenter is the datacenter in which VMs are created/located. 105 // +optional 106 Datacenter string `gcfg:"datacenter,omitempty" json:"datacenter,omitempty"` 107 // Folder is the folder in which VMs are created/located. 108 // +optional 109 Folder string `gcfg:"folder,omitempty" json:"folder,omitempty"` 110 // Datastore is the datastore in which VMs are created/located. 111 // +optional 112 Datastore string `gcfg:"default-datastore,omitempty" json:"datastore,omitempty"` 113 // ResourcePool is the resource pool in which VMs are created/located. 114 // +optional 115 ResourcePool string `gcfg:"resourcepool-path,omitempty" json:"resourcePool,omitempty"` 116 } 117 118 // VSphereMachineProviderStatus is the type that will be embedded in a Machine.Status.ProviderStatus field. 119 // It contains VSphere-specific status information. 120 // Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer). 121 // +openshift:compatibility-gen:level=2 122 type VSphereMachineProviderStatus struct { 123 metav1.TypeMeta `json:",inline"` 124 125 // InstanceID is the ID of the instance in VSphere 126 // +optional 127 InstanceID *string `json:"instanceId,omitempty"` 128 // InstanceState is the provisioning state of the VSphere Instance. 129 // +optional 130 InstanceState *string `json:"instanceState,omitempty"` 131 // Conditions is a set of conditions associated with the Machine to indicate 132 // errors or other status 133 Conditions []metav1.Condition `json:"conditions,omitempty"` 134 // TaskRef is a managed object reference to a Task related to the machine. 135 // This value is set automatically at runtime and should not be set or 136 // modified by users. 137 // +optional 138 TaskRef string `json:"taskRef,omitempty"` 139 } 140