Files
rootnode-academy/scenarios/data/rootnode-enforce-limits.json
ced4568andClaude Sonnet 5 60fbf0c385 feat(curriculum): add RootNode learning path, student roster, and scenario isolation metadata
Pre-Phase-1 platform work, approved and tested earlier but not yet committed:

- Terminal banner: "RootNode Academy Lab — node: k8s-lab", upstream KubeKosh
  attribution left untouched in footer/README/LICENSE.
- RootNode curriculum mode: scenarios/rootnode-path.json (Foundation -> Workloads
  -> Networking -> Configuration -> Troubleshooting -> Real Ops -> Capstone),
  built from existing scenario content grouped by category, no new scenarios
  invented. New GET /api/curriculum/path endpoint.
- Student roster + per-student progress: instructor-roster, pick-your-name login
  (no password), students/environments-adjacent progress table migrated to a
  (student_id, scenario_id) composite key so practice progress and exam sessions
  are isolated per student instead of one global bucket. New /api/roster,
  /api/login endpoints.
- scenarios/data/*.json: added isolation_type metadata (shared_namespace vs
  ephemeral_cluster) from an audit of which scenarios execute cluster-scoped or
  node-level commands. This was Tier-1-isolation groundwork that got superseded
  same-day by the full-ephemeral-per-student architecture (see
  docs/LAB_ARCHITECTURE.md) — the field is kept as descriptive metadata only,
  per the note now in scenarios/SCHEMA.md. Not wasted: it's an accurate audit of
  which scenarios touch cluster-scoped resources, useful independent of isolation
  model.
- .gitignore added (node_modules/, frontend/dist/, *.db, /data/, .env) — none
  existed before; without it, npm installs during testing would have landed in
  a commit.

Known limitation still open: no frontend UI for any of this yet (login screen,
roster-add form, curriculum view) — API-only. No auth on the roster-add endpoint.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-08-18 01:21:16 -05:00

77 lines
4.6 KiB
JSON

{
"id": "rootnode-enforce-limits",
"title": "Stop the Next Outage: Enforce Resource Defaults",
"category": "Observability & Ops",
"isolation_type": "shared_namespace",
"difficulty": "Hard",
"type": "task",
"weight": 10,
"description": "## Stop the Next Outage: Enforce Resource Defaults\n\nThe `node-metrics` incident happened because a workload was deployed with an unbounded resource request. The immediate fix was to right-size that deployment — but the root cause is still live: **nothing stops the next engineer from deploying into the `workloads` namespace without any resource constraints at all**.\n\nThis scenario is about closing that gap. A LimitRange is a namespace-level policy object that automatically injects default resource requests and limits into any container that omits them. One object, applied once, protects every workload in the namespace going forward — without requiring every developer to remember to set resources manually.\n\n**Your task:** Create a LimitRange named `resource-defaults` in the `workloads` namespace that enforces the following defaults for every container:\n\n| Field | Value |\n|---|---|\n| Default CPU limit | `500m` |\n| Default CPU request | `100m` |\n| Default memory limit | `256Mi` |\n| Default memory request | `128Mi` |\n\nOnce the LimitRange is in place, validate that a pod deployed **without any resource block** automatically receives these defaults.\n\n> This is governance, not cleanup. The goal is a policy that survives the next deployment.",
"hints": [
{
"title": "1. Check the namespace",
"body": "The workloads namespace should already exist. Confirm it is there before applying anything — if it is missing, create it first.",
"command": "kubectl get namespace workloads"
},
{
"title": "2. Write the LimitRange manifest",
"body": "A LimitRange with type Container and a default/defaultRequest block is what you need. The default field sets limits; defaultRequest sets requests. Save it to a file and apply with kubectl apply -f.",
"command": "kubectl apply -f - <<EOF\napiVersion: v1\nkind: LimitRange\nmetadata:\n name: resource-defaults\n namespace: workloads\nspec:\n limits:\n - type: Container\n default:\n cpu: 500m\n memory: 256Mi\n defaultRequest:\n cpu: 100m\n memory: 128Mi\nEOF"
},
{
"title": "3. Verify the defaults are injected",
"body": "Deploy a test pod with no resource block into the workloads namespace. Then describe it and check that the container shows the LimitRange defaults under Limits and Requests.",
"command": "kubectl run test-limits --image=nginx:1.25 -n workloads\nkubectl describe pod test-limits -n workloads | grep -A6 'Limits:'"
}
],
"setup_commands": [
{
"command": "kubectl create namespace workloads --dry-run=client -o yaml | kubectl apply -f -"
}
],
"validation": {
"description": "Checks that the LimitRange exists with the correct default values.",
"commands": [
{
"description": "LimitRange 'resource-defaults' exists in workloads namespace",
"command": "kubectl get limitrange resource-defaults -n workloads -o jsonpath='{.metadata.name}' 2>/dev/null || echo ''",
"expected_output": "resource-defaults",
"match": "exact"
},
{
"description": "Default CPU limit is 500m",
"command": "kubectl get limitrange resource-defaults -n workloads -o jsonpath='{.spec.limits[0].default.cpu}' 2>/dev/null || echo ''",
"expected_output": "500m",
"match": "exact"
},
{
"description": "Default memory limit is 256Mi",
"command": "kubectl get limitrange resource-defaults -n workloads -o jsonpath='{.spec.limits[0].default.memory}' 2>/dev/null || echo ''",
"expected_output": "256Mi",
"match": "exact"
},
{
"description": "Default CPU request is 100m",
"command": "kubectl get limitrange resource-defaults -n workloads -o jsonpath='{.spec.limits[0].defaultRequest.cpu}' 2>/dev/null || echo ''",
"expected_output": "100m",
"match": "exact"
},
{
"description": "Default memory request is 128Mi",
"command": "kubectl get limitrange resource-defaults -n workloads -o jsonpath='{.spec.limits[0].defaultRequest.memory}' 2>/dev/null || echo ''",
"expected_output": "128Mi",
"match": "exact"
}
]
},
"default_namespace": "workloads",
"teardown_commands": [
{
"command": "kubectl delete limitrange resource-defaults -n workloads --ignore-not-found"
},
{
"command": "kubectl delete namespace workloads --ignore-not-found --wait=false"
}
]
}