Skip to content
devops/architect
16 platform-engineering 01 01 platform engineering & idp
0/7 read · lab 0/1
INTERNAL DEVELOPER PLATFORM
16 / 19 • PLATFORM ENGINEERING

Platform Engineering & IDP

The Senior DevOps Engineer of 2026 is a Platform Engineer. Build Internal Developer Platforms that abstract cloud complexity so 200 developers can self-serve. Master Backstage catalog, Crossplane XRDs for database-as-a-service, golden-path scaffolding, and DORA metrics dashboards. Reduce Mean Time to Onboard from 2 weeks to 2 hours.

Backstage Catalog Crossplane XRDs Golden Paths + DORA

Lesson objective

What it teaches
IDP Architecture · Backstage: Software Catalog & Golden Paths · Crossplane: Database-as-a-Service · DORA Metrics Dashboard · Hands-On Labs · Troubleshooting · Predict the Result: A Golden-Path Guardrail in CI
Why it matters
A required lesson for Platform Engineer, DevOps / Platform Architect. See the role paths
What you demonstrate
  • Simulated lab: Create new Backstage app. Recorded as lab evidence.
  • Predict 3 results this lesson prints. You mark each one yourself.
  • Optional, real environment: 6 hands-on tasks on your own machine or an external lab site (checklist). Not tracked as evidence.
  1. Orient
  2. Read
  3. Predict
  4. Run
  5. Verify
  6. Reflect
  7. Continue

 The Problem: Developer Toil at Scale

Before Platform Engineering at a 300-person engineering org:

  • New developer onboarding: 2–3 weeks of ticket-driven infra setup
  • Creating a new microservice: 5 Jira tickets to DevOps team (ECR repo, IAM role, K8s namespace, Vault path, DNS entry)
  • DevOps team: 70% of time on toil, 30% on actual platform work
  • Shadow IT: devs spinning up EC2s directly to avoid the process

After IDP with Backstage + Crossplane: New service scaffold = 1 PR merge → 15 minutes → everything provisioned.

IDP Architecture 16.1

graph TD subgraph "Developer Experience" Dev[Developer] CLI[Backstage CLI / UI] PR[GitHub PR] end subgraph "IDP Control Plane" Backstage[Backstage
Portal + Catalog + TechDocs] Templates[Software Templates
Golden Paths] ArgoCD[ArgoCD
GitOps Controller] end subgraph "Infrastructure Plane" Crossplane[Crossplane
XRDs for Cloud Resources] TFC[Terraform Cloud
Complex IaC Modules] Vault[HashiCorp Vault
Dynamic Secrets] end subgraph "Cloud Resources" RDS[RDS PostgreSQL] S3[S3 Buckets] ECR[ECR Registry] NS[K8s Namespace + RBAC] end Dev -->|creates service| CLI CLI -->|scaffold template| Templates Templates -->|opens PR| PR PR -->|merge triggers| ArgoCD ArgoCD -->|reconciles| Crossplane Crossplane --> RDS Crossplane --> S3 Crossplane --> NS Backstage -->|reads catalog| ArgoCD

Backstage: Software Catalog & Golden Paths 16.2

Backstage is Spotify's open-source IDP that became the industry standard. It provides: (1) a Software Catalog — every service, API, team, and resource in one searchable UI; (2) Software Templates — interactive scaffolding wizards for developers; (3) TechDocs — docs-as-code rendered from markdown in Git.

catalog-info.yaml (every repo has this)
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: payments-api
  description: Payment processing microservice
  annotations:
    # Link to GitHub repo, Datadog dashboard, PagerDuty service
    github.com/project-slug: acme-corp/payments-api
    pagerduty.com/integration-key: abc123def456
    grafana/dashboard-url: https://grafana.acme.com/d/payments
    backstage.io/techdocs-ref: dir:.
  labels:
    language: python
    domain: payments
    tier: critical
  tags:
    - python
    - fastapi
    - kafka
    - postgresql
