diff --git a/machine/v1beta1/types_gcpprovider.go b/machine/v1beta1/types_gcpprovider.go index 9713a4e4a87..4bb87190a0f 100644 --- a/machine/v1beta1/types_gcpprovider.go +++ b/machine/v1beta1/types_gcpprovider.go @@ -79,6 +79,31 @@ const ( ConfidentialComputePolicyTDX ConfidentialComputePolicy = "IntelTrustedDomainExtensions" ) +// GCPReservationAffinity describes the reservation affinity of the instance on GCP. +type GCPReservationAffinity struct { + // consumeReservationType indicates whether the instance should consume from any reservation or a specific reservation. + // Valid values are "NO_RESERVATION", "ANY_RESERVATION" and "SPECIFIC_RESERVATION". + // +required + // +kubebuilder:validation:Enum=NO_RESERVATION;ANY_RESERVATION;SPECIFIC_RESERVATION + ConsumeReservationType string `json:"consumeReservationType,omitempty"` + // key is the reservation key of the specific reservation to consume from. + // The maximum length is 63 characters, and the name must conform to RFC1035. + // Required if consumeReservationType is set to "SPECIFIC_RESERVATION". + // When consumeReservationType is not "SPECIFIC_RESERVATION", this field must be empty. + // +optional + // +kubebuilder:validation:MaxLength=63 + Key *string `json:"key,omitempty"` + // values is the list of reservation values of the specific reservation to consume from. + // Each value can have a maximum length of 63 characters, and the name must conform to RFC1035. + // Required if consumeReservationType is set to "SPECIFIC_RESERVATION". + // When consumeReservationType is not "SPECIFIC_RESERVATION", this field must be empty. + // +optional + // +listType=set + // +kubebuilder:validation:items:MaxLength=63 + // +kubebuilder:validation:MaxItems=50 + Values []string `json:"values,omitempty"` +} + // GCPMachineProviderSpec is the type that will be embedded in a Machine.Spec.ProviderSpec field // for an GCP virtual machine. It is used by the GCP machine actuator to create a single Machine. // Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer). @@ -191,6 +216,10 @@ type GCPMachineProviderSpec struct { // +listMapKey=key // +optional ResourceManagerTags []ResourceManagerTag `json:"resourceManagerTags,omitempty"` + + // reservationAffinity indicates the reservation for the VM. + // +optional + ReservationAffinity *GCPReservationAffinity `json:"reservationAffinity,omitempty"` } // ResourceManagerTag is a tag to apply to GCP resources created for the cluster. diff --git a/machine/v1beta1/zz_generated.deepcopy.go b/machine/v1beta1/zz_generated.deepcopy.go index d08906c7d87..a34ec8d3253 100644 --- a/machine/v1beta1/zz_generated.deepcopy.go +++ b/machine/v1beta1/zz_generated.deepcopy.go @@ -794,6 +794,11 @@ func (in *GCPMachineProviderSpec) DeepCopyInto(out *GCPMachineProviderSpec) { *out = make([]ResourceManagerTag, len(*in)) copy(*out, *in) } + if in.ReservationAffinity != nil { + in, out := &in.ReservationAffinity, &out.ReservationAffinity + *out = new(GCPReservationAffinity) + (*in).DeepCopyInto(*out) + } return } @@ -887,6 +892,32 @@ func (in *GCPNetworkInterface) DeepCopy() *GCPNetworkInterface { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPReservationAffinity) DeepCopyInto(out *GCPReservationAffinity) { + *out = *in + if in.Key != nil { + in, out := &in.Key, &out.Key + *out = new(string) + **out = **in + } + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPReservationAffinity. +func (in *GCPReservationAffinity) DeepCopy() *GCPReservationAffinity { + if in == nil { + return nil + } + out := new(GCPReservationAffinity) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GCPServiceAccount) DeepCopyInto(out *GCPServiceAccount) { *out = *in diff --git a/machine/v1beta1/zz_generated.swagger_doc_generated.go b/machine/v1beta1/zz_generated.swagger_doc_generated.go index 903faf94bad..bd79702f40f 100644 --- a/machine/v1beta1/zz_generated.swagger_doc_generated.go +++ b/machine/v1beta1/zz_generated.swagger_doc_generated.go @@ -479,6 +479,7 @@ var map_GCPMachineProviderSpec = map[string]string{ "shieldedInstanceConfig": "shieldedInstanceConfig is the Shielded VM configuration for the VM", "confidentialCompute": "confidentialCompute is an optional field defining whether the instance should have confidential compute enabled or not, and the confidential computing technology of choice. Allowed values are omitted, Disabled, Enabled, AMDEncryptedVirtualization, AMDEncryptedVirtualizationNestedPaging, and IntelTrustedDomainExtensions When set to Disabled, the machine will not be configured to be a confidential computing instance. When set to Enabled, the machine will be configured as a confidential computing instance with no preference on the confidential compute policy used. In this mode, the platform chooses a default that is subject to change over time. Currently, the default is to use AMD Secure Encrypted Virtualization. When set to AMDEncryptedVirtualization, the machine will be configured as a confidential computing instance with AMD Secure Encrypted Virtualization (AMD SEV) as the confidential computing technology. When set to AMDEncryptedVirtualizationNestedPaging, the machine will be configured as a confidential computing instance with AMD Secure Encrypted Virtualization Secure Nested Paging (AMD SEV-SNP) as the confidential computing technology. When set to IntelTrustedDomainExtensions, the machine will be configured as a confidential computing instance with Intel Trusted Domain Extensions (Intel TDX) as the confidential computing technology. If any value other than Disabled is set the selected machine type must support that specific confidential computing technology. The machine series supporting confidential computing technologies can be checked at https://cloud.google.com/confidential-computing/confidential-vm/docs/supported-configurations#all-confidential-vm-instances Currently, AMDEncryptedVirtualization is supported in c2d, n2d, and c3d machines. AMDEncryptedVirtualizationNestedPaging is supported in n2d machines. IntelTrustedDomainExtensions is supported in c3 machines. If any value other than Disabled is set, the selected region must support that specific confidential computing technology. The list of regions supporting confidential computing technologies can be checked at https://cloud.google.com/confidential-computing/confidential-vm/docs/supported-configurations#supported-zones If any value other than Disabled is set onHostMaintenance is required to be set to \"Terminate\". If omitted, the platform chooses a default, which is subject to change over time, currently that default is Disabled.", "resourceManagerTags": "resourceManagerTags is an optional list of tags to apply to the GCP resources created for the cluster. See https://cloud.google.com/resource-manager/docs/tags/tags-overview for information on tagging GCP resources. GCP supports a maximum of 50 tags per resource.", + "reservationAffinity": "reservationAffinity indicates the reservation for the VM.", } func (GCPMachineProviderSpec) SwaggerDoc() map[string]string { @@ -518,6 +519,17 @@ func (GCPNetworkInterface) SwaggerDoc() map[string]string { return map_GCPNetworkInterface } +var map_GCPReservationAffinity = map[string]string{ + "": "GCPReservationAffinity describes the reservation affinity of the instance on GCP.", + "consumeReservationType": "consumeReservationType indicates whether the instance should consume from any reservation or a specific reservation. Valid values are \"NO_RESERVATION\", \"ANY_RESERVATION\" and \"SPECIFIC_RESERVATION\".", + "key": "key is the reservation key of the specific reservation to consume from. The maximum length is 63 characters, and the name must conform to RFC1035. Required if consumeReservationType is set to \"SPECIFIC_RESERVATION\". When consumeReservationType is not \"SPECIFIC_RESERVATION\", this field must be empty.", + "values": "values is the list of reservation values of the specific reservation to consume from. Each value can have a maximum length of 63 characters, and the name must conform to RFC1035. Required if consumeReservationType is set to \"SPECIFIC_RESERVATION\". When consumeReservationType is not \"SPECIFIC_RESERVATION\", this field must be empty.", +} + +func (GCPReservationAffinity) SwaggerDoc() map[string]string { + return map_GCPReservationAffinity +} + var map_GCPServiceAccount = map[string]string{ "": "GCPServiceAccount describes service accounts for GCP.", "email": "email is the service account email.", diff --git a/openapi/generated_openapi/zz_generated.openapi.go b/openapi/generated_openapi/zz_generated.openapi.go index f4ffe06c80f..cce2adb73d3 100644 --- a/openapi/generated_openapi/zz_generated.openapi.go +++ b/openapi/generated_openapi/zz_generated.openapi.go @@ -783,6 +783,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/openshift/api/machine/v1beta1.GCPMachineProviderStatus": schema_openshift_api_machine_v1beta1_GCPMachineProviderStatus(ref), "github.com/openshift/api/machine/v1beta1.GCPMetadata": schema_openshift_api_machine_v1beta1_GCPMetadata(ref), "github.com/openshift/api/machine/v1beta1.GCPNetworkInterface": schema_openshift_api_machine_v1beta1_GCPNetworkInterface(ref), + "github.com/openshift/api/machine/v1beta1.GCPReservationAffinity": schema_openshift_api_machine_v1beta1_GCPReservationAffinity(ref), "github.com/openshift/api/machine/v1beta1.GCPServiceAccount": schema_openshift_api_machine_v1beta1_GCPServiceAccount(ref), "github.com/openshift/api/machine/v1beta1.GCPShieldedInstanceConfig": schema_openshift_api_machine_v1beta1_GCPShieldedInstanceConfig(ref), "github.com/openshift/api/machine/v1beta1.HostPlacement": schema_openshift_api_machine_v1beta1_HostPlacement(ref), @@ -40035,12 +40036,18 @@ func schema_openshift_api_machine_v1beta1_GCPMachineProviderSpec(ref common.Refe }, }, }, + "reservationAffinity": { + SchemaProps: spec.SchemaProps{ + Description: "reservationAffinity indicates the reservation for the VM.", + Ref: ref("github.com/openshift/api/machine/v1beta1.GCPReservationAffinity"), + }, + }, }, Required: []string{"canIPForward", "deletionProtection", "serviceAccounts", "machineType", "region", "zone"}, }, }, Dependencies: []string{ - "github.com/openshift/api/machine/v1beta1.GCPDisk", "github.com/openshift/api/machine/v1beta1.GCPGPUConfig", "github.com/openshift/api/machine/v1beta1.GCPMetadata", "github.com/openshift/api/machine/v1beta1.GCPNetworkInterface", "github.com/openshift/api/machine/v1beta1.GCPServiceAccount", "github.com/openshift/api/machine/v1beta1.GCPShieldedInstanceConfig", "github.com/openshift/api/machine/v1beta1.ResourceManagerTag", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + "github.com/openshift/api/machine/v1beta1.GCPDisk", "github.com/openshift/api/machine/v1beta1.GCPGPUConfig", "github.com/openshift/api/machine/v1beta1.GCPMetadata", "github.com/openshift/api/machine/v1beta1.GCPNetworkInterface", "github.com/openshift/api/machine/v1beta1.GCPReservationAffinity", "github.com/openshift/api/machine/v1beta1.GCPServiceAccount", "github.com/openshift/api/machine/v1beta1.GCPShieldedInstanceConfig", "github.com/openshift/api/machine/v1beta1.ResourceManagerTag", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, } } @@ -40185,6 +40192,54 @@ func schema_openshift_api_machine_v1beta1_GCPNetworkInterface(ref common.Referen } } +func schema_openshift_api_machine_v1beta1_GCPReservationAffinity(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GCPReservationAffinity describes the reservation affinity of the instance on GCP.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "consumeReservationType": { + SchemaProps: spec.SchemaProps{ + Description: "consumeReservationType indicates whether the instance should consume from any reservation or a specific reservation. Valid values are \"NO_RESERVATION\", \"ANY_RESERVATION\" and \"SPECIFIC_RESERVATION\".", + Type: []string{"string"}, + Format: "", + }, + }, + "key": { + SchemaProps: spec.SchemaProps{ + Description: "key is the reservation key of the specific reservation to consume from. The maximum length is 63 characters, and the name must conform to RFC1035. Required if consumeReservationType is set to \"SPECIFIC_RESERVATION\". When consumeReservationType is not \"SPECIFIC_RESERVATION\", this field must be empty.", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "set", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "values is the list of reservation values of the specific reservation to consume from. Each value can have a maximum length of 63 characters, and the name must conform to RFC1035. Required if consumeReservationType is set to \"SPECIFIC_RESERVATION\". When consumeReservationType is not \"SPECIFIC_RESERVATION\", this field must be empty.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"consumeReservationType"}, + }, + }, + } +} + func schema_openshift_api_machine_v1beta1_GCPServiceAccount(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{