Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,8 +752,8 @@ var (
mustRegister()

FeatureGateAWSDedicatedHosts = newFeatureGate("AWSDedicatedHosts").
reportProblemsToJiraComponent("Installer").
contactPerson("faermanj").
reportProblemsToJiraComponent("splat").
contactPerson("rvanderp3").
productScope(ocpSpecific).
enhancementPR("https://github.com/openshift/enhancements/pull/1781").
enableIn(configv1.DevPreviewNoUpgrade, configv1.TechPreviewNoUpgrade).
Expand Down
51 changes: 51 additions & 0 deletions machine/v1beta1/types_awsprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ type AWSMachineProviderConfig struct {
// If this value is selected, capacityReservationID must be specified to identify the target reservation.
// +optional
MarketType MarketType `json:"marketType,omitempty"`

// hostPlacement configures placement on AWS Dedicated Hosts. This allows admins to assign instances to specific host
// for a variety of needs including for regulatory compliance, to leverage existing per-socket or per-core software licenses (BYOL),
// and to gain visibility and control over instance placement on a physical server.
// When omitted, the instance is not constrained to a dedicated host.
// +openshift:enable:FeatureGate=AWSDedicatedHosts
// +optional
HostPlacement *HostPlacement `json:"hostPlacement,omitempty"`
}

// AWSConfidentialComputePolicy represents the confidential compute configuration for the instance.
Expand Down Expand Up @@ -393,3 +401,46 @@ const (
// When set to CapacityBlock the instance utilizes pre-purchased compute capacity (capacity blocks) with AWS Capacity Reservations.
MarketTypeCapacityBlock MarketType = "CapacityBlock"
)

// HostPlacement is the type that will be used to configure the placement of AWS instances.
// +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"
// +union
type HostPlacement struct {
// affinity specifies the affinity setting for the instance.
// Allowed values are AnyAvailable and DedicatedHost.
// 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.
// When Affinity is set to AnyAvailable, and you stop and restart the instance, it can be restarted on any available host.
// +required
// +unionDiscriminator
Affinity *HostAffinity `json:"affinity,omitempty"`

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

// HostAffinity selects how an instance should be placed on AWS Dedicated Hosts.
// +kubebuilder:validation:Enum:=DedicatedHost;AnyAvailable
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"
)

// DedicatedHost represents the configuration for the usage of dedicated host.
type DedicatedHost 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).
// Must be exactly 19 characters in length.
// +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
// +required
ID string `json:"id,omitempty"`
}
47 changes: 47 additions & 0 deletions machine/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions machine/v1beta1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 71 additions & 1 deletion openapi/generated_openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading