From ee614f58e75f1d6ab137a0a803ae3c30cfa63c73 Mon Sep 17 00:00:00 2001 From: Richard Vanderpool <49568690+rvanderp3@users.noreply.github.com> Date: Wed, 23 Apr 2025 21:00:58 +0000 Subject: [PATCH] SPLAT-2169: WIP: implement fields for DedicatedHostTenancy to align with upstream --- machine/v1beta1/types_awsprovider.go | 23 ++++++++++- machine/v1beta1/zz_generated.deepcopy.go | 33 +++++++++++++++- .../zz_generated.swagger_doc_generated.go | 19 ++++++++-- .../generated_openapi/zz_generated.openapi.go | 38 ++++++++++++++++++- openapi/openapi.json | 20 +++++++++- 5 files changed, 125 insertions(+), 8 deletions(-) diff --git a/machine/v1beta1/types_awsprovider.go b/machine/v1beta1/types_awsprovider.go index d69bcd02337..eec5a8b7c10 100644 --- a/machine/v1beta1/types_awsprovider.go +++ b/machine/v1beta1/types_awsprovider.go @@ -241,11 +241,32 @@ type Placement struct { // +optional AvailabilityZone string `json:"availabilityZone,omitempty"` // tenancy indicates if instance should run on shared or single-tenant hardware. There are - // supported 3 options: default, dedicated and host. + // supported 3 options: default, dedicated, and host. // +optional Tenancy InstanceTenancy `json:"tenancy,omitempty"` + + // dedicatedHostTenancy when tenancy is set to 'host', this defines the host ID and host affinty to apply + // to associated machines. + // +openshift:enable:FeatureGate=AWSDedicatedHosts + // +optional + DedicatedHostTenancy *DedicatedHostTenancy `json:"dedicatedHostTenancy,omitempty"` +} + +// DedicatedHostTenancy describes the host tenancy configuration. This is used in scenarios where +// hosts are to be deployed to specific dedicated hosts. +type DedicatedHostTenancy struct { + // HostID specifies the Dedicated Host on which the instance should be launched. + // +optional + HostID *string `json:"hostId,omitempty"` + + // Affinity specifies the dedicated host affinity setting for the instance. + // When affinity is set to Host, an instance launched onto a specific host always restarts on the same host if stopped. + // +optional + // +kubebuilder:validation:Enum:=Defailt;Host + HostAffinity *string `json:"hostAffinity,omitempty"` } + // Filter is a filter used to identify an AWS resource type Filter struct { // name of the filter. Filter names are case-sensitive. diff --git a/machine/v1beta1/zz_generated.deepcopy.go b/machine/v1beta1/zz_generated.deepcopy.go index ef8f1a55fe8..0904a02b2fa 100644 --- a/machine/v1beta1/zz_generated.deepcopy.go +++ b/machine/v1beta1/zz_generated.deepcopy.go @@ -56,7 +56,7 @@ func (in *AWSMachineProviderConfig) DeepCopyInto(out *AWSMachineProviderConfig) } } in.Subnet.DeepCopyInto(&out.Subnet) - out.Placement = in.Placement + in.Placement.DeepCopyInto(&out.Placement) if in.LoadBalancers != nil { in, out := &in.LoadBalancers, &out.LoadBalancers *out = make([]LoadBalancerReference, len(*in)) @@ -483,6 +483,32 @@ func (in *DataDiskManagedDiskParameters) DeepCopy() *DataDiskManagedDiskParamete return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DedicatedHostTenancy) DeepCopyInto(out *DedicatedHostTenancy) { + *out = *in + if in.HostID != nil { + in, out := &in.HostID, &out.HostID + *out = new(string) + **out = **in + } + if in.HostAffinity != nil { + in, out := &in.HostAffinity, &out.HostAffinity + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DedicatedHostTenancy. +func (in *DedicatedHostTenancy) DeepCopy() *DedicatedHostTenancy { + if in == nil { + return nil + } + out := new(DedicatedHostTenancy) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DiskEncryptionSetParameters) DeepCopyInto(out *DiskEncryptionSetParameters) { *out = *in @@ -1551,6 +1577,11 @@ func (in *ObjectMeta) DeepCopy() *ObjectMeta { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Placement) DeepCopyInto(out *Placement) { *out = *in + if in.DedicatedHostTenancy != nil { + in, out := &in.DedicatedHostTenancy, &out.DedicatedHostTenancy + *out = new(DedicatedHostTenancy) + (*in).DeepCopyInto(*out) + } return } diff --git a/machine/v1beta1/zz_generated.swagger_doc_generated.go b/machine/v1beta1/zz_generated.swagger_doc_generated.go index b2e55376fee..b21bbed76b3 100644 --- a/machine/v1beta1/zz_generated.swagger_doc_generated.go +++ b/machine/v1beta1/zz_generated.swagger_doc_generated.go @@ -82,6 +82,16 @@ func (BlockDeviceMappingSpec) SwaggerDoc() map[string]string { return map_BlockDeviceMappingSpec } +var map_DedicatedHostTenancy = map[string]string{ + "": "DedicatedHostTenancy describes the host tenancy configuration. This is used in scenarios where hosts are to be deployed to specific dedicated hosts.", + "hostId": "HostID specifies the Dedicated Host on which the instance should be launched.", + "hostAffinity": "Affinity specifies the dedicated host affinity setting for the instance. When affinity is set to Host, an instance launched onto a specific host always restarts on the same host if stopped.", +} + +func (DedicatedHostTenancy) SwaggerDoc() map[string]string { + return map_DedicatedHostTenancy +} + var map_EBSBlockDeviceSpec = map[string]string{ "": "EBSBlockDeviceSpec describes a block device for an EBS volume. https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EbsBlockDevice", "deleteOnTermination": "Indicates whether the EBS volume is deleted on machine termination.", @@ -124,10 +134,11 @@ func (MetadataServiceOptions) SwaggerDoc() map[string]string { } var map_Placement = map[string]string{ - "": "Placement indicates where to create the instance in AWS", - "region": "region is the region to use to create the instance", - "availabilityZone": "availabilityZone is the availability zone of the instance", - "tenancy": "tenancy indicates if instance should run on shared or single-tenant hardware. There are supported 3 options: default, dedicated and host.", + "": "Placement indicates where to create the instance in AWS", + "region": "region is the region to use to create the instance", + "availabilityZone": "availabilityZone is the availability zone of the instance", + "tenancy": "tenancy indicates if instance should run on shared or single-tenant hardware. There are supported 3 options: default, dedicated, and host.", + "dedicatedHostTenancy": "dedicatedHostTenancy when tenancy is set to 'host', this defines the host ID and host affinty to apply to associated machines.", } func (Placement) SwaggerDoc() map[string]string { diff --git a/openapi/generated_openapi/zz_generated.openapi.go b/openapi/generated_openapi/zz_generated.openapi.go index c7e2a20809b..3c427a38d3e 100644 --- a/openapi/generated_openapi/zz_generated.openapi.go +++ b/openapi/generated_openapi/zz_generated.openapi.go @@ -732,6 +732,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/openshift/api/machine/v1beta1.ConfidentialVM": schema_openshift_api_machine_v1beta1_ConfidentialVM(ref), "github.com/openshift/api/machine/v1beta1.DataDisk": schema_openshift_api_machine_v1beta1_DataDisk(ref), "github.com/openshift/api/machine/v1beta1.DataDiskManagedDiskParameters": schema_openshift_api_machine_v1beta1_DataDiskManagedDiskParameters(ref), + "github.com/openshift/api/machine/v1beta1.DedicatedHostTenancy": schema_openshift_api_machine_v1beta1_DedicatedHostTenancy(ref), "github.com/openshift/api/machine/v1beta1.DiskEncryptionSetParameters": schema_openshift_api_machine_v1beta1_DiskEncryptionSetParameters(ref), "github.com/openshift/api/machine/v1beta1.DiskSettings": schema_openshift_api_machine_v1beta1_DiskSettings(ref), "github.com/openshift/api/machine/v1beta1.EBSBlockDeviceSpec": schema_openshift_api_machine_v1beta1_EBSBlockDeviceSpec(ref), @@ -37498,6 +37499,33 @@ func schema_openshift_api_machine_v1beta1_DataDiskManagedDiskParameters(ref comm } } +func schema_openshift_api_machine_v1beta1_DedicatedHostTenancy(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DedicatedHostTenancy describes the host tenancy configuration. This is used in scenarios where hosts are to be deployed to specific dedicated hosts.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "hostId": { + SchemaProps: spec.SchemaProps{ + Description: "HostID specifies the Dedicated Host on which the instance should be launched.", + Type: []string{"string"}, + Format: "", + }, + }, + "hostAffinity": { + SchemaProps: spec.SchemaProps{ + Description: "Affinity specifies the dedicated host affinity setting for the instance. When affinity is set to Host, an instance launched onto a specific host always restarts on the same host if stopped.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_openshift_api_machine_v1beta1_DiskEncryptionSetParameters(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -39623,14 +39651,22 @@ func schema_openshift_api_machine_v1beta1_Placement(ref common.ReferenceCallback }, "tenancy": { SchemaProps: spec.SchemaProps{ - Description: "tenancy indicates if instance should run on shared or single-tenant hardware. There are supported 3 options: default, dedicated and host.", + Description: "tenancy indicates if instance should run on shared or single-tenant hardware. There are supported 3 options: default, dedicated, and host.", Type: []string{"string"}, Format: "", }, }, + "dedicatedHostTenancy": { + SchemaProps: spec.SchemaProps{ + Description: "dedicatedHostTenancy when tenancy is set to 'host', this defines the host ID and host affinty to apply to associated machines.", + Ref: ref("github.com/openshift/api/machine/v1beta1.DedicatedHostTenancy"), + }, + }, }, }, }, + Dependencies: []string{ + "github.com/openshift/api/machine/v1beta1.DedicatedHostTenancy"}, } } diff --git a/openapi/openapi.json b/openapi/openapi.json index 6369a9bc821..6b2bd245e9d 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -21640,6 +21640,20 @@ } } }, + "com.github.openshift.api.machine.v1beta1.DedicatedHostTenancy": { + "description": "DedicatedHostTenancy describes the host tenancy configuration. This is used in scenarios where hosts are to be deployed to specific dedicated hosts.", + "type": "object", + "properties": { + "hostAffinity": { + "description": "Affinity specifies the dedicated host affinity setting for the instance. When affinity is set to Host, an instance launched onto a specific host always restarts on the same host if stopped.", + "type": "string" + }, + "hostId": { + "description": "HostID specifies the Dedicated Host on which the instance should be launched.", + "type": "string" + } + } + }, "com.github.openshift.api.machine.v1beta1.DiskEncryptionSetParameters": { "description": "DiskEncryptionSetParameters is the disk encryption set properties", "type": "object", @@ -22884,12 +22898,16 @@ "description": "availabilityZone is the availability zone of the instance", "type": "string" }, + "dedicatedHostTenancy": { + "description": "dedicatedHostTenancy when tenancy is set to 'host', this defines the host ID and host affinty to apply to associated machines.", + "$ref": "#/definitions/com.github.openshift.api.machine.v1beta1.DedicatedHostTenancy" + }, "region": { "description": "region is the region to use to create the instance", "type": "string" }, "tenancy": { - "description": "tenancy indicates if instance should run on shared or single-tenant hardware. There are supported 3 options: default, dedicated and host.", + "description": "tenancy indicates if instance should run on shared or single-tenant hardware. There are supported 3 options: default, dedicated, and host.", "type": "string" } }