spec:
  type: service
  lifecycle: production
  owner: group:payments-team
  system: payment-platform
  dependsOn:
    - resource:postgres-payments-db
    - component:notification-service
  providesApis:
    - payments-v2-openapi
---
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
  name: postgres-payments-db
  description: PostgreSQL RDS for payments service
  annotations:
    aws.amazon.com/arn: arn:aws:rds:us-east-1:123456:db:payments-prod
spec:
  type: database
  owner: group:platform-team
  system: payment-platform
template.yaml (golden path: new microservice)
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: python-fastapi-service
  title: Python FastAPI Microservice
  description: Creates a production-ready FastAPI service with CI/CD, monitoring, and DB
  tags: [python, fastapi, recommended]
spec:
  owner: group:platform-team
  type: service

  parameters:
    - title: Service Details
      required: [serviceName, description, owner]
      properties:
        serviceName:
          type: string
          pattern: '^[a-z][a-z0-9-]{2,30}$'
          description: Lowercase, hyphens only (e.g. order-processor)
        description:
          type: string
        owner:
          type: string
          ui:field: OwnerPicker

    - title: Infrastructure
      properties:
        needsDatabase:
          type: boolean
          default: false
          title: PostgreSQL Database?
        dbSize:
          type: string
          enum: [db.t3.micro, db.t3.small, db.m5.large]
          default: db.t3.micro
          ui:widget: radio
          ui:options:
            enumNames: ['Micro (dev/staging)', 'Small (SME prod)', 'Large (enterprise prod)']
        needsKafka:
          type: boolean
          default: false
          title: Kafka Topics?

  steps:
    - id: fetch-template
      name: Fetch Base Template
      action: fetch:template
      input:
        url: ./skeleton
        values:
          serviceName: ${{ parameters.serviceName }}
          owner: ${{ parameters.owner }}

    - id: create-github-repo
      name: Create GitHub Repository
      action: github:repo:create
      input:
        repoUrl: github.com?owner=acme-corp&repo=${{ parameters.serviceName }}

    - id: provision-infrastructure
      name: Provision Cloud Infrastructure
      action: http:backstage:request
      input:
        method: POST
        path: /api/proxy/crossplane
        body:
          serviceName: ${{ parameters.serviceName }}
          needsDatabase: ${{ parameters.needsDatabase }}
          dbSize: ${{ parameters.dbSize }}

    - id: register-catalog
      name: Register in Catalog
      action: catalog:register
      input:
        repoContentsUrl: ${{ steps['create-github-repo'].output.repoContentsUrl }}

  output:
    links:
      - title: GitHub Repository
        url: ${{ steps['create-github-repo'].output.remoteUrl }}
      - title: Backstage Catalog Entry
        icon: catalog
        entityRef: ${{ steps['register-catalog'].output.entityRef }}
mkdocs.yml (TechDocs)
site_name: 'Payments API'
site_description: 'Technical documentation for the payments service'

plugins:
  - techdocs-core

nav:
  - Home: index.md
  - Architecture:
    - Overview: architecture/overview.md
    - Data Flow: architecture/data-flow.md
    - Dependencies: architecture/dependencies.md
  - Runbooks:
    - On-Call Guide: runbooks/on-call.md
    - Database Recovery: runbooks/db-recovery.md
    - Rollback Procedure: runbooks/rollback.md
  - API Reference: api.md
  - ADRs:
    - ADR-001 Chose FastAPI: adrs/001-fastapi.md
    - ADR-002 Chose PostgreSQL: adrs/002-postgresql.md
# Create new Backstage app
$ npx @backstage/create-app@latest --skip-install
$ cd my-backstage-app && yarn install

# Configure GitHub auth in app-config.yaml
$ cat > app-config.local.yaml << 'EOF'
auth:
  providers:
    github:
      development:
        clientId: ${GITHUB_CLIENT_ID}
        clientSecret: ${GITHUB_CLIENT_SECRET}
