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 @@ -753,8 +753,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
53 changes: 53 additions & 0 deletions machine/v1beta1/types_awsprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ type AWSMachineProviderConfig struct {
// If this value is selected, capacityReservationID must be specified to identify the target reservation.
// +optional
MarketType MarketType `json:"marketType,omitempty"`

// dedicatedHost configures placement on AWS Dedicated Hosts.
// When omitted, the instance is not constrained to a dedicated host.
// If hostAffinity is set to "Host", a host ID must be provided at dedicatedHost.host.hostID.
// If hostAffinity is set to "AnyAvailable", dedicatedHost.host must be omitted.
// If hostAffinity is omitted and host.hostID is set, the instance starts on that specific host.
// +openshift:enable:FeatureGate=AWSDedicatedHosts
// +optional
DedicatedHost *DedicatedHost `json:"dedicatedHost,omitempty"`
}

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

type DedicatedHost struct {
// hostAffinity specifies the dedicated host affinity setting for the instance.
// 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 defined, Host is required.
// The default value is AnyAvailable
// +kubebuilder:default=AnyAvailable
// +openshift:enable:FeatureGate=AWSDedicatedHosts
// +optional
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "discriminant" should be required so an end user has to make an explicit decision here - hostAffinity is the discriminant here. Because the parent field is already optional it is safe to make this field required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if affinity should be outside the dedicated host section. This way, we use the DedicatedHost field and have ID under it.

...
hostAffinity: Host
dedicatedHost:
    id: h-017afcd

HostAffinity HostAffinity `json:"hostAffinity,omitempty"`

// host specifies a particular dedicated host when required by hostAffinity or when
// hostAffinity is omitted and you want to target a specific host.
// Must be omitted when hostAffinity is "AnyAvailable".
Comment on lines +417 to +419
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want something more like:

host specifies the exact host that an instance should run on.
host is required when hostAffinity is set to Host, and forbidden otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll make the change.

// +openshift:enable:FeatureGate=AWSDedicatedHosts
// +optional
Host Host `json:"host,omitzero"`
}

// HostAffinity selects how an instance should be placed on AWS Dedicated Hosts.
// +kubebuilder:validation:Enum:=Host;AnyAvailable
type HostAffinity string

const (
// HostAffinityAnyAvailable lets the platform select any available dedicated host.
HostAffinityAnyAvailable HostAffinity = "AnyAvailable"

// HostAffinityHost requires specifying a particular host via dedicatedHost.host.hostID.
HostAffinityHost HostAffinity = "Host"
)

type Host 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).
// Minimum length is 19 characters.
// Maximum length is 19 characters.
// +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
// +openshift:enable:FeatureGate=AWSDedicatedHosts
// +required
HostID string `json:"id,omitempty"`
}
38 changes: 38 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.

18 changes: 18 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.

58 changes: 57 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.

30 changes: 30 additions & 0 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -22649,6 +22649,10 @@
"description": "credentialsSecret is a reference to the secret with AWS credentials. Otherwise, defaults to permissions provided by attached IAM role where the actuator is running.",
"$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference"
},
"dedicatedHost": {
"description": "dedicatedHost configures placement on AWS Dedicated Hosts. When omitted, the instance is not constrained to a dedicated host. If hostAffinity is set to \"Host\", a host ID must be provided at dedicatedHost.host.hostID. If hostAffinity is set to \"AnyAvailable\", dedicatedHost.host must be omitted. If hostAffinity is omitted and host.hostID is set, the instance starts on that specific host.",
"$ref": "#/definitions/com.github.openshift.api.machine.v1beta1.DedicatedHost"
},
"deviceIndex": {
"description": "deviceIndex is the index of the device on the instance for the network interface attachment. Defaults to 0.",
"type": "integer",
Expand Down Expand Up @@ -23242,6 +23246,20 @@
}
}
},
"com.github.openshift.api.machine.v1beta1.DedicatedHost": {
"type": "object",
"properties": {
"host": {
"description": "host specifies a particular dedicated host when required by hostAffinity or when hostAffinity is omitted and you want to target a specific host. Must be omitted when hostAffinity is \"AnyAvailable\".",
"default": {},
"$ref": "#/definitions/com.github.openshift.api.machine.v1beta1.Host"
},
"hostAffinity": {
"description": "hostAffinity specifies the dedicated host affinity setting for the instance. 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 defined, Host is required. The default value is AnyAvailable",
"type": "string"
}
}
},
"com.github.openshift.api.machine.v1beta1.DiskEncryptionSetParameters": {
"description": "DiskEncryptionSetParameters is the disk encryption set properties",
"type": "object",
Expand Down Expand Up @@ -23712,6 +23730,18 @@
}
}
},
"com.github.openshift.api.machine.v1beta1.Host": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"description": "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). Minimum length is 19 characters. Maximum length is 19 characters.",
"type": "string"
}
}
},
"com.github.openshift.api.machine.v1beta1.Image": {
"description": "Image is a mirror of azure sdk compute.ImageReference",
"type": "object",
Expand Down