Skip to content

Commit

Permalink
Skip gateway failover E2E test for wireguard
Browse files Browse the repository at this point in the history
The testGatewayPodRestartScenario is consistently failing with
wireguard. We've narrowed it down to an unknown issue with
Kind 0.21 so skip the test for now.

Signed-off-by: Tom Pantelis <[email protected]>
  • Loading branch information
tpantelis committed May 31, 2024
1 parent 1ef9a2e commit 33fe3dd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
10 changes: 5 additions & 5 deletions pkg/cable/wireguard/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const (
// handshakeTimeout is maximal time from handshake a connections is still considered connected.
handshakeTimeout = 2*time.Minute + 10*time.Second

cableDriverName = "wireguard"
CableDriverName = "wireguard"
receiveBytes = "ReceiveBytes" // for peer connection status
transmitBytes = "TransmitBytes" // for peer connection status
lastChecked = "LastChecked" // for connection peer status
Expand All @@ -65,7 +65,7 @@ const (
var logger = log.Logger{Logger: logf.Log.WithName("wireguard")}

func init() {
cable.AddDriver(cableDriverName, NewDriver)
cable.AddDriver(CableDriverName, NewDriver)
}

type specification struct {
Expand Down Expand Up @@ -203,7 +203,7 @@ func (w *wireguard) Init() error {
}

func (w *wireguard) GetName() string {
return cableDriverName
return CableDriverName
}

func (w *wireguard) ConnectToEndpoint(endpointInfo *natdiscovery.NATEndpointInfo) (string, error) {
Expand Down Expand Up @@ -301,7 +301,7 @@ func (w *wireguard) ConnectToEndpoint(endpointInfo *natdiscovery.NATEndpointInfo

logger.V(log.DEBUG).Infof("Done connecting endpoint peer %s@%s", *remoteKey, remoteIP)

cable.RecordConnection(cableDriverName, &w.localEndpoint.Spec, &connection.Endpoint, string(v1.Connected), true)
cable.RecordConnection(CableDriverName, &w.localEndpoint.Spec, &connection.Endpoint, string(v1.Connected), true)

return ip, nil
}
Expand Down Expand Up @@ -350,7 +350,7 @@ func (w *wireguard) DisconnectFromEndpoint(remoteEndpoint *types.SubmarinerEndpo
delete(w.connections, remoteEndpoint.Spec.ClusterID)

logger.V(log.DEBUG).Infof("Done removing endpoint for cluster %s", remoteEndpoint.Spec.ClusterID)
cable.RecordDisconnected(cableDriverName, &w.localEndpoint.Spec, &remoteEndpoint.Spec)
cable.RecordDisconnected(CableDriverName, &w.localEndpoint.Spec, &remoteEndpoint.Spec)

return nil
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/cable/wireguard/getconnections.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ func (w *wireguard) updateConnectionForPeer(p *wgtypes.Peer, connection *v1.Conn
if lc > handshakeTimeout.Milliseconds() {
// No initial handshake for too long.
connection.SetStatus(v1.ConnectionError, "no initial handshake for %.1f seconds", lcSec)
cable.RecordConnection(cableDriverName, &w.localEndpoint.Spec, &connection.Endpoint, string(connection.Status), false)
cable.RecordConnection(CableDriverName, &w.localEndpoint.Spec, &connection.Endpoint, string(connection.Status), false)

return
}

if tx > 0 || rx > 0 {
// No handshake, but at least some communication in progress.
connection.SetStatus(v1.Connecting, "no initial handshake yet")
cable.RecordConnection(cableDriverName, &w.localEndpoint.Spec, &connection.Endpoint, string(connection.Status), false)
cable.RecordConnection(CableDriverName, &w.localEndpoint.Spec, &connection.Endpoint, string(connection.Status), false)

return
}
Expand All @@ -112,7 +112,7 @@ func (w *wireguard) updateConnectionForPeer(p *wgtypes.Peer, connection *v1.Conn
if tx > 0 || rx > 0 {
// All is good.
connection.SetStatus(v1.Connected, "Rx=%d Bytes, Tx=%d Bytes", p.ReceiveBytes, p.TransmitBytes)
cable.RecordConnection(cableDriverName, &w.localEndpoint.Spec, &connection.Endpoint, string(connection.Status), false)
cable.RecordConnection(CableDriverName, &w.localEndpoint.Spec, &connection.Endpoint, string(connection.Status), false)
saveAndRecordPeerTraffic(&w.localEndpoint.Spec, &connection.Endpoint, now, p.TransmitBytes, p.ReceiveBytes)

return
Expand All @@ -124,7 +124,7 @@ func (w *wireguard) updateConnectionForPeer(p *wgtypes.Peer, connection *v1.Conn
// Hard error, really long time since handshake.
connection.SetStatus(v1.ConnectionError, "no handshake for %.1f seconds",
handshakeDelta.Seconds())
cable.RecordConnection(cableDriverName, &w.localEndpoint.Spec, &connection.Endpoint, string(connection.Status), false)
cable.RecordConnection(CableDriverName, &w.localEndpoint.Spec, &connection.Endpoint, string(connection.Status), false)

return
}
Expand All @@ -138,14 +138,14 @@ func (w *wireguard) updateConnectionForPeer(p *wgtypes.Peer, connection *v1.Conn
// Soft error, no traffic, stale handshake.
connection.SetStatus(v1.ConnectionError, "no bytes sent or received for %.1f seconds",
lcSec)
cable.RecordConnection(cableDriverName, &w.localEndpoint.Spec, &connection.Endpoint, string(connection.Status), false)
cable.RecordConnection(CableDriverName, &w.localEndpoint.Spec, &connection.Endpoint, string(connection.Status), false)
}

func (w *wireguard) updatePeerStatus(c *v1.Connection, key *wgtypes.Key) {
p, err := w.peerByKey(key)
if err != nil {
c.SetStatus(v1.ConnectionError, "cannot fetch status for peer %s: %v", key, err)
cable.RecordConnection(cableDriverName, &w.localEndpoint.Spec, &c.Endpoint, string(c.Status), false)
cable.RecordConnection(CableDriverName, &w.localEndpoint.Spec, &c.Endpoint, string(c.Status), false)

return
}
Expand Down Expand Up @@ -174,6 +174,6 @@ func saveAndRecordPeerTraffic(localEndpoint, remoteEndpoint *v1.EndpointSpec, lc
remoteEndpoint.BackendConfig[transmitBytes] = strconv.FormatInt(tx, 10)
remoteEndpoint.BackendConfig[receiveBytes] = strconv.FormatInt(rx, 10)

cable.RecordTxBytes(cableDriverName, localEndpoint, remoteEndpoint, int(tx))
cable.RecordRxBytes(cableDriverName, localEndpoint, remoteEndpoint, int(rx))
cable.RecordTxBytes(CableDriverName, localEndpoint, remoteEndpoint, int(tx))
cable.RecordRxBytes(CableDriverName, localEndpoint, remoteEndpoint, int(rx))
}
9 changes: 9 additions & 0 deletions test/e2e/redundancy/gateway_failover.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/submariner-io/shipyard/test/e2e/framework"
"github.com/submariner-io/shipyard/test/e2e/tcp"
subv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1"
"github.com/submariner-io/submariner/pkg/cable/wireguard"
subFramework "github.com/submariner-io/submariner/test/e2e/framework"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -79,6 +80,14 @@ func testGatewayPodRestartScenario(f *subFramework.Framework) {
Expect(gatewayNodes).To(HaveLen(1), fmt.Sprintf("Expected only one gateway node on %q", primaryClusterName))
framework.By(fmt.Sprintf("Found gateway on node %q on %q", gatewayNodes[0].Name, primaryClusterName))

submEndpoint := f.AwaitSubmarinerEndpoint(primaryCluster, subFramework.NoopCheckEndpoint)

if submEndpoint.Spec.Backend == wireguard.CableDriverName &&
framework.DetectProvider(context.TODO(), primaryCluster, gatewayNodes[0].Name) == "kind" {
framework.Skipf("The test is known to fail on Kind 0.21+ with the wireguard cable driver - skipping the test...")
return
}

gatewayPod := f.AwaitSubmarinerGatewayPod(primaryCluster)
framework.By(fmt.Sprintf("Found submariner gateway pod %q on %q, checking node and HA status labels", gatewayPod.Name, primaryClusterName))

Expand Down

0 comments on commit 33fe3dd

Please sign in to comment.