integrations:
  github:
    - host: github.com
      token: ${GITHUB_TOKEN}
catalog:
  locations:
    - type: github-org
      target: https://github.com/acme-corp
EOF

# Start dev server
$ yarn dev
app started at http://localhost:3000
backend started at http://localhost:7007

Crossplane: Database-as-a-Service 16.3

Crossplane extends Kubernetes with Composite Resource Definitions (XRDs) — platform teams define abstract APIs (e.g., "I want a PostgreSQL database") and Crossplane provisions the actual cloud resources. Developers never touch AWS console.

xrd-postgresql.yaml (platform team writes this once)
# Platform team defines the abstract API
apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
  name: xpostgresqlinstances.database.acme.io
spec:
  group: database.acme.io
  names:
    kind: XPostgreSQLInstance
    plural: xpostgresqlinstances
  claimNames:
    kind: PostgreSQLInstance     # What developers use
    plural: postgresqlinstances
  versions:
    - name: v1alpha1
      served: true
      referenceable: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              required: [parameters]
              properties:
                parameters:
                  type: object
                  required: [size, team]
                  properties:
                    size:
                      type: string
                      enum: [small, medium, large]
                      description: "small=t3.micro, medium=m5.large, large=m5.2xlarge"
                    team:
                      type: string
                      description: "Team name for cost tagging"
                    version:
                      type: string
                      default: "15.4"
                    multiAZ:
                      type: boolean
                      default: false
composition-rds.yaml (platform team writes this once)
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
  name: postgresql-aws
spec:
  compositeTypeRef:
    apiVersion: database.acme.io/v1alpha1
    kind: XPostgreSQLInstance
  resources:
    - name: rds-instance
      base:
        apiVersion: rds.aws.upbound.io/v1beta1
        kind: Instance
        spec:
          forProvider:
            region: us-east-1
            engine: postgres
            autoMinorVersionUpgrade: true
            backupRetentionPeriod: 7
            storageEncrypted: true
            deletionProtection: true
            vpcSecurityGroupIdSelector:
              matchLabels:
                usage: rds
      patches:
        # Map size enum to actual instance type
        - type: CombineFromComposite
          combine:
            variables:
              - fromFieldPath: spec.parameters.size
            strategy: string
            string:
              fmt: |
                %[1]s
          transforms:
            - type: map
              map:
                small: db.t3.micro
                medium: db.m5.large
                large: db.m5.2xlarge
          toFieldPath: spec.forProvider.instanceClass
        - fromFieldPath: spec.parameters.version
          toFieldPath: spec.forProvider.engineVersion
        - fromFieldPath: spec.parameters.multiAZ
          toFieldPath: spec.forProvider.multiAZ
        - fromFieldPath: spec.parameters.team
          toFieldPath: spec.forProvider.tags.Team

    - name: rds-password-secret
      base:
        apiVersion: secretsmanager.aws.upbound.io/v1beta1
        kind: Secret
        spec:
          forProvider:
            region: us-east-1
            recoveryWindowInDays: 7
my-db-claim.yaml (developer writes this — no AWS knowledge needed)
# Developer just asks for a "PostgreSQL database"
# No knowledge of RDS, VPCs, subnets, security groups needed
apiVersion: database.acme.io/v1alpha1
kind: PostgreSQLInstance
metadata:
  name: payments-db
  namespace: payments-team    # Lives in their own namespace
spec:
  parameters:
    size: medium              # Platform team decided what "medium" means
    team: payments
    version: "15.4"
    multiAZ: true
  writeConnectionSecretToRef:
    name: payments-db-creds   # K8s Secret with host/user/password
---
# Developer then uses the connection secret in their Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: payments-api
spec:
  template:
    spec:
      containers:
        - name: payments-api
          envFrom:
            - secretRef:
                name: payments-db-creds   # Auto-populated by Crossplane

