Skip to content

Commit

Permalink
Add Egress IPv6 test cases in dual-stack or pure IPv6 cluster. Related
Browse files Browse the repository at this point in the history
…antrea-io#2196

Fixed agent start fail nil panic in pure IPv6 cluster. Related antrea-io#2436

Signed-off-by: Wenqi Qiu <[email protected]>
  • Loading branch information
wenqiq committed Sep 1, 2021
1 parent bfa1bc4 commit cfda4af
Show file tree
Hide file tree
Showing 8 changed files with 387 additions and 218 deletions.
10 changes: 9 additions & 1 deletion cmd/antrea-agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,17 @@ func run(o *Options) error {
}

var egressController *egress.EgressController
var nodeIP net.IP
if nodeConfig.NodeIPv4Addr != nil {
nodeIP = nodeConfig.NodeIPv4Addr.IP
} else if nodeConfig.NodeIPv6Addr != nil {
nodeIP = nodeConfig.NodeIPv6Addr.IP
} else {
return fmt.Errorf("invalid NodeIPAddr in Node config: %v", nodeConfig)
}
if features.DefaultFeatureGate.Enabled(features.Egress) {
egressController, err = egress.NewEgressController(
ofClient, antreaClientProvider, crdClient, ifaceStore, routeClient, nodeConfig.Name, nodeConfig.NodeIPv4Addr.IP,
ofClient, antreaClientProvider, crdClient, ifaceStore, routeClient, nodeConfig.Name, nodeIP,
o.config.ClusterMembershipPort, egressInformer, nodeInformer, externalIPPoolInformer,
)
if err != nil {
Expand Down
5 changes: 1 addition & 4 deletions pkg/agent/memberlist/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,10 @@ func (c *Cluster) newClusterMember(node *corev1.Node) (string, error) {
return "", fmt.Errorf("obtain IP addresses from K8s Node failed: %v", err)
}
nodeAddr := nodeAddrs.IPv4
fmtStr := "%s:%d"
if nodeAddr == nil {
nodeAddr = nodeAddrs.IPv6
fmtStr = "[%s]:%d"
}
member := fmt.Sprintf(fmtStr, nodeAddr, c.bindPort)
return member, nil
return nodeAddr.String(), nil
}

func (c *Cluster) allClusterMembers() (clusterNodes []string, err error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/util/ndp/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package ndp contains functions to send NDP advertisement on Linux.
// Package ndp contains functions to send NDP neighbor advertisement on Linux.
package ndp
Loading

0 comments on commit cfda4af

Please sign in to comment.