mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-25 19:21:18 -08:00
Paired OSS side for the corp v1.1 "blueprint prefs" work. Three
changes:
1. tailcfg.BlueprintConfig grows a Prefs []string field. The wire
format intentionally uses strings rather than a typed bool
struct so the control plane can add new supported prefs
without a capver bump on the client; unrecognized entries are
ignored by older clients. Clone, view, and Equal hand-edited
to keep the regen sentinels green (corp pin makes go generate
awkward; follows the prior commits' pattern).
2. ipn/ipnlocal grows reconcileBlueprintPrefsLocked, called from
setNetMapLocked right after the existing routes reconcile.
For each entry in a small per-pref table (id, getter, setter,
metric) the loop forces the matching ipn.Prefs bool to true
when the pref appears in BlueprintConfig.Prefs and to false
when it does not. Silence equals OFF: the blueprint is the
source of truth and overrides any pre-existing local setting
on every netmap apply. Persists only when something actually
flipped. One clientmetric counter per pref bumps each time
the reconcile turns the field ON.
Supported prefs in this revision:
pref:accept-dns -> Prefs.CorpDNS
pref:accept-routes -> Prefs.RouteAll
pref:ssh -> Prefs.RunSSH
pref:shields-up -> Prefs.ShieldsUp
pref:webclient -> Prefs.RunWebClient
Unknown pref ids in the projection are ignored silently
(forward-compat: a newer control plane may reference a pref
this client does not yet implement).
3. cmd/tailscale/cli/blueprint_lock.go extends the locked-field
list to reject `tailscale set --accept-routes`,
`--shields-up`, and `--webclient` on blueprint-bound nodes
with the same v1 error template. --accept-dns and --ssh were
already locked.
Tests added:
- ipn/ipnlocal/blueprint_prefs_test.go exercises the reconcile
function across the matrix of all-on, partial, silence-equals-off
(overrides prior local), unknown-pref-ignored, and the no-op
paths for unbound nodes and nil netmaps.
- cmd/tailscale/cli/blueprint_lock_test.go gains rows for each
new locked field.
Updates #cleanup
Signed-off-by: Kabir Sikand <[email protected]>