Skip to content

Commit a2b45cb

Browse files
committed
Added AWS dedicated host support
1 parent fe48e8f commit a2b45cb

File tree

6 files changed

+228
-3
lines changed

6 files changed

+228
-3
lines changed

features/features.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,8 +752,8 @@ var (
752752
mustRegister()
753753

754754
FeatureGateAWSDedicatedHosts = newFeatureGate("AWSDedicatedHosts").
755-
reportProblemsToJiraComponent("Installer").
756-
contactPerson("faermanj").
755+
reportProblemsToJiraComponent("splat").
756+
contactPerson("rvanderp3").
757757
productScope(ocpSpecific).
758758
enhancementPR("https://github.com/openshift/enhancements/pull/1781").
759759
enableIn(configv1.DevPreviewNoUpgrade, configv1.TechPreviewNoUpgrade).

machine/v1beta1/types_awsprovider.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ type AWSMachineProviderConfig struct {
114114
// If this value is selected, capacityReservationID must be specified to identify the target reservation.
115115
// +optional
116116
MarketType MarketType `json:"marketType,omitempty"`
117+
118+
// hostPlacement configures placement on AWS Dedicated Hosts. This allows admins to assign instances to specific host
119+
// for a variety of needs including for regulatory compliance, to leverage existing per-socket or per-core software licenses (BYOL),
120+
// and to gain visibility and control over instance placement on a physical server.
121+
// When omitted, the instance is not constrained to a dedicated host.
122+
// +openshift:enable:FeatureGate=AWSDedicatedHosts
123+
// +optional
124+
HostPlacement *HostPlacement `json:"hostPlacement,omitempty"`
117125
}
118126

119127
// AWSConfidentialComputePolicy represents the confidential compute configuration for the instance.
@@ -393,3 +401,46 @@ const (
393401
// When set to CapacityBlock the instance utilizes pre-purchased compute capacity (capacity blocks) with AWS Capacity Reservations.
394402
MarketTypeCapacityBlock MarketType = "CapacityBlock"
395403
)
404+
405+
// HostPlacement is the type that will be used to configure the placement of AWS instances.
406+
// +kubebuilder:validation:XValidation:rule="has(self.type) && self.affinity == 'DedicatedHost' ? has(self.dedicated) : !has(self.dedicated)",message="dedicated is required when affinity is DedicatedHost, and forbidden otherwise"
407+
// +union
408+
type HostPlacement struct {
409+
// affinity specifies the affinity setting for the instance.
410+
// Allowed values are AnyAvailable and DedicatedHost.
411+
// 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 `dedicated` field must be set.
412+
// When Affinity is set to AnyAvailable, and you stop and restart the instance, it can be restarted on any available host.
413+
// +required
414+
// +unionDiscriminator
415+
Affinity HostAffinity `json:"affinity,omitempty"`
416+
417+
// dedicatedHost specifies a particular dedicated host when required by affinity set to DedicatedHost.
418+
// dedicatedHost is required when 'affinity' is set to DedicatedHost, and forbidden otherwise.
419+
// +optional
420+
// +unionMember
421+
DedicatedHost *DedicatedHost `json:"dedicatedHost,omitempty"`
422+
}
423+
424+
// HostAffinity selects how an instance should be placed on AWS Dedicated Hosts.
425+
// +kubebuilder:validation:Enum:=DedicatedHost;AnyAvailable
426+
type HostAffinity string
427+
428+
const (
429+
// HostAffinityAnyAvailable lets the platform select any available dedicated host.
430+
HostAffinityAnyAvailable HostAffinity = "AnyAvailable"
431+
432+
// HostAffinityDedicatedHost requires specifying a particular host via dedicatedHost.host.hostID.
433+
HostAffinityDedicatedHost HostAffinity = "DedicatedHost"
434+
)
435+
436+
// DedicatedHost represents the configuration for the usage of dedicated host.
437+
type DedicatedHost struct {
438+
// id identifies the AWS Dedicated Host on which the instance must run.
439+
// The value must start with "h-" followed by 17 lowercase hexadecimal characters (0-9 and a-f).
440+
// Must be exactly 19 characters in length.
441+
// +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)"
442+
// +kubebuilder:validation:MinLength=19
443+
// +kubebuilder:validation:MaxLength=19
444+
// +required
445+
ID string `json:"id,omitempty"`
446+
}

machine/v1beta1/zz_generated.deepcopy.go

Lines changed: 42 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: 20 additions & 0 deletions
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: 71 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)