-
Notifications
You must be signed in to change notification settings - Fork 573
SPLAT-2206: Added AWS dedicated host support #2484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,6 +114,15 @@ type AWSMachineProviderConfig struct { | |
// If this value is selected, capacityReservationID must be specified to identify the target reservation. | ||
// +optional | ||
MarketType MarketType `json:"marketType,omitempty"` | ||
|
||
// dedicatedHost configures placement on AWS Dedicated Hosts. | ||
// When omitted, the instance is not constrained to a dedicated host. | ||
// If hostAffinity is set to "Host", a host ID must be provided at dedicatedHost.host.hostID. | ||
// If hostAffinity is set to "AnyAvailable", dedicatedHost.host must be omitted. | ||
// If hostAffinity is omitted and host.hostID is set, the instance starts on that specific host. | ||
// +openshift:enable:FeatureGate=AWSDedicatedHosts | ||
// +optional | ||
DedicatedHost *DedicatedHost `json:"dedicatedHost,omitempty"` | ||
} | ||
|
||
// AWSConfidentialComputePolicy represents the confidential compute configuration for the instance. | ||
|
@@ -393,3 +402,47 @@ const ( | |
// When set to CapacityBlock the instance utilizes pre-purchased compute capacity (capacity blocks) with AWS Capacity Reservations. | ||
MarketTypeCapacityBlock MarketType = "CapacityBlock" | ||
) | ||
|
||
type DedicatedHost struct { | ||
// hostAffinity specifies the dedicated host affinity setting for the instance. | ||
// When HostAffinity is set to Host, an instance started onto a specific host always restarts on the same host if stopped. | ||
// When HostAffinity is set to AnyAvailable, and you stop and restart the instance, it can be restarted on any available host. | ||
// When HostAffinity is defined, Host is required. | ||
// The default value is AnyAvailable | ||
// +kubebuilder:default=AnyAvailable | ||
// +openshift:enable:FeatureGate=AWSDedicatedHosts | ||
// +optional | ||
HostAffinity HostAffinity `json:"hostAffinity,omitempty"` | ||
|
||
// host specifies a particular dedicated host when required by hostAffinity or when | ||
// hostAffinity is omitted and you want to target a specific host. | ||
// Must be omitted when hostAffinity is "AnyAvailable". | ||
Comment on lines
+417
to
+419
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we want something more like:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'll make the change. |
||
// +openshift:enable:FeatureGate=AWSDedicatedHosts | ||
// +optional | ||
Host Host `json:"host,omitzero"` | ||
} | ||
|
||
// HostAffinity selects how an instance should be placed on AWS Dedicated Hosts. | ||
// +kubebuilder:validation:Enum:=Host;AnyAvailable | ||
type HostAffinity string | ||
|
||
const ( | ||
// HostAffinityAnyAvailable lets the platform select any available dedicated host. | ||
HostAffinityAnyAvailable HostAffinity = "AnyAvailable" | ||
|
||
// HostAffinityHost requires specifying a particular host via dedicatedHost.host.hostID. | ||
HostAffinityHost HostAffinity = "Host" | ||
) | ||
|
||
type Host struct { | ||
// id identifies the AWS Dedicated Host on which the instance must run. | ||
// The value must start with "h-" followed by 17 lowercase hexadecimal characters (0-9 and a-f). | ||
// Minimum length is 19 characters. | ||
// Maximum length is 19 characters. | ||
// +kubebuilder:validation:XValidation:rule="self.matches('^h-[0-9a-f]{17}$')",message="hostID must start with 'h-' followed by 17 lowercase hexadecimal characters (0-9 and a-f)" | ||
// +kubebuilder:validation:MinLength=19 | ||
// +kubebuilder:validation:MaxLength=19 | ||
// +openshift:enable:FeatureGate=AWSDedicatedHosts | ||
// +required | ||
HostID string `json:"id,omitempty"` | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "discriminant" should be required so an end user has to make an explicit decision here - hostAffinity is the discriminant here. Because the parent field is already optional it is safe to make this field required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if affinity should be outside the dedicated host section. This way, we use the DedicatedHost field and have ID under it.