A golden path is the supported, easiest way to do a common thing: create a service, get a database, ship to production. Backstage gives developers the front of it, a software catalog of every service and its owner, and templates that create a repository, a pipeline, and the catalog entry in one form. Crossplane gives it the back: a platform API, defined as Kubernetes resources, where a developer asks for "a medium Postgres database" and a Composition turns that into the cloud resources, wired and secured the way the platform team decided. This lesson follows one request for a new service with a database, from the template to the connection secret, and shows the guardrails that reject a bad request and the rename that can delete a database.
Difficulty: Advanced · Know this first: Lesson 164, Lesson 101, Lesson 137
This bar splits one self-service request, in minutes. It is a worked example, not a measurement. Without a golden path the same request is often a ticket that waits days; here the longest part is the cloud provisioning the database.
Set how many services or databases teams request a month, how long the old ticket process takes, and how many requests go through the golden path.
average wait = adoption × 32 min + (1 − adoption) × ticket days × 8 h · wait saved per month = requests × (ticket wait − average wait)
Most requests take minutes instead of days
Three questions. No score is saved anywhere — this is just you against the material.
Self-service grows in four levels: first the catalog and golden paths, then templates and a first platform API, then Compositions, policies, and day-2 changes, and finally running a platform as a product.
At the basic level you know the pieces. The software catalog lists every service with its owner, system, and links (catalog-info.yaml in each repository). A golden path is the supported way to do a common task. Backstage templates create a new service along the golden path. Crossplane lets the platform offer infrastructure as Kubernetes APIs.
Terms: Component, System, owner, scaffolder, TechDocs, XRD, Composition, claim, managed resource, provider.
Where it breaks: a catalog nobody updates; generate entries from templates and check them in CI.
Try it: Basic
Where does a service's Backstage catalog entry usually live?
Now do it: Write a catalog-info.yaml for a service you own: name, owner, lifecycle, system, and one link.
At the intermediate level you build one golden path end to end.
scaffolder.backstage.io/v1beta3) with parameters and steps: fetch a skeleton, publish a repository, register it in the catalog, open a pull request for the claim.Troubleshooting: crossplane beta trace shows every composed resource and the first one that is not Ready.
Try it: Intermediate
A claim stays not Ready. How do you find which cloud resource is the problem?
Now do it: Run compose_claim.py in Go deeper and add a "region must be eu-west-1 for team payments" rule.
At the advanced level you design for change and for mistakes.
Try it: Advanced
The platform team changes the Composition for databases. How do they avoid changing every existing database at once?
Now do it: For one Composition you might write, list which fields a change could alter on existing resources, and which of those cause replacement.
At the master level the platform is a product with users.
Trade-off: a narrow, opinionated API is safe and easy and will not fit every team; a wide one fits everyone and gives back the complexity the platform was built to hide.
Try it: Master
Only 25 percent of new services use the golden path. What do you do first?
Now do it: List the five most common requests your platform team receives, and how long each takes today.
A platform API checks a small request against the platform's rules and fills in everything else. This script does that for a database claim, rejects one that breaks the rules, and shows what a rename does under each deletion policy. Standard library only; python3 compose_claim.py.
# compose_claim.py - a platform API: a small request becomes cloud resources, inside guardrails
SIZES = {"small": ("db.t4g.medium", 50), "medium": ("db.r6g.large", 200), "large": ("db.r6g.2xlarge", 500)}
REGIONS = {"eu-west-1", "us-east-1"}
def compose(claim):
"""What a Composition does: check the request against the platform's rules, then fill in everything else."""
errors = []
if claim["size"] not in SIZES:
errors.append(f"size {claim['size']!r} is not one of {sorted(SIZES)}")
if claim["region"] not in REGIONS:
errors.append(f"region {claim['region']!r} is not approved")
if errors:
return None, errors
cls, gb = SIZES[claim["size"]]
name = f"{claim['team']}-{claim['name']}"
return [
f"rds.aws/Instance {name}: {cls}, {gb} GB gp3, encrypted, backups 14 days, deletionPolicy {claim.get('deletionPolicy', 'Orphan')}",
f"rds.aws/SubnetGroup {name}: private subnets of the {claim['region']} platform VPC",
f"ec2.aws/SecurityGroup {name}: 5432 from the team's namespace only",
f"Secret {claim['name']}-conn in namespace {claim['team']}: host, port, username, password",
], []
for claim in [
{"team": "payments", "name": "ledger", "size": "medium", "region": "eu-west-1"},
{"team": "payments", "name": "ledger", "size": "db.r6g.8xlarge", "region": "ap-south-2"},
]:
resources, errors = compose(claim)
print(f"claim {claim['name']} size={claim['size']} region={claim['region']}:")
for line in resources or [f"REJECTED: {e}" for e in errors]:
print(" ", line)
# Renaming a claim in Git is a delete and a create. What happens to the old database depends on its policy.
for policy in ("Delete", "Orphan"):
fate = "deleted with its data" if policy == "Delete" else "kept in the cloud, no longer managed; adopt it into the new claim"
print(f"rename with deletionPolicy {policy}: the old database is {fate}")
$ python3 compose_claim.py claim ledger size=medium region=eu-west-1: rds.aws/Instance payments-ledger: db.r6g.large, 200 GB gp3, encrypted, backups 14 days, deletionPolicy Orphan rds.aws/SubnetGroup payments-ledger: private subnets of the eu-west-1 platform VPC ec2.aws/SecurityGroup payments-ledger: 5432 from the team's namespace only Secret ledger-conn in namespace payments: host, port, username, password claim ledger size=db.r6g.8xlarge region=ap-south-2: REJECTED: size 'db.r6g.8xlarge' is not one of ['large', 'medium', 'small'] REJECTED: region 'ap-south-2' is not approved rename with deletionPolicy Delete: the old database is deleted with its data rename with deletionPolicy Orphan: the old database is kept in the cloud, no longer managed; adopt it into the new claim
Read it like this: four words of intent (team, name, size, region) become four wired, encrypted, private resources; a request outside the rules is rejected with both reasons; and a rename with deletionPolicy Delete takes the data with it.
apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
name: xpostgresqlinstances.platform.example.com
spec:
group: platform.example.com
names:
kind: XPostgreSQLInstance
plural: xpostgresqlinstances
claimNames:
kind: PostgreSQLInstance
plural: postgresqlinstances
connectionSecretKeys: ["host", "port", "username", "password"]
versions:
- name: v1alpha1
served: true
referenceable: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
required: ["size", "region"]
properties:
size:
type: string
enum: ["small", "medium", "large"]
region:
type: string
enum: ["eu-west-1", "us-east-1"]
---
apiVersion: platform.example.com/v1alpha1
kind: PostgreSQLInstance
metadata:
name: ledger
namespace: payments
spec:
size: medium
region: eu-west-1
writeConnectionSecretToRef:
name: ledger-conn
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
name: service-with-postgres
title: Service with Postgres
spec:
owner: group:platform
type: service
parameters:
- title: Service
required: [name, owner, size]
properties:
name: {type: string, pattern: "^[a-z][a-z0-9-]{2,30}$"}
owner: {type: string, ui:field: OwnerPicker}
size: {type: string, enum: [small, medium, large], default: small}
steps:
- id: fetch
action: fetch:template
input:
url: ./skeleton
values: {name: "${{ parameters.name }}", owner: "${{ parameters.owner }}"}
- id: publish
action: publish:github
input:
repoUrl: github.com?owner=example-org&repo=${{ parameters.name }}
- id: register
action: catalog:register
input:
repoContentsUrl: ${{ steps.publish.output.repoContentsUrl }}
catalogInfoPath: /catalog-info.yaml
The manifests parse as YAML and follow Crossplane's v1 XRD format and Backstage's scaffolder.backstage.io/v1beta3 template format; the Composition that implements the XRD depends on the provider and functions you install, so it is not shown here. A further template step usually opens the pull request with the claim in the infrastructure repository. Try both in a test Backstage instance and a kind cluster with Crossplane before publishing them to teams.
This is a composite of a failure pattern that keeps repeating; the details are illustrative. A platform offered databases through Crossplane claims, with the default deletionPolicy of Delete.
Stateful managed resources default to deletionPolicy Orphan, compositions take a final snapshot on deletion, and a Conftest rule in every infrastructure repository fails any pull request that deletes or renames a stateful claim unless it carries an explicit approval label. The platform still lets teams delete databases; it no longer lets them do it by accident.
Design self-service for 30 product teams who today file tickets for new services, databases, queues, and DNS names, and wait about a week each time.
Which requests are most common, and which take longest? Which settings must the platform decide, and which may teams choose? What compliance rules apply to data stores? Who reviews infrastructure pull requests? How will you measure whether teams use it?
Say 60 requests a month, 70 percent of them for a new service with a Postgres database, two cloud regions, and a platform team of five.
Backstage with a catalog generated from templates and a "service with Postgres" golden path; a Crossplane XRD for databases with size and region enums, Compositions per environment with encryption, backups, private networking, deletionPolicy Orphan and a final snapshot; claims in team repositories applied by Argo CD; Conftest and schema checks in CI; connection secrets in team namespaces; adoption, lead time, and ticket volume on a dashboard, reviewed monthly with teams.
An opinionated golden path makes the common case fast and safe and leaves uncommon needs on tickets or escape hatches. Crossplane gives one Kubernetes-native API and continuous reconciliation, and becomes critical infrastructure with broad cloud credentials. Strict policy checks prevent accidents and must stay quick and well explained, or teams route around them.