Skip to content

Commit

Permalink
NET-2087: Restart proxy sidecar during cluster upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
NiniOak committed Feb 3, 2023
1 parent 2f149d6 commit 64740cc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
19 changes: 18 additions & 1 deletion test/integration/consul-container/libs/service/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,24 @@ func (g ConnectContainer) GetAddr() (string, int) {
}

func (g ConnectContainer) Restart() error {
return fmt.Errorf("Restart Unimplemented by ConnectContainer")
_, err := g.GetStatus()
if err != nil {
return fmt.Errorf("error fetching sidecar container state %s", err)
}

fmt.Printf("Stopping container: %s\n", g.GetName())
err = g.container.Stop(g.ctx, nil)

if err != nil {
return fmt.Errorf("error stopping sidecar container %s", err)
}

fmt.Printf("Starting container: %s\n", g.GetName())
err = g.container.Start(g.ctx)
if err != nil {
return fmt.Errorf("error starting sidecar container %s", err)
}
return nil
}

func (g ConnectContainer) GetLogs() (string, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ func TestPeering_Upgrade_ControlPlane_MGW(t *testing.T) {
// - Register a new static-client service in dialing cluster and
// - set upstream to static-server service in peered cluster

// Restart the gateway
err = dialing.Gateway.Restart()
require.NoError(t, err)
// Restart the gateway & proxy sidecar
require.NoError(t, dialing.Gateway.Restart())
require.NoError(t, accepting.Container.Restart())

// Restarted gateway should not have any measurement on data plane traffic
libassert.AssertEnvoyMetricAtMost(t, gatewayAdminPort,
Expand All @@ -107,6 +107,7 @@ func TestPeering_Upgrade_ControlPlane_MGW(t *testing.T) {
require.NoError(t, err)
_, port := clientSidecarService.GetAddr()
_, adminPort := clientSidecarService.GetAdminAddr()
require.NoError(t, clientSidecarService.Restart())
libassert.AssertUpstreamEndpointStatus(t, adminPort, fmt.Sprintf("static-server.default.%s.external", libtopology.DialingPeerName), "HEALTHY", 1)
libassert.HTTPServiceEchoes(t, "localhost", port, "")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ func TestPeering_UpgradeToTarget_fromLatest(t *testing.T) {
// - Register a new static-client service in dialing cluster and
// - set upstream to static-server service in peered cluster

// Restart the gateway
err = dialing.Gateway.Restart()
require.NoError(t, err)
// Restart the gateway & proxy sidecar
require.NoError(t, dialing.Gateway.Restart())
require.NoError(t, dialing.Container.Restart())

// Restarted gateway should not have any measurement on data plane traffic
libassert.AssertEnvoyMetricAtMost(t, gatewayAdminPort,
"cluster.static-server.default.default.accepting-to-dialer.external",
Expand All @@ -76,6 +77,7 @@ func TestPeering_UpgradeToTarget_fromLatest(t *testing.T) {
require.NoError(t, err)
_, port := clientSidecarService.GetAddr()
_, adminPort := clientSidecarService.GetAdminAddr()
require.NoError(t, clientSidecarService.Restart())
libassert.AssertUpstreamEndpointStatus(t, adminPort, fmt.Sprintf("static-server.default.%s.external", libtopology.DialingPeerName), "HEALTHY", 1)
libassert.HTTPServiceEchoes(t, "localhost", port, "")
}
Expand Down

0 comments on commit 64740cc

Please sign in to comment.