Skip to content

Conversation

irbekrm
Copy link
Contributor

@irbekrm irbekrm commented May 29, 2025

In 1.84 we made 'tailscale set'/'tailscale up' error out if duplicate command line flags are passed, see #16108

This broke some container configurations as we have two env vars that can be used to set --accept-dns flag:

  • TS_ACCEPT_DNS- specifically for --accept-dns
  • TS_EXTRA_ARGS- accepts any arbitrary 'tailscale up'/'tailscale set' flag.

We default TS_ACCEPT_DNS to false (to make the container behaviour more declarative- the CLI flags expect an explicit 'false' to change state true -> false, rather than just being unset), which with the new restrictive CLI behaviour resulted in failure for users who had set --accept-dns via TS_EXTRA_ARGS as the flag would be provided twice.
(See the defaulting here)

This PR re-instates the previous behaviour by checking if TS_EXTRA_ARGS contains --accept-dns flag and if so using its value to override TS_ACCEPT_DNS.

Really this illustrates that we should ideally move away from the env vars/flag parsing mechanism eventually.

@ghost
Copy link

ghost commented May 29, 2025

Pull Request Revisions

RevisionDescription
r3
Improved DNS parsing in containerbootEnhanced containerboot DNS handling with new test case, extra args parsing, and added logging for invalid DNS settings
r2
Removed test parameter from localAPIIn the newTestEnv function, the localAPI struct initialization no longer passes the t *testing.T parameter
r1
Added DNS configuration parsing logicImplemented new parsing logic for handling --accept-dns flag in containerboot, supporting environment variable overrides and complex configuration scenarios

✅ AI review completed for r3
Help React with emojis to give feedback on AI-generated reviews:
  • 👍 means the feedback was helpful and actionable
  • 👎 means the feedback was incorrect or unhelpful
💬 Replying to feedback with a comment helps us improve the system. Your input also contributes to shaping future interactions with the AI reviewer.

We'd love to hear from you—reach out anytime at team@review.ai.

@ghost
Copy link

ghost commented May 29, 2025

In the testEnv struct on line 1554, the Port fields have comments indicating their purpose, but the comment format is inconsistent with Go conventions. Consider using complete sentences ending with a period for all field comments.

@irbekrm irbekrm force-pushed the irbekrm/duplicate_flags branch from 17f7fbc to 58189fa Compare May 29, 2025 15:42
In 1.84 we made 'tailscale set'/'tailscale up' error out if duplicate
command line flags are passed.
This broke some container configurations as we have two env vars that
can be used to set --accept-dns flag:
- TS_ACCEPT_DNS- specifically for --accept-dns
- TS_EXTRA_ARGS- accepts any arbitrary 'tailscale up'/'tailscale set'
flag.

We default TS_ACCEPT_DNS to false (to make the container behaviour more
declarative), which with the new restrictive CLI behaviour resulted in
failure for users who had set --accept-dns via TS_EXTRA_ARGS as the flag would be
provided twice.

This PR re-instates the previous behaviour by checking if TS_EXTRA_ARGS
contains --accept-dns flag and if so using its value to override TS_ACCEPT_DNS.

Updates #16108

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
@irbekrm irbekrm force-pushed the irbekrm/duplicate_flags branch from 58189fa to 6057b9a Compare May 30, 2025 09:13
@irbekrm irbekrm requested review from tomhjp and ChaosInTheCRD May 30, 2025 09:16
// do this to preserve the previous behaviour where --accept-dns could be
// set either via TS_ACCEPT_DNS or TS_EXTRA_ARGS.
acceptDNS := cfg.AcceptDNS != nil && *cfg.AcceptDNS
tsExtraArgs, acceptDNSNew := parseAcceptDNS(cfg.ExtraArgs, acceptDNS)
Copy link
Contributor

@ChaosInTheCRD ChaosInTheCRD May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is --accept-dns the situation where this sort of clash could occur? Of course the function we've added here is quite specific, so I am wondering whether down the line we are going to have to add more functions like this. If this is the case, could we benefit from something more all encompassing?

Copy link
Contributor Author