DORA Metrics Dashboard 16.4

Elite Performer Targets

MetricEliteHigh
Deployment Frequency>1/day1/week
Lead Time for Changes<1 hour<1 week
MTTR<1 hour<1 day
Change Failure Rate<5%<10%

Collecting DORA via GitHub API

# Deployment frequency from GitHub deployments
gh api repos/acme-corp/payments-api/deployments \
  --paginate \
  --jq '[.[] | select(.environment=="production")] | length'

# Lead time: PR merge → deployment
gh api repos/acme-corp/payments-api/pulls \
  --paginate \
  --jq '.[] | {
    number: .number,
    merged: .merged_at,
    created: .created_at
  }'

Hands-On Labs 16.5

Platform Engineering Labs

  • Bootstrap Backstage locally with yarn, add GitHub integration, register 3 catalog entries
  • Create a Software Template that scaffolds a Python service repo with CI/CD workflow
  • Install Crossplane on kind, install AWS provider, create an XRD for S3 buckets
  • Write a Crossplane Composition that provisions a K8s Namespace + RBAC + ResourceQuota as a bundle
  • Build a DORA metrics script pulling deployment frequency from GitHub API over 30 days
  • Set up TechDocs for a sample service — write runbook, architecture doc, and ADR pages

Troubleshooting 16.6

Crossplane claim stuck in "Waiting" state

Check kubectl describe compositepgresqlinstance payments-db for events. Common causes: AWS provider credentials not configured (kubectl describe providerconfig aws), Composition not matching the XR's compositeTypeRef, or IRSA role missing required IAM permissions.

Backstage catalog not discovering repos

Check GitHub token scopes — needs repo and read:org. Verify catalog-info.yaml exists at repo root. Check Backstage backend logs for processor errors. Ensure the file is valid YAML with correct apiVersion.

Golden path template action fails

Scaffolder actions run in Backstage backend. Check backend logs. github:repo:create needs a GitHub app or PAT with repo creation permission. Use the Backstage dry-run mode (--dry-run) to test templates locally.

Predict the Result: A Golden-Path Guardrail in CI 16.7

Recorded from a real run of scripts/recordings/platform-engineering.sh; every output below is pasted from scripts/recordings/platform-engineering.out. Cover the output, predict it, then compare.

Environment: openpolicyagent/conftest:v0.62.0 container. The claims follow the PostgreSQLInstance API from this lesson's Crossplane section; the policy is what a platform team runs in CI before a claim reaches the cluster.

sizes.rego
package main

import rego.v1

# The platform team publishes three sizes; anything else never reaches the cloud API.
allowed_sizes := {"small", "medium", "large"}

deny contains msg if {
	input.kind == "PostgreSQLInstance"
	not allowed_sizes[input.spec.parameters.size]
	msg := sprintf("%s: size %q is not offered; use small, medium or large", [input.metadata.name, input.spec.parameters.size])
}

deny contains msg if {
	input.kind == "PostgreSQLInstance"
	not input.spec.parameters.team
	msg := sprintf("%s: spec.parameters.team is required for cost allocation", [input.metadata.name])
}
reports-db.yaml
apiVersion: database.acme.io/v1alpha1
kind: PostgreSQLInstance
metadata:
  name: reports-db
  namespace: analytics-team
spec:
  parameters:
    size: xlarge
    version: "15.4"
  writeConnectionSecretToRef:
    name: reports-db-creds
recorded run
# The payments claim: size medium, team set
$ conftest test payments-db.yaml

2 tests, 2 passed, 0 warnings, 0 failures, 0 exceptions

# The reports claim above
$ conftest test reports-db.yaml; echo "exit=$?"
FAIL - reports-db.yaml - main - reports-db: size "xlarge" is not offered; use small, medium or large
FAIL - reports-db.yaml - main - reports-db: spec.parameters.team is required for cost allocation

