Skip to content

Commit

Permalink
Merge pull request #120 from flavio-fernandes/OCPBUGS-17151_panic
Browse files Browse the repository at this point in the history
OCPBUGS-17151: AWS: Skipping Unusable Network Interfaces
  • Loading branch information
openshift-merge-robot committed Sep 6, 2023
2 parents 093e68b + e8241ed commit 159e2bd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/cloudprovider/aws.go
Expand Up @@ -193,7 +193,12 @@ func (a *AWS) GetNodeEgressIPConfiguration(node *corev1.Node, cloudPrivateIPConf
if err != nil {
return nil, err
}
// For now, we only consider the first interface for EgressIP
networkInterface := networkInterfaces[0]
if networkInterface.NetworkInterfaceId == nil || *networkInterface.NetworkInterfaceId == "" ||
networkInterface.SubnetId == nil || *networkInterface.SubnetId == "" {
return nil, fmt.Errorf("error retrieving network interface with valid ids: %v", networkInterfaces)
}
config := &NodeEgressIPConfiguration{
Interface: *networkInterface.NetworkInterfaceId,
}
Expand Down Expand Up @@ -263,7 +268,11 @@ func (a *AWS) getSubnet(networkInterface *ec2.InstanceNetworkInterface) (*net.IP
return nil, nil, fmt.Errorf("error: cannot list ec2 subnets, err: %v", err)
}
if len(describeOutput.Subnets) > 1 {
return nil, nil, fmt.Errorf("error: multiple subnets found for the subnet ID: %s", *networkInterface.SubnetId)
subnetId := "<nil>"
if networkInterface.SubnetId != nil {
subnetId = *networkInterface.SubnetId
}
return nil, nil, fmt.Errorf("error: multiple subnets found for the subnet ID: %s", subnetId)
}

var v4Subnet, v6Subnet *net.IPNet
Expand Down

0 comments on commit 159e2bd

Please sign in to comment.