fix routes not being saved when new nodes registers (#2444)

* add test to validate exitnode propagation

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

* save routes on register

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

* update changelog

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

* no nil

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

* add missing integration tests

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

---------

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2025-02-23 14:10:25 -08:00 committed by GitHub
parent bcff0eaae7
commit da2ca054b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 150 additions and 1 deletions

View file

@ -80,6 +80,7 @@ type TailscaleInContainer struct {
withExtraHosts []string
workdir string
netfilter string
extraLoginArgs []string
// build options, solely for HEAD
buildConfig TailscaleInContainerBuildConfig
@ -203,6 +204,14 @@ func WithBuildTag(tag string) Option {
}
}
// WithExtraLoginArgs adds additional arguments to the `tailscale up` command
// as part of the Login function.
func WithExtraLoginArgs(args []string) Option {
return func(tsic *TailscaleInContainer) {
tsic.extraLoginArgs = args
}
}
// New returns a new TailscaleInContainer instance.
func New(
pool *dockertest.Pool,
@ -436,6 +445,10 @@ func (t *TailscaleInContainer) Login(
"--accept-routes=false",
}
if t.extraLoginArgs != nil {
command = append(command, t.extraLoginArgs...)
}
if t.withSSH {
command = append(command, "--ssh")
}
@ -475,6 +488,10 @@ func (t *TailscaleInContainer) LoginWithURL(
"--accept-routes=false",
}
if t.extraLoginArgs != nil {
command = append(command, t.extraLoginArgs...)
}
stdout, stderr, err := t.Execute(command)
if errors.Is(err, errTailscaleNotLoggedIn) {
return nil, errTailscaleCannotUpWithoutAuthkey