Skip to content

Add forbidden node name renamer CronJob#30

Open
kervel wants to merge 2 commits intomainfrom
feature/forbidden-node-names
Open

Add forbidden node name renamer CronJob#30
kervel wants to merge 2 commits intomainfrom
feature/forbidden-node-names

Conversation

@kervel
Copy link
Copy Markdown
Contributor

@kervel kervel commented Mar 6, 2026

Summary

  • Adds an opt-in CronJob (forbiddenNodeNames.enabled: true) that periodically renames nodes registered with forbidden hostnames (default: localhost)
  • Android Tailscale clients default to hostname "localhost", which breaks DNS when search domains like search .kpv.vpn are in play — localhost resolves to the Android device's tailnet IP instead of 127.0.0.1
  • Renamed nodes get <original-name>-<node-id> (e.g. localhost-12345) — unique and preserves origin for debugging
  • Independent RBAC — works regardless of whether the in-cluster client is enabled

Configuration

forbiddenNodeNames:
  enabled: true
  schedule: "*/15 * * * *"
  names:
    - localhost

Test plan

  • helm template with forbiddenNodeNames.enabled=false (default) produces no forbidden-names resources
  • helm template with forbiddenNodeNames.enabled=true renders CronJob, ConfigMap, ServiceAccount, Role, RoleBinding
  • Deploy and register an Android client — verify it gets renamed within the schedule interval
  • Verify adding custom names to the list works (e.g. names: [localhost, android])

🤖 Generated with Claude Code

kervel and others added 2 commits March 6, 2026 09:28
Android Tailscale clients register with hostname "localhost", which
breaks DNS resolution when machines have search domains (e.g.
search .kpv.vpn) causing localhost to resolve to the Android device's
tailnet IP instead of 127.0.0.1.

Adds an opt-in CronJob that periodically checks for nodes with
forbidden hostnames and renames them to <name>-<node-id> (e.g.
localhost-12345). Includes independent RBAC (works without the
in-cluster client enabled).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This is a workaround that will be removed once Headscale gains native
support for rejecting or renaming nodes with forbidden hostnames.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant