-
Notifications
You must be signed in to change notification settings - Fork 570
[WIP] 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 | ||||
---|---|---|---|---|---|---|
|
@@ -107,6 +107,28 @@ type AWSMachineProviderConfig struct { | |||||
// If this value is selected, capacityReservationID must be specified to identify the target reservation. | ||||||
// +optional | ||||||
MarketType MarketType `json:"marketType,omitempty"` | ||||||
|
||||||
// hostID specifies the Dedicated Host on which the instance must be started. | ||||||
// This field is mutually exclusive with DynamicHostAllocation. | ||||||
// When set, the value must be a valid AWS Dedicated Host ID in the form | ||||||
// "h-" followed by 17 lowercase hexadecimal characters. | ||||||
// The maximum length is 19 characters, and the field may be omitted. | ||||||
// +kubebuilder:validation:XValidation:rule="self == null || self.matches('^h-[0-9a-f]{17}$')",message="hostID must start with 'h-' and end in 17 alphanumeric characters" | ||||||
// +kubebuilder:validation:MaxLength=19 | ||||||
// +openshift:enable:FeatureGate=AWSDedicatedHosts | ||||||
// +optional | ||||||
HostID *string `json:"hostID,omitempty"` | ||||||
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. We should probably add a min length here as well so that an empty string ( 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 can add that. Thanks! |
||||||
|
||||||
// hostAffinity specifies the dedicated host affinity setting for the instance. | ||||||
// Valid values are "AnyAvailable", "Host", and omitted. | ||||||
// 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 omitted and HostID is defined, the instance is started onto the specified host. | ||||||
// When HostAffinity is defined, HostID is required. | ||||||
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. Whether it is set to Also, when referring to a field use the serialized form of the field name as that is what end-users would be familiar with:
Suggested change
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, if 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. To clarify, 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. Correct. I'll make sure this godoc states this. I have the webhook logic doing this already. |
||||||
// +kubebuilder:validation:MaxLength=64 | ||||||
// +openshift:enable:FeatureGate=AWSDedicatedHosts | ||||||
// +optional | ||||||
HostAffinity *HostAffinity `json:"hostAffinity,omitempty"` | ||||||
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. What happens if I don't supply this value? 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. It will default to 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. So are the options here actually omitted (i.e don't set 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. So I am discussing this with @rvanderp3 , "Default" we are gonna change to "AnyAvailable". I believe with the AWS API, the idea is this field dictates whether hostID is looked at or not. We are gonna confirm this and see what the behavior should be to clear up any confusions. |
||||||
} | ||||||
|
||||||
// BlockDeviceMappingSpec describes a block device mapping | ||||||
|
@@ -355,3 +377,16 @@ const ( | |||||
// When set to CapacityBlock the instance utilizes pre-purchased compute capacity (capacity blocks) with AWS Capacity Reservations. | ||||||
MarketTypeCapacityBlock MarketType = "CapacityBlock" | ||||||
) | ||||||
|
||||||
// HostAffinity describes the host affinity of an EC2 Instance | ||||||
type HostAffinity string | ||||||
|
||||||
const ( | ||||||
// HostAffinityAnyAvailable is a HostAffinity enum value | ||||||
// When set to AnyAvailable the instance is put on a host using the AWS default logic. | ||||||
HostAffinityAnyAvailable HostAffinity = "AnyAvailable" | ||||||
|
||||||
// HostAffinityHost is a HostAffinity enum value | ||||||
// When set to host the instance runs on the specified host. | ||||||
HostAffinityHost HostAffinity = "Host" | ||||||
) |
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.
What is the difference between setting this to
""
and omitting the field entirely?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.
There should be no difference. I would assume this field is not set if user not intending to place instances into a dedicated host.
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.
If there is no difference, this should not be a pointer and should have a minimum length of 1. This is probably what the linter is complaining about.
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.
Since this is validated by Go based webhooks, and not openapi, the linter is wrong on this one.
If we make this not a pointer, then the Go code has no way to know if this was deliberately set to
""
or not. We don't want""
to be valid, so this needs to be a pointer so that we can check that.In this case (and future cases like this in these providerspec APIs) we will want to make exceptions to the serialization rules on the linter.
We may want to even disable the serialization rules on these particular APIs somehow 🤔
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.
Ah, I went into standard API review mode here and forgot this API is webhook validation 🤦
Thanks for catching that!
Can we do this via codegen configurations?
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.
No, but we should be able to disable using the
.golangci-lint.yaml
config, ideally we could have a different config for the APIs that act like this, these MAPI ones aren't the only ones (e.g. the aggregated APIs we support too)