2 tests, 0 passed, 0 warnings, 2 failures, 0 exceptions
exit=1

Each deny rule that matches prints one FAIL line with a message that tells the developer what to change, and a non-zero exit fails the pipeline. A guardrail that only says "denied" sends people to the platform team's queue instead.

ARCHITECTURE TRADE-OFFS

Crossplane vs Terraform Cloud: Operational Ownership & Rollback Trade-offs

Platform architects must choose between Kubernetes-native control loops and VCS-driven infrastructure pipelines. According to Crossplane Architectural Concepts and Terraform Cloud Architecture Guide:

iac-decision-matrix.md (Control Plane vs CI/CD Pipeline)
| Architecture Dimension     | Crossplane (K8s Control Plane)              | Terraform Cloud / Enterprise (VCS Pipeline)   |
|----------------------------|---------------------------------------------|-----------------------------------------------|
| Operational Ownership      | Platform team publishes XRDs/Compositions; | Platform team writes reusable TF modules;     |
|                            | Application devs consume native K8s Claims  | App teams run plan/apply runs via PR approval |
| Reconciliation Model       | Continuous 60s active reconciliation loops; | Event-driven (Git Push / Webhook);            |
|                            | Automated self-healing reverts drift        | Drift detection via scheduled speculative run |
| State Storage & Locking    | Stored inside etcd as Custom Resources;     | Managed remote state backend with             |
|                            | K8s optimistic concurrency control          | state locking during speculative runs         |
| Rollback Trade-offs        | Declarative Git revert: controller issues   | git revert triggering new plan/apply;         |
|                            | in-place cloud API updates or cascades;     | State rollback requires state file surgery    |
|                            | Deletion cascades bounded by deletionPolicy | or manual resource unlocking on failures      |

Decision Criteria: Choose Crossplane when application services dynamically request short-lived ephemeral infrastructure (e.g. per-PR preview databases) managed by the same GitOps operator as Kubernetes workloads. Choose Terraform Cloud when provisioning foundational, static multi-region networks, IAM root hierarchies, or SaaS platform configurations that require human-gated speculative plan reviews before execution.

DYNAMIC ZERO-TRUST SECRETS

Concrete Vault Secret Flow: Kubernetes Workload Identity & Short-Lived Leases

Long-lived static secrets in Git or ConfigMaps are vulnerability vectors. Enterprise IDPs integrate HashiCorp Vault to issue short-lived, policy-scoped credentials via Kubernetes service account tokens. According to Vault Kubernetes Auth Method and Vault Secrets Operator Documentation (Vault v1.16+, VSO v0.8+):

vault-workload-flow.yaml (Policy, Kubernetes Auth & Dynamic Secret)
# 1. Scoped Vault Policy (Least-Privilege Database Access)
path "database/creds/payment-db-role" {
  capabilities = ["read"]
}
path "sys/leases/renew" {
  capabilities = ["update"]
}

---
# 2. Vault Kubernetes Auth Role Mapping
# Associates namespace & service account with Vault policy
vault write auth/kubernetes/role/payment-api-role \
    bound_service_account_names=payment-api \
    bound_service_account_namespaces=production \
    policies=payment-db-policy \
    ttl=15m \
    max_ttl=1h

---
# 3. Vault Secrets Operator Dynamic Secret Custom Resource
apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultDynamicSecret
metadata:
  name: payment-database-creds
  namespace: production
spec:
  mount: database
  path: creds/payment-db-role
  destination:
    name: payment-db-dynamic-creds
    create: true
  vaultAuthRef: default-k8s-auth

Lease Renewal & Explicit Revocation Runbook:

vault-revocation.sh (Diagnostic & Incident Runbook)
# 1. Inspect dynamic secret lease metadata and remaining TTL
vault lease lookup database/creds/payment-db-role/hce78b0123...