@irbekrm irbekrm May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we shouldn't add more env vars that allow setting the same flags that already can be set via TS_EXTRA_ARGS/TS_TAILSCALED_EXTRA_ARGS

@irbekrm irbekrm merged commit 5b670eb into main May 30, 2025
50 checks passed
@irbekrm irbekrm deleted the irbekrm/duplicate_flags branch May 30, 2025 10:30
irbekrm added a commit that referenced this pull request May 30, 2025
…#16129)

In 1.84 we made 'tailscale set'/'tailscale up' error out if duplicate
command line flags are passed.
This broke some container configurations as we have two env vars that
can be used to set --accept-dns flag:
- TS_ACCEPT_DNS- specifically for --accept-dns
- TS_EXTRA_ARGS- accepts any arbitrary 'tailscale up'/'tailscale set'
flag.

We default TS_ACCEPT_DNS to false (to make the container behaviour more
declarative), which with the new restrictive CLI behaviour resulted in
failure for users who had set --accept-dns via TS_EXTRA_ARGS as the flag would be
provided twice.

This PR re-instates the previous behaviour by checking if TS_EXTRA_ARGS
contains --accept-dns flag and if so using its value to override TS_ACCEPT_DNS.

Updates #16108

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
(cherry picked from commit 5b670eb)
irbekrm added a commit that referenced this pull request May 30, 2025
…#16129) (#16140)

In 1.84 we made 'tailscale set'/'tailscale up' error out if duplicate
command line flags are passed.
This broke some container configurations as we have two env vars that
can be used to set --accept-dns flag:
- TS_ACCEPT_DNS- specifically for --accept-dns
- TS_EXTRA_ARGS- accepts any arbitrary 'tailscale up'/'tailscale set'
flag.

We default TS_ACCEPT_DNS to false (to make the container behaviour more
declarative), which with the new restrictive CLI behaviour resulted in
failure for users who had set --accept-dns via TS_EXTRA_ARGS as the flag would be
provided twice.

This PR re-instates the previous behaviour by checking if TS_EXTRA_ARGS
contains --accept-dns flag and if so using its value to override TS_ACCEPT_DNS.

Updates #16108


(cherry picked from commit 5b670eb)

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
KevinLiang10 pushed a commit that referenced this pull request Jun 3, 2025
…#16129)

In 1.84 we made 'tailscale set'/'tailscale up' error out if duplicate
command line flags are passed.
This broke some container configurations as we have two env vars that
can be used to set --accept-dns flag:
- TS_ACCEPT_DNS- specifically for --accept-dns
- TS_EXTRA_ARGS- accepts any arbitrary 'tailscale up'/'tailscale set'
flag.

We default TS_ACCEPT_DNS to false (to make the container behaviour more
declarative), which with the new restrictive CLI behaviour resulted in
failure for users who had set --accept-dns via TS_EXTRA_ARGS as the flag would be
provided twice.

This PR re-instates the previous behaviour by checking if TS_EXTRA_ARGS
contains --accept-dns flag and if so using its value to override TS_ACCEPT_DNS.

Updates #16108

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
thirdeyenick pushed a commit to ninech/tailscale that referenced this pull request Jul 2, 2025
…tailscale#16129) (tailscale#16140)

In 1.84 we made 'tailscale set'/'tailscale up' error out if duplicate
command line flags are passed.
This broke some container configurations as we have two env vars that
can be used to set --accept-dns flag:
- TS_ACCEPT_DNS- specifically for --accept-dns
- TS_EXTRA_ARGS- accepts any arbitrary 'tailscale up'/'tailscale set'
flag.

We default TS_ACCEPT_DNS to false (to make the container behaviour more
declarative), which with the new restrictive CLI behaviour resulted in
failure for users who had set --accept-dns via TS_EXTRA_ARGS as the flag would be
provided twice.

This PR re-instates the previous behaviour by checking if TS_EXTRA_ARGS
contains --accept-dns flag and if so using its value to override TS_ACCEPT_DNS.

Updates tailscale#16108


(cherry picked from commit 5b670eb)

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
@tomhjp tomhjp mentioned this pull request Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants