Skip to content

Tailscale for BackstageYour tailnet policy, kept in the software catalog

Grants come from what the catalog already knows, such as which Component consumes which API and where that API is reached. Everything else comes from kind Tailscale entities. Backstage renders the policy file, shows who reaches what, and keeps a pull request open with it.

What the plugins do

Four npm packages for the new backend and frontend systems of Backstage.

A hand-edited policy file vs. the catalog

The same tailnet, kept two ways.

One big HuJSON file

Edited by hand, reviewed as text

  • •
    Grants drift from reality
    A service changes its port or its consumers, and nobody updates the file
  • •
    Group members are copied
    Membership is kept twice: in the identity provider or catalog, and in the policy
  • •
    No owner per rule
    Nobody knows who a grant is for or who may remove it
  • •
    Devices reached directly
    Grants to tags pile up, with no record of why they aren't Services

Tailscale for Backstage

Rendered from entities, reviewed as a pull request

  • •
    Grants follow the catalog
    Consumption and the API's annotations make the grant
  • •
    Groups come from the catalog
    The Group's Users are the tailnet group's members
  • •
    Every rule has an owner
    Each entity has spec.owner and shows up on the owner's pages
  • •
    Devices need a reason
    A tag reached as a device without a reason is a warning in the console

A grant, start to finish

An API says where it is reached. A Component that consumes it says which tag its traffic comes from. Backstage writes the grant.

  1. Annotate the API and the consuming Component

    apiVersion: backstage.io/v1alpha1
    kind: API
    metadata:
      name: payments-api
      annotations:
        specht-labs.de/tailnet-dst: svc:payments
        specht-labs.de/tailnet-ports: tcp:443
    spec:
      type: openapi
      lifecycle: production
      owner: group:platform
      definition: '{}'
    ---
    apiVersion: backstage.io/v1alpha1
    kind: Component
    metadata:
      name: reporting
      annotations:
        specht-labs.de/tailnet-src: tag:reporting
    spec:
      type: service
      lifecycle: production
      owner: group:platform
      consumesApis: [payments-api]
  2. Turn on catalog grants in the policy entity

    apiVersion: specht-labs.de/v1alpha1
    kind: Tailscale
    metadata:
      name: my-tailnet
    spec:
      type: policy
      owner: group:platform
      tailnet: example.ts.net
      catalogGrants: true
  3. Backstage renders the grant into the policy file

    "grants": [
    	// From the catalog: payments-api
    	// Consumed by reporting.
    	{
    		"src": ["tag:reporting"],
    		"dst": ["svc:payments"],
    		"ip":  ["tcp:443"],
    	},
    ],

Your first policy builds a complete policy from scratch, and Grants from the catalog covers the annotations in full.

Not affiliated with Tailscale Inc.

This is a community plugin by SpechtLabs. It is not made, endorsed or supported by Tailscale Inc. "Tailscale" is a trademark of Tailscale Inc.

Releases

Contributors

Your contributions matter. Here's to everyone who's helped bring this to life.