@@ -7,45 +7,6 @@ import (
77 clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
88)
99
10- // MicrovmSpec represents the specification for a microvm.
11- type MicrovmSpec struct {
12- // VCPU specifies how many vcpu's the microvm will be allocated.
13- // +kubebuilder:validation:Required
14- // +kubebuilder:validation:Minimum:=1
15- VCPU int64 `json:"vcpu"`
16-
17- // MemoryMb is the amount of memory in megabytes that the microvm will be allocated.
18- // +kubebuilder:validation:Required
19- // +kubebuilder:validation:Minimum:=1024
20- MemoryMb int64 `json:"memoryMb"`
21-
22- // RootVolume specifies the volume to use for the root of the microvm.
23- // +kubebuilder:validation:Required
24- RootVolume Volume `json:"rootVolume"`
25-
26- // AdditionalVolumes specifies additional non-root volumes to attach to the microvm.
27- // +optional
28- AdditionalVolumes []Volume `json:"volumes,omitempty"`
29-
30- // Kernel specifies the kernel and its arguments to use.
31- // +kubebuilder:validation:Required
32- Kernel ContainerFileSource `json:"kernel"`
33-
34- // KernelCmdLine are the additional args to use for the kernel cmdline.
35- // Each MicroVM provider has its own recommended list, they will be used
36- // automatically. This field is for additional values.
37- KernelCmdLine map [string ]string `json:"kernelCmdline,omitempty"`
38-
39- // Initrd is an optional initial ramdisk to use.
40- // +optional
41- Initrd * ContainerFileSource `json:"initrd,omitempty"`
42-
43- // NetworkInterfaces specifies the network interfaces attached to the microvm.
44- // +kubebuilder:validation:Required
45- // +kubebuilder:validation:MinItems:=1
46- NetworkInterfaces []NetworkInterface `json:"networkInterfaces"`
47- }
48-
4910// MicrovmMachineTemplateResource describes the data needed to create a MicrovmMachine from a template.
5011type MicrovmMachineTemplateResource struct {
5112 // Standard object's metadata.
@@ -57,73 +18,6 @@ type MicrovmMachineTemplateResource struct {
5718 Spec MicrovmMachineSpec `json:"spec"`
5819}
5920
60- // ContainerFileSource represents a file coming from a container.
61- type ContainerFileSource struct {
62- // Image is the container image to use.
63- // +kubebuilder:validation:Required
64- Image string `json:"image"`
65- // Filename is the name of the file in the container to use.
66- // +optional
67- Filename string `json:"filename,omitempty"`
68- }
69-
70- // Volume represents a volume to be attached to a microvm.
71- type Volume struct {
72- // ID is a unique identifier for this volume.
73- // +kubebuilder:validation:Required
74- ID string `json:"id"`
75- // Image is the container image to use for the volume.
76- // +kubebuilder:validation:Required
77- Image string `json:"image"`
78- // ReadOnly specifies that the volume is to be mounted readonly.
79- // +kubebuilder:default:=false
80- // +optional
81- ReadOnly bool `json:"readOnly,omitempty"`
82- }
83-
84- // IfaceType is a type representing the network interface types.
85- type IfaceType string
86-
87- const (
88- // IfaceTypeTap is a TAP network interface.
89- IfaceTypeTap = "tap"
90- // IfaceTypeMacvtap is a MACVTAP network interface.
91- IfaceTypeMacvtap = "macvtap"
92- )
93-
94- // NetworkInterface represents a network interface for the microvm.
95- type NetworkInterface struct {
96- // GuestDeviceName is the name of the network interface to create in the microvm.
97- // +kubebuilder:validation:Required
98- GuestDeviceName string `json:"guestDeviceName"`
99- // GuestMAC allows the specifying of a specific MAC address to use for the interface. If
100- // not supplied a autogenerated MAC address will be used.
101- // +optional
102- GuestMAC string `json:"guestMac,omitempty"`
103- // Type is the type of host network interface type to create to use by the guest.
104- // +kubebuilder:validation:Enum=macvtap;tap
105- Type IfaceType `json:"type"`
106- // Address is an optional IP address to assign to this interface. If not supplied then DHCP will be used.
107- // +optional
108- Address string `json:"address,omitempty"`
109- }
110-
111- // VMState is a type that represents the state of a microvm.
112- type VMState string
113-
114- var (
115- // VMStatePending indicates the microvm hasn't been started.
116- VMStatePending = VMState ("pending" )
117- // VMStateRunning indicates the microvm is running.
118- VMStateRunning = VMState ("running" )
119- // VMStateFailed indicates the microvm has failed.
120- VMStateFailed = VMState ("failed" )
121- // VMStateDeleted indicates the microvm has been deleted.
122- VMStateDeleted = VMState ("deleted" )
123- // VMStateUnknown indicates the microvm is in an state that is unknown/supported by CAPMVM.
124- VMStateUnknown = VMState ("unknown" )
125- )
126-
12721// Placement represents configuration relating to the placement of the microvms. The number of placement
12822// options will grow and so we need to ensure in the validation webhook that only 1 placement types
12923// is configured.
@@ -167,7 +61,8 @@ type MicrovmHost struct {
16761 // Name is an optional name for the host.
16862 // +optional
16963 Name string `json:"name,omitempty"`
170- // Endpoint is the API endpoint for the microvm service (i.e. flintlock).
64+ // Endpoint is the API endpoint for the microvm service (i.e. flintlock)
65+ // including the port.
17166 // +kubebuilder:validation:Required
17267 Endpoint string `json:"endpoint"`
17368 // ControlPlaneAllowed marks this host as suitable for running control plane nodes in
@@ -176,12 +71,6 @@ type MicrovmHost struct {
17671 ControlPlaneAllowed bool `json:"controlplaneAllowed"`
17772}
17873
179- // Proxy represents a proxy server.
180- type Proxy struct {
181- // Endpoint is the address of the proxy.
182- Endpoint string `json:"endpoint"`
183- }
184-
18574// TLSConfig represents config for connecting to TLS enabled hosts.
18675type TLSConfig struct {
18776 Cert []byte `json:"cert"`
0 commit comments