# 2. Incident response: immediately revoke compromised lease prefix
vault lease revoke -prefix database/creds/payment-db-role

# 3. Verify database controller terminated active backend sessions
kubectl logs -n vault-system -l app.kubernetes.io/name=vault-secrets-operator --tail=50

Application Readiness & Expiry Handling: When a token lease expires or is revoked, the Vault Secrets Operator marks the local Kubernetes secret stale and re-authenticates. However, VSO does not automatically alter pod health checks or terminate running processes; applications must implement readiness checks, credential reload watchers, and reconnection logic to achieve true fail-closed behavior if credentials become unauthorized.

OPERATIONAL TELEMETRY

DORA Telemetry Schemas: MTTR, Change Failure Rate & Deployment Frequency

Measuring delivery velocity without tracking stability creates perverse incentives. In accordance with the Google Cloud DORA Research Program and DORA Four Keys Implementation Guide, metrics should measure team-relative capability trends rather than rigid universal classifications:

dora-events-schema.json (Deployment & Incident Event Contract)
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "DORA Telemetry Event",
  "type": "object",
  "required": ["event_id", "service", "timestamp", "type"],
  "properties": {
    "event_id": { "type": "string" },
    "service": { "type": "string" },
    "timestamp": { "type": "string", "format": "date-time" },
    "type": { "type": "string", "enum": ["deployment", "incident"] },
    "deployment": {
      "type": "object",
      "properties": {
        "commit_sha": { "type": "string" },
        "environment": { "type": "string", "enum": ["production", "staging"] },
        "status": { "type": "string", "enum": ["success", "failure"] }
      }
    },
    "incident": {
      "type": "object",
      "properties": {
        "incident_id": { "type": "string" },
        "severity": { "type": "string", "enum": ["sev1", "sev2", "sev3"] },
        "resolved_at": { "type": "string", "format": "date-time" },
        "caused_by_deployment": { "type": "string" }
      }
    }
  }
}

Calculation Formulations:

  • Deployment Frequency (DF): Total successful production deployments divided by number of business days in sample window (e.g. deployments / 30 days).
  • Change Failure Rate (CFR): Ratio of deployments causing degraded service requiring hotfix or rollback: (failed deployments / total deployments) * 100%.
  • Mean Time to Restore (MTTR): Arithmetic mean of elapsed durations between incident creation and resolution: Σ(resolved_at - incident_opened_at) / total_incidents.
ADMISSION GUARDRAILS & DRILLS

Kyverno Admission Enforcement, Failed-Provisioning Recovery & Adoption Metrics

Shifting policy checks to admission prevents malformed claims from ever registering in the cluster API. According to Kyverno Policy Documentation and Crossplane Troubleshooting Runbooks:

kyverno-claim-guardrail.yaml (ClusterPolicy Admission Gate)
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: enforce-db-claim-guardrails
spec:
  validationFailureAction: Enforce   # Reject requests at admission
  rules:
    - name: validate-db-size-and-team
      match:
        any:
          - resources:
              kinds:
                - PostgreSQLInstance
      validate:
        message: "Rejected: database size must be 'small', 'medium', or 'large', and 'spec.parameters.team' is required."
        pattern:
          spec:
            parameters:
              size: "small | medium | large"
              team: "?*"

Failed-Provisioning Recovery Exercise: (Simulated offline drill; no active cloud quotas or live clusters are modified; simulated results are labeled and live-run limitations remain in curriculum gaps).

failed-provisioning-recovery.sh (Diagnosis & Rollback)
# 1. Inspect stuck claim condition: status reports Synced: False, Ready: False
kubectl describe postgresqlinstance analytics-db -n analytics-team

# 2. Identify root cause in Composite Resource events: VPC subnet IP exhaustion or RDS quota
kubectl get composite -l crossplane.io/claim-name=analytics-db -o jsonpath='{.items[0].status.conditions}' | jq .

