Install the plugins
About 436 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-cilium-backend \
@spechtlabs/backstage-plugin-catalog-backend-module-ciliumThen register both in packages/backend/src/index.ts:
// packages/backend/src/index.ts
backend.add(import('@spechtlabs/backstage-plugin-cilium-backend'));
backend.add(
import('@spechtlabs/backstage-plugin-catalog-backend-module-cilium'),
);The catalog module teaches the catalog kind: Cilium. Without it the catalog rejects every Cilium entity as an unknown kind. The backend plugin needs the catalog: it reads Cilium entities, Components, APIs and Resources through the catalog service.
The frontend
Add the frontend plugin to your app package:
yarn --cwd packages/app add @spechtlabs/backstage-plugin-ciliumWith 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 ciliumPlugin from '@spechtlabs/backstage-plugin-cilium';
const app = createApp({
features: [
// ...your other features
ciliumPlugin,
],
});This adds a Network policy page at /cilium, a Network 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 network policy decides what reaches what, so don't let kind: Cilium 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/k8s-deployment/blob/main/cilium/policy/*.yaml
rules:
- allow: [Cilium]Restrict where policies come from explains why this matters and what else to check.
Publishing (later)
Backstage only writes manifests to a repository that cilium.allowedRepos lists. You can leave it out for now: policies render and show without it.
# app-config.yaml
cilium:
allowedRepos:
- acme/k8s-deploymentPublish to GitHub covers the rest.
Check that it runs
Start Backstage and open /cilium. With no policy in the catalog yet, the page says:
No Cilium policy in the catalog yet. A policy is an entity of kind Cilium, with spec.type policy and the cluster it is for:followed by an example policy entity. That's the cue for your first policy.
