Skip to content

Commit fb3523b

Browse files
authored
chore: remove legacy AgentIP address (#14640)
Removes the support for the Agent's "legacy IP" which was a hardcoded IP address all agents used to use, before we introduced "single tailnet". Single tailnet went GA in 2.7.0.
1 parent 6a846cd commit fb3523b

File tree

5 files changed

+1
-93
lines changed

5 files changed

+1
-93
lines changed

agent/agent.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,9 +1119,6 @@ func (a *agent) wireguardAddresses(agentID uuid.UUID) []netip.Prefix {
11191119
return []netip.Prefix{
11201120
// This is the IP that should be used primarily.
11211121
netip.PrefixFrom(tailnet.IPFromUUID(agentID), 128),
1122-
// We also listen on the legacy codersdk.WorkspaceAgentIP. This
1123-
// allows for a transition away from wsconncache.
1124-
netip.PrefixFrom(workspacesdk.AgentIP, 128),
11251122
}
11261123
}
11271124

codersdk/workspacesdk/workspacesdk.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ import (
2525
"github.com/coder/quartz"
2626
)
2727

28-
// AgentIP is a static IPv6 address with the Tailscale prefix that is used to route
29-
// connections from clients to this node. A dynamic address is not required because a Tailnet
30-
// client only dials a single agent at a time.
31-
//
32-
// Deprecated: use tailnet.IP() instead. This is kept for backwards
33-
// compatibility with outdated CLI clients and Workspace Proxies that dial it.
34-
// See: https://github.com/coder/coder/issues/11819
35-
var AgentIP = netip.MustParseAddr("fd7a:115c:a1e0:49d6:b259:b7ac:b1b2:48f4")
36-
3728
var ErrSkipClose = xerrors.New("skip tailnet close")
3829

3930
const (

enterprise/tailnet/pgcoord_test.go

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"github.com/coder/coder/v2/coderd/database/dbmock"
2626
"github.com/coder/coder/v2/coderd/database/dbtestutil"
2727
"github.com/coder/coder/v2/coderd/database/pubsub"
28-
"github.com/coder/coder/v2/codersdk/workspacesdk"
2928
"github.com/coder/coder/v2/enterprise/tailnet"
3029
agpl "github.com/coder/coder/v2/tailnet"
3130
"github.com/coder/coder/v2/tailnet/proto"
@@ -210,48 +209,6 @@ func TestPGCoordinatorSingle_AgentValidIP(t *testing.T) {
210209
assertEventuallyLost(ctx, t, store, agent.id)
211210
}
212211

213-
func TestPGCoordinatorSingle_AgentValidIPLegacy(t *testing.T) {
214-
t.Parallel()
215-
if !dbtestutil.WillUsePostgres() {
216-
t.Skip("test only with postgres")
217-
}
218-
store, ps := dbtestutil.NewDB(t)
219-
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitSuperLong)
220-
defer cancel()
221-
logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug)
222-
coordinator, err := tailnet.NewPGCoord(ctx, logger, ps, store)
223-
require.NoError(t, err)
224-
defer coordinator.Close()
225-
226-
agent := newTestAgent(t, coordinator, "agent")
227-
defer agent.close()
228-
agent.sendNode(&agpl.Node{
229-
Addresses: []netip.Prefix{
230-
netip.PrefixFrom(workspacesdk.AgentIP, 128),
231-
},
232-
PreferredDERP: 10,
233-
})
234-
require.Eventually(t, func() bool {
235-
agents, err := store.GetTailnetPeers(ctx, agent.id)
236-
if err != nil && !xerrors.Is(err, sql.ErrNoRows) {
237-
t.Fatalf("database error: %v", err)
238-
}
239-
if len(agents) == 0 {
240-
return false
241-
}
242-
node := new(proto.Node)
243-
err = gProto.Unmarshal(agents[0].Node, node)
244-
assert.NoError(t, err)
245-
assert.EqualValues(t, 10, node.PreferredDerp)
246-
return true
247-
}, testutil.WaitShort, testutil.IntervalFast)
248-
err = agent.close()
249-
require.NoError(t, err)
250-
<-agent.errChan
251-
<-agent.closeChan
252-
assertEventuallyLost(ctx, t, store, agent.id)
253-
}
254-
255212
func TestPGCoordinatorSingle_AgentWithClient(t *testing.T) {
256213
t.Parallel()
257214
if !dbtestutil.WillUsePostgres() {

site/e2e/tests/outdatedCLI.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import {
1111
} from "../helpers";
1212
import { beforeCoderTest } from "../hooks";
1313

14-
// we no longer support versions prior to single tailnet: https://github.com/coder/coder/commit/d7cbdbd9c64ad26821e6b35834c59ecf85dcd9d4
15-
const clientVersion = "v0.27.0";
14+
const clientVersion = "v2.8.0";
1615

1716
test.beforeEach(({ page }) => beforeCoderTest(page));
1817

tailnet/coordinator_test.go

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222

2323
"cdr.dev/slog"
2424
"cdr.dev/slog/sloggers/slogtest"
25-
"github.com/coder/coder/v2/codersdk/workspacesdk"
2625
"github.com/coder/coder/v2/tailnet"
2726
"github.com/coder/coder/v2/tailnet/proto"
2827
"github.com/coder/coder/v2/tailnet/tailnettest"
@@ -133,41 +132,6 @@ func TestCoordinator(t *testing.T) {
133132
_ = testutil.RequireRecvCtx(ctx, t, closeChan)
134133
})
135134

136-
t.Run("AgentWithoutClients_ValidIPLegacy", func(t *testing.T) {
137-
t.Parallel()
138-
logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug)
139-
ctx := testutil.Context(t, testutil.WaitMedium)
140-
coordinator := tailnet.NewCoordinator(logger)
141-
defer func() {
142-
err := coordinator.Close()
143-
require.NoError(t, err)
144-
}()
145-
client, server := net.Pipe()
146-
sendNode, errChan := tailnet.ServeCoordinator(client, func(node []*tailnet.Node) error {
147-
return nil
148-
})
149-
id := uuid.New()
150-
closeChan := make(chan struct{})
151-
go func() {
152-
err := coordinator.ServeAgent(server, id, "")
153-
assert.NoError(t, err)
154-
close(closeChan)
155-
}()
156-
sendNode(&tailnet.Node{
157-
Addresses: []netip.Prefix{
158-
netip.PrefixFrom(workspacesdk.AgentIP, 128),
159-
},
160-
PreferredDERP: 10,
161-
})
162-
require.Eventually(t, func() bool {
163-
return coordinator.Node(id) != nil
164-
}, testutil.WaitShort, testutil.IntervalFast)
165-
err := client.Close()
166-
require.NoError(t, err)
167-
_ = testutil.RequireRecvCtx(ctx, t, errChan)
168-
_ = testutil.RequireRecvCtx(ctx, t, closeChan)
169-
})
170-
171135
t.Run("AgentWithoutClients_InvalidIP", func(t *testing.T) {
172136
t.Parallel()
173137
logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true}).Leveled(slog.LevelDebug)

0 commit comments

Comments
 (0)