# 3. Correct claim specification to use available allocated parameter
kubectl patch postgresqlinstance analytics-db -n analytics-team --type=merge -p '{"spec":{"parameters":{"size":"medium"}}}'

# 4. Verify reconciliation resumes and status marks Ready: True
kubectl wait --for=condition=Ready postgresqlinstance/analytics-db -n analytics-team --timeout=60s

Platform Adoption Metrics: Track platform health through four observable KPIs: (1) Golden Path Adoption Rate: (services using standardized Backstage templates / total active catalog services) * 100%; (2) Time-to-First-PR: hours elapsed from engineer onboarding to first merged pull request; (3) Self-Service Lead Time: minutes to provision infrastructure via Claim without platform engineer intervention; (4) Platform CSAT: quarterly internal developer NPS score.

scripts/offline-platform-evaluator.mjs (Deterministic DORA & Policy Evaluator)
// Deterministic DORA Metrics Calculator
export function calculateDoraMetrics(deployments, incidents) {
  const totalDeploys = Array.isArray(deployments) ? deployments.length : 0;
  const failedDeploys = totalDeploys > 0
    ? deployments.filter(d => (d.deployment?.status ?? d.status) === 'failure').length
    : 0;
  const cfr = totalDeploys > 0 ? (failedDeploys / totalDeploys) * 100 : 0;

  let totalRestoreMinutes = 0;
  let resolvedCount = 0;
  if (Array.isArray(incidents)) {
    for (const inc of incidents) {
      const openedAt = inc.timestamp ?? inc.openedAt;
      const resolvedAt = inc.incident?.resolved_at ?? inc.resolvedAt;
      if (openedAt && resolvedAt) {
        const dur = (new Date(resolvedAt).getTime() - new Date(openedAt).getTime()) / 60000;
        if (dur >= 0) {
          totalRestoreMinutes += dur;
          resolvedCount++;
        }
      }
    }
  }
  const mttr = resolvedCount > 0 ? totalRestoreMinutes / resolvedCount : 0;
  return { deploymentCount: totalDeploys, changeFailureRate: cfr, mttrMinutes: mttr };
}

// Admission Policy Evaluator
export function evaluateAdmissionPolicy(claim) {
  const allowedSizes = new Set(['small', 'medium', 'large']);
  const size = claim?.spec?.parameters?.size;
  const team = claim?.spec?.parameters?.team;
  if (!size || !allowedSizes.has(size)) {
    return { allowed: false, error: 'Database size must be small, medium, or large' };
  }
  if (!team || typeof team !== 'string' || team.trim() === '') {
    return { allowed: false, error: 'Team parameter is required for cost allocation' };
  }
  return { allowed: true, error: null };
}

Predict: results this lesson prints

Write what you expect, then compare with the lesson. You mark each result yourself; it is recorded as predict evidence.

What result does the lesson show for this command?

$ yarn dev
Show the lesson's result

The lesson shows in Backstage: Software Catalog & Golden Paths:

app started at http://localhost:3000
backend started at http://localhost:7007

What result does the lesson show for this command?

$ conftest test payments-db.yaml
Show the lesson's result

The lesson shows:

2 tests, 2 passed, 0 warnings, 0 failures, 0 exceptions

What result does the lesson show for this command?

$ conftest test reports-db.yaml; echo "exit=$?"
Show the lesson's result

The lesson shows:

FAIL - reports-db.yaml - main - reports-db: size "xlarge" is not offered; use small, medium or large
FAIL - reports-db.yaml - main - reports-db: spec.parameters.team is required for cost allocation

2 tests, 0 passed, 0 warnings, 2 failures, 0 exceptions
exit=1

Practice: troubleshoot and decide

Commit to an answer before each result is shown. Finishing a drill or a decision is recorded as evidence for the sections it builds on.

Troubleshooting drill

