mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-25 19:21:18 -08:00
BLUEPRINTS: document join/leave projection display + join status
Updates the client-side notes file to cover the v2.1 CLI changes: the projection block now rendered by both `tailscale join` (after a 30s wait for the first map poll) and `tailscale leave` (snapshot captured pre-logout, rendered after), and the new `tailscale join status` inspection subcommand. Adds rows for `blueprint_render.go`, `blueprint_wait.go`, and `join_status.go` to the file inventory, and notes `cli_blueprint_join_projection_timeout` in the client metrics table. Updates #cleanup Signed-off-by: Kabir Sikand <[email protected]>
This commit is contained in:
1 parent
0e8a68fc8d
commit
5caae782cb
1 file changed
+67
-4
+67
-4
@@ -14,7 +14,10 @@ The design rationale lives in the spec.
|
||||
| `Prefs.BlueprintID` + `MaskedPrefs.BlueprintIDSet` | `ipn/prefs.go` (`IsBlueprintBound`) |
|
||||
| `tailscale join` subcommand | `cmd/tailscale/cli/join.go` |
|
||||
| `tailscale leave` subcommand | `cmd/tailscale/cli/leave.go` |
|
||||
| `tailscale join status` subcommand | `cmd/tailscale/cli/join_status.go` |
|
||||
| `tailscale set` locked-field rejection | `cmd/tailscale/cli/blueprint_lock.go` |
|
||||
| Shared projection renderer | `cmd/tailscale/cli/blueprint_render.go` |
|
||||
| Wait-for-first-projection helper | `cmd/tailscale/cli/blueprint_wait.go` |
|
||||
| Client metrics | spread across `blueprint_lock.go`, `join.go`, `leave.go` |
|
||||
|
||||
## Client metrics (clientmetric)
|
||||
@@ -26,6 +29,7 @@ labeled join-attempt metric is split into separate counters here:
|
||||
|---|---|---|
|
||||
| `cli_blueprint_join_success` | counter | `join.go` |
|
||||
| `cli_blueprint_join_failure` | counter | `join.go` (all failure paths) |
|
||||
| `cli_blueprint_join_projection_timeout` | counter | `join.go`; binding succeeded, the first-projection wait did not |
|
||||
| `cli_blueprint_leave` | counter | `leave.go` |
|
||||
| `cli_blueprint_set_rejected` | counter | `blueprint_lock.go` |
|
||||
| `cli_blueprint_bound` | gauge | 1 while bound; 0 after leave |
|
||||
@@ -53,6 +57,19 @@ tailscale join --blueprint=bp:<id> --auth-key=<oauth-secret>
|
||||
bound Blueprint's config onto `Node.BlueprintConfig`, which the
|
||||
client applies on top of `Prefs`. Edits to the ACL reconverge
|
||||
on the next poll.
|
||||
5. After kicking off the login, `join` polls `Status` for up to 30
|
||||
seconds waiting for the first map poll to deliver
|
||||
`Node.BlueprintConfig`, then prints the projection so the
|
||||
operator sees what the blueprint actually granted this node. If
|
||||
the deadline passes without a projection (`Status` was still in
|
||||
`Starting`, or the netmap arrived without `BlueprintConfig`), the
|
||||
command prints a one-liner pointing the operator at `tailscale
|
||||
join status` and exits 0. The binding itself is unaffected — only
|
||||
the display deadline lapsed — and the
|
||||
`cli_blueprint_join_projection_timeout` counter records the
|
||||
occurrence. Poll interval and timeout are package-level `var` in
|
||||
`join.go` (`joinProjectionPollInterval`,
|
||||
`joinProjectionPollTimeout`).
|
||||
|
||||
## How `tailscale leave` works
|
||||
|
||||
@@ -61,11 +78,57 @@ tailscale leave
|
||||
```
|
||||
|
||||
1. Reads current prefs.
|
||||
2. If `BlueprintID != ""`, clears it via `EditPrefs` first (so a
|
||||
crash before logout still leaves the node in a sensible state).
|
||||
3. Calls `LocalAPI.Logout`. Blueprint-bound nodes are ephemeral, so
|
||||
2. If `BlueprintID != ""`, captures a `Status` snapshot first so the
|
||||
bound `Self.BlueprintConfig` can be rendered after the logout —
|
||||
the operator sees what the node is releasing. The fetch is
|
||||
best-effort; if it fails the command falls back to the short
|
||||
`Detached from blueprint bp:<id> and logged out.` message.
|
||||
3. Clears `BlueprintID` via `EditPrefs` (so a crash before logout
|
||||
still leaves the node in a sensible state).
|
||||
4. Calls `LocalAPI.Logout`. Blueprint-bound nodes are ephemeral, so
|
||||
the control plane reaps the registration.
|
||||
4. Bumps `cli_blueprint_leave`, sets `cli_blueprint_bound` to 0.
|
||||
5. Bumps `cli_blueprint_leave`, sets `cli_blueprint_bound` to 0,
|
||||
prints the released projection.
|
||||
|
||||
## How `tailscale join status` works
|
||||
|
||||
```
|
||||
tailscale join status [--json]
|
||||
```
|
||||
|
||||
A read-only inspection subcommand under `joinCmd`. Fetches `Status`
|
||||
once, then renders:
|
||||
|
||||
1. The local node's projected `BlueprintConfig` via the shared
|
||||
`renderBlueprintConfig` formatter (same output as `join` and
|
||||
`leave`). If the projection has not yet arrived, the renderer
|
||||
prints a `(projection not yet received)` line and the command
|
||||
still exits 0 — `Self.BlueprintID` from prefs is enough to know
|
||||
the binding is real.
|
||||
2. The set of peers visible to this node bound to the same
|
||||
blueprint. `PeerStatus.BlueprintID` (populated from
|
||||
`tailcfg.Node.BlueprintID` in `peerStatusFromNode`) is the
|
||||
filter. The list is sorted by hostname; each row is
|
||||
`hostname <tab> tailscale-ip`. If zero peers are visible the
|
||||
command prints `No other peers bound to bp:<id> are visible to
|
||||
this node.` — the "visible" hedge is deliberate (the netmap
|
||||
reflects ACL visibility, not ground truth).
|
||||
|
||||
If the node is not blueprint-bound, the command writes
|
||||
`this node is not blueprint-bound; ...` to **stderr** and exits 1.
|
||||
Daemon-connect errors flow through `fixTailscaledConnectError` like
|
||||
every other read-only CLI command.
|
||||
|
||||
`--json` emits a small `joinStatusJSON` envelope with
|
||||
`BlueprintID`, `BlueprintConfig`, and a `BoundPeers` array of
|
||||
`{HostName, TailscaleIPs}` entries. The shape mirrors `tailscale
|
||||
status --json`'s "format may change between releases" contract.
|
||||
|
||||
`PeerStatus` gained two fields for this feature: `BlueprintID`
|
||||
(populated for both Self and peers, used for filtering) and
|
||||
`BlueprintConfig` (populated only on Self, deliberately filtered
|
||||
out of the peer iteration path even if a peer's `Node` record
|
||||
carries it).
|
||||
|
||||
## How the locked-field rejection works
|
||||
|
||||
|
||||
Reference in new issue
Block a user