-
Notifications
You must be signed in to change notification settings - Fork 585
WIP: SPLAT-2615: Added support for dynamic AWS dedicated hosts #2650
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 |
|---|---|---|
|
|
@@ -407,6 +407,26 @@ type AWSMachineProviderStatus struct { | |
| // +listType=map | ||
| // +listMapKey=type | ||
| Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
| // dedicatedHost tracks the dynamically allocated dedicated host. | ||
| // This field is populated when DynamicHostAllocation is used. | ||
| // +optional | ||
| DedicatedHost *DedicatedHostStatus `json:"dedicatedHost,omitempty"` | ||
| } | ||
|
|
||
| // DedicatedHostStatus defines the observed state of a dynamically allocated dedicated host | ||
| // associated with an AWSMachine. This struct is used to track the ID of the dedicated host. | ||
| // +kubebuilder:validation:MinProperties=1 | ||
| type DedicatedHostStatus struct { | ||
| // id tracks the dynamically allocated dedicated host ID. | ||
| // This field is populated when DynamicHostAllocation is used. | ||
| // The value must start with "h-" followed by either 8 or 17 lowercase hexadecimal characters (0-9 and a-f). | ||
| // The use of 8 lowercase hexadecimal characters is for older legacy hosts that may not have been migrated to newer format. | ||
| // Must be either 10 or 19 characters in length. | ||
| // +kubebuilder:validation:XValidation:rule="self.matches('^h-([0-9a-f]{8}|[0-9a-f]{17})$')",message="hostID must start with 'h-' followed by either 8 or 17 lowercase hexadecimal characters (0-9 and a-f)" | ||
| // +kubebuilder:validation:MinLength=10 | ||
| // +kubebuilder:validation:MaxLength=19 | ||
| // +optional | ||
| ID *string `json:"id,omitempty"` | ||
| } | ||
|
|
||
| // MarketType describes the market type of an EC2 Instance | ||
|
|
@@ -454,21 +474,72 @@ type HostAffinity string | |
|
|
||
| const ( | ||
| // HostAffinityAnyAvailable lets the platform select any available dedicated host. | ||
|
|
||
| HostAffinityAnyAvailable HostAffinity = "AnyAvailable" | ||
|
|
||
| // HostAffinityDedicatedHost requires specifying a particular host via dedicatedHost.host.hostID. | ||
| HostAffinityDedicatedHost HostAffinity = "DedicatedHost" | ||
| ) | ||
|
|
||
| // AllocationStrategy selects how a dedicated host is provided to the system for assigning to the instance. | ||
| // +kubebuilder:validation:Enum:=UserProvided;Dynamic | ||
| // +enum | ||
| type AllocationStrategy string | ||
|
|
||
| const ( | ||
| // AllocationStrategyUserProvided specifies that the system should assign instances to a user-provided dedicated host. | ||
| AllocationStrategyUserProvided AllocationStrategy = "UserProvided" | ||
|
|
||
| // AllocationStrategyDynamic specifies that the system should dynamically allocate a dedicated host for instances. | ||
| AllocationStrategyDynamic AllocationStrategy = "Dynamic" | ||
| ) | ||
|
|
||
| // DedicatedHost represents the configuration for the usage of dedicated host. | ||
| // +kubebuilder:validation:XValidation:rule="self.allocationStrategy == 'UserProvided' ? has(self.id) : true",message="id is required when allocationStrategy is UserProvided" | ||
| // +kubebuilder:validation:XValidation:rule="has(self.id) ? self.allocationStrategy == 'UserProvided' : true",message="id is only allowed when allocationStrategy is UserProvided" | ||
| // +kubebuilder:validation:XValidation:rule="has(self.dynamicHostAllocation) ? self.allocationStrategy == 'Dynamic' : true",message="dynamicHostAllocation is only allowed when allocationStrategy is Dynamic" | ||
| // +union | ||
| type DedicatedHost struct { | ||
| // allocationStrategy specifies if the dedicated host will be provided by the admin through the id field or if the host will be dynamically allocated. | ||
| // Valid values are UserProvided and Dynamic. | ||
| // This field is optional and defaults to "UserProvided". | ||
| // When AllocationStrategy is set to UserProvided, an ID of the dedicated host to assign must be provided. | ||
| // When AllocationStrategy is set to Dynamic, a dedicated host will be allocated and used to assign instances. | ||
| // When AllocationStrategy is set to Dynamic, and DynamicHostAllocation is configured, a dedicated host will be allocated and the tags in DynamicHostAllocation will be assigned to that host. | ||
| // +optional | ||
| // +unionDiscriminator | ||
| // +default="UserProvided" | ||
| AllocationStrategy *AllocationStrategy `json:"allocationStrategy,omitempty"` | ||
|
|
||
| // id identifies the AWS Dedicated Host on which the instance must run. | ||
| // The value must start with "h-" followed by either 8 or 17 lowercase hexadecimal characters (0-9 and a-f). | ||
| // The use of 8 lowercase hexadecimal characters is for older legacy hosts that may not have been migrated to newer format. | ||
| // Must be either 10 or 19 characters in length. | ||
| // This field is required when allocationStrategy is UserProvided, and forbidden when allocationStrategy is Dynamic. | ||
| // When omitted, allocationStrategy must be set to Dynamic to enable automatic host allocation. | ||
| // +kubebuilder:validation:XValidation:rule="self.matches('^h-([0-9a-f]{8}|[0-9a-f]{17})$')",message="hostID must start with 'h-' followed by either 8 or 17 lowercase hexadecimal characters (0-9 and a-f)" | ||
| // +kubebuilder:validation:MinLength=10 | ||
| // +kubebuilder:validation:MaxLength=19 | ||
| // +required | ||
| // +optional | ||
vr4manta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // +unionMember=UserProvided | ||
| ID string `json:"id,omitempty"` | ||
|
Member
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.
4.21 will ship: type DedicatedHost struct {
// +required
ID string `json:"id,omitempty"`
}4.22 will ship: type DedicatedHost struct {
// +required
AllocationStrategy AllocationStrategy `json:"allocationStrategy,omitempty"`
// +optional (changed from +required)
ID string `json:"id,omitempty"`
// +optional (new field)
DynamicHostAllocation *DynamicHostAllocationSpec `json:"dynamicHostAllocation,omitempty"`
}Means that a valid 4.21 manifest will be invalid in 4.22. dedicatedHost:
id: "h-1234567890abcdef0"Do we have a webhook or similar solution in the works for this?
Contributor
Author
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. Yes there is webhook changes, that PR is almost ready. For backwards compatability, if its "" (emptry string) it is defaulting to UserProvided.
Contributor
Author
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. For this, I can change the field to be optional but have it default to UserProvided. Just let me know what you prefer.
Member
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 the current implementation addresses the raised concerns. |
||
|
|
||
| // dynamicHostAllocation specifies tags to apply to a dynamically allocated dedicated host. | ||
| // This field is only allowed when allocationStrategy is Dynamic, and is mutually exclusive with id. | ||
| // When specified, a dedicated host will be allocated with the provided tags applied. | ||
| // When omitted (and allocationStrategy is Dynamic), a dedicated host will be allocated without any additional tags. | ||
| // +optional | ||
| // +unionMember=Dynamic | ||
| DynamicHostAllocation *DynamicHostAllocationSpec `json:"dynamicHostAllocation,omitempty"` | ||
| } | ||
|
|
||
| // DynamicHostAllocationSpec defines the configuration for dynamic dedicated host allocation. | ||
| // This specification always allocates exactly one dedicated host per machine. | ||
| // +kubebuilder:validation:MinProperties=1 | ||
| type DynamicHostAllocationSpec struct { | ||
| // tags specifies a set of key-value pairs to apply to the allocated dedicated host. | ||
| // When omitted, no additional user-defined tags will be applied to the allocated host. | ||
| // +kubebuilder:validation:MinProperties=1 | ||
| // +optional | ||
| Tags map[string]string `json:"tags,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.
Uh oh!
There was an error while loading. Please reload this page.