@@ -218,6 +218,10 @@ type AWSMachineSpec struct {
218218 PlacementGroupPartition int64 `json:"placementGroupPartition,omitempty"`
219219
220220 // Tenancy indicates if instance should run on shared or single-tenant hardware.
221+ // When Tenancy=host, AWS will attempt to find a suitable host from:
222+ // - Preexisting allocated hosts that have auto-placement enabled
223+ // - A specific host ID, if configured
224+ // - Allocating a new dedicated host if DynamicHostAllocation is configured
221225 // +optional
222226 // +kubebuilder:validation:Enum:=default;dedicated;host
223227 Tenancy string `json:"tenancy,omitempty"`
@@ -240,17 +244,28 @@ type AWSMachineSpec struct {
240244 MarketType MarketType `json:"marketType,omitempty"`
241245
242246 // HostID specifies the Dedicated Host on which the instance must be started.
247+ // This field is mutually exclusive with DynamicHostAllocation.
248+ // +kubebuilder:validation:Pattern=`^h-[0-9a-f]{17}$`
249+ // +kubebuilder:validation:MaxLength=19
243250 // +optional
244251 HostID * string `json:"hostID,omitempty"`
245252
246253 // HostAffinity specifies the dedicated host affinity setting for the instance.
247- // When hostAffinity is set to host, an instance started onto a specific host always restarts on the same host if stopped.
248- // When hostAffinity is set to default, and you stop and restart the instance, it can be restarted on any available host.
254+ // When HostAffinity is set to host, an instance started onto a specific host always restarts on the same host if stopped.
255+ // When HostAffinity is set to default, and you stop and restart the instance, it can be restarted on any available host.
249256 // When HostAffinity is defined, HostID is required.
250257 // +optional
251258 // +kubebuilder:validation:Enum:=default;host
259+ // +kubebuilder:default=host
252260 HostAffinity * string `json:"hostAffinity,omitempty"`
253261
262+ // DynamicHostAllocation enables automatic allocation of a single dedicated host.
263+ // This field is mutually exclusive with HostID and always allocates exactly one host.
264+ // Cost effectiveness of allocating a single instance on a dedicated host may vary
265+ // depending on the instance type and the region.
266+ // +optional
267+ DynamicHostAllocation * DynamicHostAllocationSpec `json:"dynamicHostAllocation,omitempty"`
268+
254269 // CapacityReservationPreference specifies the preference for use of Capacity Reservations by the instance. Valid values include:
255270 // "Open": The instance may make use of open Capacity Reservations that match its AZ and InstanceType
256271 // "None": The instance may not make use of any Capacity Reservations. This is to conserve open reservations for desired workloads
@@ -260,6 +275,14 @@ type AWSMachineSpec struct {
260275 CapacityReservationPreference CapacityReservationPreference `json:"capacityReservationPreference,omitempty"`
261276}
262277
278+ // DynamicHostAllocationSpec defines the configuration for dynamic dedicated host allocation.
279+ // This specification always allocates exactly one dedicated host per machine.
280+ type DynamicHostAllocationSpec struct {
281+ // Tags to apply to the allocated dedicated host.
282+ // +optional
283+ Tags map [string ]string `json:"tags,omitempty"`
284+ }
285+
263286// CloudInit defines options related to the bootstrapping systems where
264287// CloudInit is used.
265288type CloudInit struct {
@@ -438,6 +461,21 @@ type AWSMachineStatus struct {
438461 // Conditions defines current service state of the AWSMachine.
439462 // +optional
440463 Conditions clusterv1.Conditions `json:"conditions,omitempty"`
464+
465+ // DedicatedHost tracks the dynamically allocated dedicated host.
466+ // This field is populated when DynamicHostAllocation is used.
467+ // +optional
468+ DedicatedHost * DedicatedHostStatus `json:"dedicatedHost,omitempty"`
469+ }
470+
471+ // DedicatedHostStatus defines the observed state of a dynamically allocated dedicated host
472+ // associated with an AWSMachine. This struct is used to track the ID of the dedicated host
473+ // and any failure messages encountered during host release operations.
474+ type DedicatedHostStatus struct {
475+ // ID tracks the dynamically allocated dedicated host ID.
476+ // This field is populated when DynamicHostAllocation is used.
477+ // +optional
478+ ID * string `json:"id,omitempty"`
441479}
442480
443481// +kubebuilder:object:root=true
0 commit comments