diff --git a/integration/tsic/tsic.go b/integration/tsic/tsic.go index 29614ad4350..6c0c88ede49 100644 --- a/integration/tsic/tsic.go +++ b/integration/tsic/tsic.go @@ -51,6 +51,7 @@ type TailscaleInContainer struct { headscaleCert []byte headscaleHostname string withSSH bool + withTags []string } type Option = func(c *TailscaleInContainer) @@ -87,6 +88,12 @@ func WithHeadscaleName(hsName string) Option { } } +func WithTags(tags []string) Option { + return func(tsic *TailscaleInContainer) { + tsic.withTags = tags + } +} + func WithSSH() Option { return func(tsic *TailscaleInContainer) { tsic.withSSH = true @@ -233,6 +240,12 @@ func (t *TailscaleInContainer) Up( command = append(command, "--ssh") } + if len(t.withTags) > 0 { + command = append(command, + fmt.Sprintf(`--advertise-tags=%s`, strings.Join(t.withTags, ",")), + ) + } + if _, _, err := t.Execute(command); err != nil { return fmt.Errorf("failed to join tailscale client: %w", err) }