Skip to content

Commit 1920d7b

Browse files
committed
Added support for legacy AWS dedicated hosts
1 parent 6ab113c commit 1920d7b

File tree

5 files changed

+190
-19
lines changed

5 files changed

+190
-19
lines changed

machine/v1beta1/types_awsprovider.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,13 @@ const (
430430

431431
// HostPlacement is the type that will be used to configure the placement of AWS instances.
432432
// +kubebuilder:validation:XValidation:rule="has(self.affinity) && self.affinity == 'DedicatedHost' ? has(self.dedicatedHost) : true",message="dedicatedHost is required when affinity is DedicatedHost, and optional otherwise"
433+
// +kubebuilder:validation:XValidation:rule="has(self.affinity) && has(self.dynamicHost) ? self.affinity == 'DynamicHost' : true",message="dynamicHost is only allowed when affinity is DynamicHost, and forbidden otherwise"
433434
// +union
434435
type HostPlacement struct {
435436
// affinity specifies the affinity setting for the instance.
436437
// Allowed values are AnyAvailable and DedicatedHost.
437438
// When Affinity is set to DedicatedHost, an instance started onto a specific host always restarts on the same host if stopped. In this scenario, the `dedicatedHost` field must be set.
439+
// When Affinity is set to DynamicHost, a dedicated host will be allocated and assigned to the instance and the instance will always restart on this host if stopped. In this scenario, the `dynamicHost` field may be set to provide additional settings.
438440
// When Affinity is set to AnyAvailable, and you stop and restart the instance, it can be restarted on any available host.
439441
// When Affinity is set to AnyAvailable and the `dedicatedHost` field is defined, it runs on specified Dedicated Host, but may move if stopped.
440442
// +required
@@ -446,10 +448,16 @@ type HostPlacement struct {
446448
// +optional
447449
// +unionMember
448450
DedicatedHost *DedicatedHost `json:"dedicatedHost,omitempty"`
451+
452+
// dynamicHost enables automatic allocation of a single dedicated host.
453+
// This field is mutually exclusive with dedicatedHost and always allocates exactly one host.
454+
// +optional
455+
// +unionMember
456+
DynamicHostAllocation *DynamicHostAllocationSpec `json:"dynamicHost,omitempty"`
449457
}
450458

451459
// HostAffinity selects how an instance should be placed on AWS Dedicated Hosts.
452-
// +kubebuilder:validation:Enum:=DedicatedHost;AnyAvailable
460+
// +kubebuilder:validation:Enum:=DedicatedHost;AnyAvailable;DynamicHost
453461
type HostAffinity string
454462

455463
const (
@@ -458,6 +466,9 @@ const (
458466

459467
// HostAffinityDedicatedHost requires specifying a particular host via dedicatedHost.host.hostID.
460468
HostAffinityDedicatedHost HostAffinity = "DedicatedHost"
469+
470+
// HostAffinityDynamicHost requires specifying a host config in dynamicHost.
471+
HostAffinityDynamicHost HostAffinity = "DynamicHost"
461472
)
462473

463474
// DedicatedHost represents the configuration for the usage of dedicated host.
@@ -472,3 +483,11 @@ type DedicatedHost struct {
472483
// +required
473484
ID string `json:"id,omitempty"`
474485
}
486+
487+
// DynamicHostAllocationSpec defines the configuration for dynamic dedicated host allocation.
488+
// This specification always allocates exactly one dedicated host per machine.
489+
type DynamicHostAllocationSpec struct {
490+
// tags to apply to the allocated dedicated host.
491+
// +optional
492+
Tags map[string]string `json:"tags,omitempty"`
493+
}

machine/v1beta1/zz_generated.deepcopy.go

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

machine/v1beta1/zz_generated.swagger_doc_generated.go

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi/generated_openapi/zz_generated.openapi.go

Lines changed: 39 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)