Install the plugins
About 424 words
You need a Backstage app that uses the new backend system and the new frontend system. The packages are developed against Backstage 1.57; they depend on @backstage/backend-plugin-api 1.12 or later, @backstage/plugin-catalog-node 3 and @backstage/plugin-catalog-react 4.
The backend
Add the backend plugin and the catalog module to your backend package:
yarn --cwd packages/backend add \
@spechtlabs/backstage-plugin-tailscale-backend \
@spechtlabs/backstage-plugin-catalog-backend-module-tailscaleThen register both in packages/backend/src/index.ts:
// packages/backend/src/index.ts
backend.add(import('@spechtlabs/backstage-plugin-tailscale-backend'));
backend.add(
import('@spechtlabs/backstage-plugin-catalog-backend-module-tailscale'),
);The catalog module teaches the catalog kind: Tailscale. Without it the catalog rejects every Tailscale entity as an unknown kind. The backend plugin needs the catalog: it reads Tailscale entities, Groups, Users, Components, APIs and kubernetes-cluster Resources through the catalog service.
The frontend
Add the frontend plugin to your app package:
yarn --cwd packages/app add @spechtlabs/backstage-plugin-tailscaleWith feature discovery (app.packages: all in app-config.yaml) there is nothing else to do. Otherwise add the plugin to your app's features:
// packages/app/src/App.tsx
import { createApp } from '@backstage/frontend-defaults';
import tailscalePlugin from '@spechtlabs/backstage-plugin-tailscale';
const app = createApp({
features: [
// ...your other features
tailscalePlugin,
],
});This adds a Tailscale page at /tailscale, a Policy tab on policy entities and two entity cards. Frontend extensions lists them with their extension IDs, in case you want to turn one off.
Allow the kind from one location
A tailnet policy decides who reaches what, so don't let kind: Tailscale come from just anywhere. Register the directory that holds your policy as a location of its own, and allow the kind for that location only:
# app-config.yaml
catalog:
locations:
- type: url
target: https://github.com/acme/network/blob/main/tailscale/policy/*.yaml
rules:
- allow: [Tailscale]Restrict where policies come from explains why this matters and what else to check.
Publishing (later)
Backstage only writes a policy file to a repository that tailscale.allowedRepos lists. You can leave it out for now: policies render and show without it.
# app-config.yaml
tailscale:
allowedRepos:
- acme/networkPublish to GitHub covers the rest.
Check that it runs
Start Backstage and open /tailscale. With no policy in the catalog yet, the page says:
No Tailscale policy in the catalog yet. Add an entity of kind Tailscale with spec.type: policy.That's the cue for your first policy.
