From cda5afb9d81c28943cb2af4a8f9e1447d4769506 Mon Sep 17 00:00:00 2001 From: Joel Speed Date: Tue, 23 Nov 2021 14:12:26 +0000 Subject: [PATCH 1/2] Add Network Interface Type to AWS Machine Provider Spec --- machine/v1beta1/types_awsprovider.go | 22 +++++++++++++ .../zz_generated.swagger_doc_generated.go | 33 ++++++++++--------- 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/machine/v1beta1/types_awsprovider.go b/machine/v1beta1/types_awsprovider.go index 1df85939de6..69ea3b7db01 100644 --- a/machine/v1beta1/types_awsprovider.go +++ b/machine/v1beta1/types_awsprovider.go @@ -44,6 +44,16 @@ type AWSMachineProviderConfig struct { // it should use the default of its subnet. // +optional PublicIP *bool `json:"publicIp,omitempty"` + // NetworkInterfaceType specifies the type of network interface to be used for the primary + // network interface. + // Valid values are "interface", "efa", and omitted, which means no opinion and the platform + // chooses a good default which may change over time. + // The current default value is "interface". + // Please visit https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html to learn more + // about the AWS Elastic Fabric Adapter interface option. + // +kubebuilder:validation:Enum:="interface";"efa" + // +optional + NetworkInterfaceType AWSNetworkInterfaceType `json:"networkInterfaceType,omitempty"` // SecurityGroups is an array of references to security groups that should be applied to the // instance. // +optional @@ -235,6 +245,18 @@ const ( NetworkLoadBalancerType AWSLoadBalancerType = "network" // AWS Network Load Balancer (NLB) ) +// AWSNetworkInterfaceType defines the network interface type of the the +// AWS EC2 network interface. +type AWSNetworkInterfaceType string + +const ( + // AWSInterfaceNetworkInterfaceType is the default network interface type. + // This should be used for standard network operations. + AWSInterfaceNetworkInterfaceType AWSNetworkInterfaceType = "interface" + // AWSEFANetworkInterfaceType is the Elastic Fabric Adapter network interface type. + AWSEFANetworkInterfaceType AWSNetworkInterfaceType = "efa" +) + // AWSMachineProviderStatus is the type that will be embedded in a Machine.Status.ProviderStatus field. // It contains AWS-specific status information. // Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer). diff --git a/machine/v1beta1/zz_generated.swagger_doc_generated.go b/machine/v1beta1/zz_generated.swagger_doc_generated.go index a1a3e3799a0..5c36745a64b 100644 --- a/machine/v1beta1/zz_generated.swagger_doc_generated.go +++ b/machine/v1beta1/zz_generated.swagger_doc_generated.go @@ -26,22 +26,23 @@ func (AWSMachineProviderCondition) SwaggerDoc() map[string]string { } var map_AWSMachineProviderConfig = map[string]string{ - "": "AWSMachineProviderConfig is the Schema for the awsmachineproviderconfigs API Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer).", - "ami": "AMI is the reference to the AMI from which to create the machine instance.", - "instanceType": "InstanceType is the type of instance to create. Example: m4.xlarge", - "tags": "Tags is the set of tags to add to apply to an instance, in addition to the ones added by default by the actuator. These tags are additive. The actuator will ensure these tags are present, but will not remove any other tags that may exist on the instance.", - "iamInstanceProfile": "IAMInstanceProfile is a reference to an IAM role to assign to the instance", - "userDataSecret": "UserDataSecret contains a local reference to a secret that contains the UserData to apply to the instance", - "credentialsSecret": "CredentialsSecret is a reference to the secret with AWS credentials. Otherwise, defaults to permissions provided by attached IAM role where the actuator is running.", - "keyName": "KeyName is the name of the KeyPair to use for SSH", - "deviceIndex": "DeviceIndex is the index of the device on the instance for the network interface attachment. Defaults to 0.", - "publicIp": "PublicIP specifies whether the instance should get a public IP. If not present, it should use the default of its subnet.", - "securityGroups": "SecurityGroups is an array of references to security groups that should be applied to the instance.", - "subnet": "Subnet is a reference to the subnet to use for this instance", - "placement": "Placement specifies where to create the instance in AWS", - "loadBalancers": "LoadBalancers is the set of load balancers to which the new instance should be added once it is created.", - "blockDevices": "BlockDevices is the set of block device mapping associated to this instance, block device without a name will be used as a root device and only one device without a name is allowed https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html", - "spotMarketOptions": "SpotMarketOptions allows users to configure instances to be run using AWS Spot instances.", + "": "AWSMachineProviderConfig is the Schema for the awsmachineproviderconfigs API Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer).", + "ami": "AMI is the reference to the AMI from which to create the machine instance.", + "instanceType": "InstanceType is the type of instance to create. Example: m4.xlarge", + "tags": "Tags is the set of tags to add to apply to an instance, in addition to the ones added by default by the actuator. These tags are additive. The actuator will ensure these tags are present, but will not remove any other tags that may exist on the instance.", + "iamInstanceProfile": "IAMInstanceProfile is a reference to an IAM role to assign to the instance", + "userDataSecret": "UserDataSecret contains a local reference to a secret that contains the UserData to apply to the instance", + "credentialsSecret": "CredentialsSecret is a reference to the secret with AWS credentials. Otherwise, defaults to permissions provided by attached IAM role where the actuator is running.", + "keyName": "KeyName is the name of the KeyPair to use for SSH", + "deviceIndex": "DeviceIndex is the index of the device on the instance for the network interface attachment. Defaults to 0.", + "publicIp": "PublicIP specifies whether the instance should get a public IP. If not present, it should use the default of its subnet.", + "networkInterfaceType": "NetworkInterfaceType specifies the type of network interface to be used for the primary network interface. Valid values are \"interface\", \"efa\", and omitted, which means no opinion and the platform chooses a good default which may change over time. The current default value is \"interface\". Please visit https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html to learn more about the AWS Elastic Fabric Adapter interface option.", + "securityGroups": "SecurityGroups is an array of references to security groups that should be applied to the instance.", + "subnet": "Subnet is a reference to the subnet to use for this instance", + "placement": "Placement specifies where to create the instance in AWS", + "loadBalancers": "LoadBalancers is the set of load balancers to which the new instance should be added once it is created.", + "blockDevices": "BlockDevices is the set of block device mapping associated to this instance, block device without a name will be used as a root device and only one device without a name is allowed https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html", + "spotMarketOptions": "SpotMarketOptions allows users to configure instances to be run using AWS Spot instances.", } func (AWSMachineProviderConfig) SwaggerDoc() map[string]string { From 9ec7092a5678cb404ed99d5c741db4928f2318f1 Mon Sep 17 00:00:00 2001 From: Joel Speed Date: Tue, 21 Dec 2021 15:43:53 +0000 Subject: [PATCH 2/2] Update EFA options to match enhancement --- machine/v1beta1/types_awsprovider.go | 13 +++++++------ .../v1beta1/zz_generated.swagger_doc_generated.go | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/machine/v1beta1/types_awsprovider.go b/machine/v1beta1/types_awsprovider.go index 69ea3b7db01..a9df9b7758d 100644 --- a/machine/v1beta1/types_awsprovider.go +++ b/machine/v1beta1/types_awsprovider.go @@ -46,12 +46,12 @@ type AWSMachineProviderConfig struct { PublicIP *bool `json:"publicIp,omitempty"` // NetworkInterfaceType specifies the type of network interface to be used for the primary // network interface. - // Valid values are "interface", "efa", and omitted, which means no opinion and the platform + // Valid values are "ENA", "EFA", and omitted, which means no opinion and the platform // chooses a good default which may change over time. - // The current default value is "interface". + // The current default value is "ENA". // Please visit https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html to learn more // about the AWS Elastic Fabric Adapter interface option. - // +kubebuilder:validation:Enum:="interface";"efa" + // +kubebuilder:validation:Enum:="ENA";"EFA" // +optional NetworkInterfaceType AWSNetworkInterfaceType `json:"networkInterfaceType,omitempty"` // SecurityGroups is an array of references to security groups that should be applied to the @@ -250,11 +250,12 @@ const ( type AWSNetworkInterfaceType string const ( - // AWSInterfaceNetworkInterfaceType is the default network interface type. + // AWSENANetworkInterfaceType is the default network interface type, + // the EC2 Elastic Network Adapter commonly used with EC2 instances. // This should be used for standard network operations. - AWSInterfaceNetworkInterfaceType AWSNetworkInterfaceType = "interface" + AWSENANetworkInterfaceType AWSNetworkInterfaceType = "ENA" // AWSEFANetworkInterfaceType is the Elastic Fabric Adapter network interface type. - AWSEFANetworkInterfaceType AWSNetworkInterfaceType = "efa" + AWSEFANetworkInterfaceType AWSNetworkInterfaceType = "EFA" ) // AWSMachineProviderStatus is the type that will be embedded in a Machine.Status.ProviderStatus field. diff --git a/machine/v1beta1/zz_generated.swagger_doc_generated.go b/machine/v1beta1/zz_generated.swagger_doc_generated.go index 5c36745a64b..9302077ac6c 100644 --- a/machine/v1beta1/zz_generated.swagger_doc_generated.go +++ b/machine/v1beta1/zz_generated.swagger_doc_generated.go @@ -36,7 +36,7 @@ var map_AWSMachineProviderConfig = map[string]string{ "keyName": "KeyName is the name of the KeyPair to use for SSH", "deviceIndex": "DeviceIndex is the index of the device on the instance for the network interface attachment. Defaults to 0.", "publicIp": "PublicIP specifies whether the instance should get a public IP. If not present, it should use the default of its subnet.", - "networkInterfaceType": "NetworkInterfaceType specifies the type of network interface to be used for the primary network interface. Valid values are \"interface\", \"efa\", and omitted, which means no opinion and the platform chooses a good default which may change over time. The current default value is \"interface\". Please visit https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html to learn more about the AWS Elastic Fabric Adapter interface option.", + "networkInterfaceType": "NetworkInterfaceType specifies the type of network interface to be used for the primary network interface. Valid values are \"ENA\", \"EFA\", and omitted, which means no opinion and the platform chooses a good default which may change over time. The current default value is \"ENA\". Please visit https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html to learn more about the AWS Elastic Fabric Adapter interface option.", "securityGroups": "SecurityGroups is an array of references to security groups that should be applied to the instance.", "subnet": "Subnet is a reference to the subnet to use for this instance", "placement": "Placement specifies where to create the instance in AWS",