A guardrail that never denies anything

Output recorded from a real run on conftest v0.62.0 (openpolicyagent/conftest image) and opa 1.9.0 (openpolicyagent/opa image) in Docker, run from Git Bash on Windows; the claim uses the PostgreSQLInstance API from the lesson. No cluster or Crossplane involved. Nothing runs on your machine.

Builds on Crossplane: Database-as-a-Service, Troubleshooting.

An availability-zone outage took the payments database down for 40 minutes. Its Crossplane claim in payments-prod has multiAZ: false, yet the platform's CI step runs conftest on every claim, and the policy is meant to reject single-AZ databases in -prod namespaces. The CI check was green on the pull request that created the claim.

  1. Step 1 of 3: The policy exists and CI ran it. What do you check first?

Design decision

Developer portal: self-host Backstage, buy one, or skip it?

Builds on IDP Architecture, Backstage: Software Catalog & Golden Paths.

A company of 120 engineers in 15 teams runs 80 services. Nobody can say who owns half of them, and new services are copied from whichever repo is nearest. Leadership wants a service catalog, golden-path templates and per-service scorecards within one quarter.

Constraints

  • Platform team of three; none of them write TypeScript or React
  • No new hires this year, but there is budget for a licence
  • Service metadata may be hosted by a vendor; source code stays in GitHub
  • Teams must be able to register a service without filing a ticket
Which do you choose?

Lab: simulated terminal, nothing runs on your machine

Simulated nothing runs on your machine

  1. 1 Create new Backstage app
Create new Backstage app

Ready. Type the command for the current goal.

Check yourself

In Spotify's Backstage IDP, what is the distinction between the Software Catalog and Software Templates?

Explanation

In 'Backstage: Software Catalog & Golden Paths', the Software Catalog provides every service, API, team, and resource in one searchable UI, while Software Templates provide interactive scaffolding wizards.

How does Crossplane enable a Database-as-a-Service model for internal engineering teams?

Explanation

In 'Crossplane: Database-as-a-Service', platform teams define abstract APIs via Composite Resource Definitions (XRDs) so developers can claim resources without touching cloud consoles.

A golden-path scaffolder action (such as github:repo:create) fails during template execution in Backstage. What diagnostic steps and permissions does the lesson specify?

Explanation

In 'Troubleshooting', scaffolder actions run in the Backstage backend; check backend logs, verify GitHub App/PAT permissions for github:repo:create, and use dry-run mode (--dry-run) to test templates locally.

Why does the lesson emphasize providing descriptive messages in CI guardrail deny rules (such as Conftest/Rego checks on resource size and team parameters)?

Explanation

In 'Predict the Result: A Golden-Path Guardrail in CI', each deny rule prints a message telling the developer what to change, because a guardrail that only says 'denied' sends people to the platform team's queue instead.

What is the primary metadata file required in every service repository for Backstage catalog discovery?

catalog-info.yaml at the repository root.

Space flips the current card.

Capability coverage: L1, L2, L3, L4 covered

No lesson evidence yet. Start reading this lesson, then run its free lab to record demonstrated checks.

Each cell counts this lesson's sections for that skill and level. Complete needs a demonstrated check (today only the lab); reading a section shows Developing. Not covered means the lesson has no material there.

Skills by experience level for this lesson
SkillL1 FoundationL2 PractitionerL3 ProductionL4 Architect
Understand Missing · 2 sections Not covered Not covered Not covered
Operate Not covered Missing · 1 section Not covered Not covered
Troubleshoot Not covered Not covered Missing · 1 section Not covered
Automate Not covered Not covered Missing · 1 section Not covered
Secure Not covered Not covered Not covered Not covered
Observe Not covered Not covered Missing · 1 section Not covered
Design Not covered Not covered Missing · 1 section Missing · 1 section
Make trade-offs Not covered Not covered Not covered Not covered

How this lesson fits each role