Skip to content

Commit 9be6a09

Browse files
committed
Added AWS dedicated host support
1 parent 02f6733 commit 9be6a09

File tree

5 files changed

+81
-93
lines changed

5 files changed

+81
-93
lines changed

machine/v1beta1/types_awsprovider.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,14 @@ type AWSMachineProviderConfig struct {
115115
// +optional
116116
MarketType MarketType `json:"marketType,omitempty"`
117117

118+
// Tombstone: This field was moved into the Placement struct to belong w/ the Tenancy field due to involvement with the setting.
118119
// hostPlacement configures placement on AWS Dedicated Hosts. This allows admins to assign instances to specific host
119120
// for a variety of needs including for regulatory compliance, to leverage existing per-socket or per-core software licenses (BYOL),
120121
// and to gain visibility and control over instance placement on a physical server.
121122
// When omitted, the instance is not constrained to a dedicated host.
122123
// +openshift:enable:FeatureGate=AWSDedicatedHosts
123124
// +optional
124-
HostPlacement *HostPlacement `json:"hostPlacement,omitempty"`
125+
//HostPlacement *HostPlacement `json:"hostPlacement,omitempty"`
125126
}
126127

127128
// AWSConfidentialComputePolicy represents the confidential compute configuration for the instance.
@@ -294,6 +295,7 @@ type AWSResourceReference struct {
294295
}
295296

296297
// Placement indicates where to create the instance in AWS
298+
// +kubebuilder:validation:XValidation:rule="has(self.tenancy) && self.tenancy == 'host' ? true : !has(self.host)",message="host may only be specified when tenancy is host"
297299
type Placement struct {
298300
// region is the region to use to create the instance
299301
// +optional
@@ -303,8 +305,19 @@ type Placement struct {
303305
AvailabilityZone string `json:"availabilityZone,omitempty"`
304306
// tenancy indicates if instance should run on shared or single-tenant hardware. There are
305307
// supported 3 options: default, dedicated and host.
308+
// When set to default Runs on shared multi-tenant hardware.
309+
// When dedicated Runs on single-tenant hardware (any dedicated instance hardware).
310+
// When host and the host object is not provided: Runs on Dedicated Host; best-effort restart on same host.
311+
// When `host` and `host` object is provided with affinity `dedicatedHost` defined: Runs on specified Dedicated Host.
306312
// +optional
307313
Tenancy InstanceTenancy `json:"tenancy,omitempty"`
314+
// host configures placement on AWS Dedicated Hosts. This allows admins to assign instances to specific host
315+
// for a variety of needs including for regulatory compliance, to leverage existing per-socket or per-core software licenses (BYOL),
316+
// and to gain visibility and control over instance placement on a physical server.
317+
// When omitted, the instance is not constrained to a dedicated host.
318+
// +openshift:enable:FeatureGate=AWSDedicatedHosts
319+
// +optional
320+
Host *HostPlacement `json:"host,omitempty"`
308321
}
309322

310323
// Filter is a filter used to identify an AWS resource
@@ -416,19 +429,20 @@ const (
416429
)
417430

418431
// HostPlacement is the type that will be used to configure the placement of AWS instances.
419-
// +kubebuilder:validation:XValidation:rule="has(self.type) && self.affinity == 'DedicatedHost' ? has(self.dedicatedHost) : !has(self.dedicatedHost)",message="dedicatedHost is required when affinity is DedicatedHost, and forbidden otherwise"
432+
// +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"
420433
// +union
421434
type HostPlacement struct {
422435
// affinity specifies the affinity setting for the instance.
423436
// Allowed values are AnyAvailable and DedicatedHost.
424437
// 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.
425438
// When Affinity is set to AnyAvailable, and you stop and restart the instance, it can be restarted on any available host.
439+
// When Affinity is set to AnyAvailable and the `dedicatedHost` field is defined, it runs on specified Dedicated Host, but may move if stopped.
426440
// +required
427441
// +unionDiscriminator
428442
Affinity *HostAffinity `json:"affinity,omitempty"`
429443

430444
// dedicatedHost specifies the exact host that an instance should be restarted on if stopped.
431-
// dedicatedHost is required when 'affinity' is set to DedicatedHost, and forbidden otherwise.
445+
// dedicatedHost is required when 'affinity' is set to DedicatedHost, and optional otherwise.
432446
// +optional
433447
// +unionMember
434448
DedicatedHost *DedicatedHost `json:"dedicatedHost,omitempty"`

machine/v1beta1/zz_generated.deepcopy.go

Lines changed: 6 additions & 6 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: 4 additions & 4 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: 12 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)