in internal/deployers/eksapi/node.go [750:781]
func getNetworkInterface(opts *deployerOptions, networkCardIndex int, subnetIds []string, securityGroups []string) (templates.NetworkInterface, error) {
// simplification that works with currently supported network interfaces based on
// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#network-cards
// and
// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-efa.html#efa-launch
deviceIndex := 0
if networkCardIndex > 0 {
deviceIndex = 1
}
var description, interfaceType, subnetID *string
if opts.EFA {
if len(subnetIds) == 0 {
return templates.NetworkInterface{}, fmt.Errorf("EFA interfaces require a subnet but none were provided")
}
subnetID = &subnetIds[0]
interfaceType = aws.String("efa")
description = aws.String("EFA-enabled network interface")
} else {
// no need to assign a subnet here, more restrictive than it is helpful
interfaceType = aws.String("interface")
description = aws.String("Standard network interface")
}
return templates.NetworkInterface{
Description: description,
DeviceIndex: &deviceIndex,
NetworkCardIndex: &networkCardIndex,
InterfaceType: interfaceType,
SubnetId: subnetID,
Groups: securityGroups,
DeleteOnTermination: aws.Bool(true),
}, nil
}