Skip to content

Add priority preemption cascade problem - #821

Merged
Saadmrp1038 merged 8 commits into
SREGym:mainfrom
thromel:romel/priority-preemption-cascade
Jun 1, 2026
Merged

Saadmrp1038 merged 8 commits into
SREGym:mainfrom
thromel:romel/priority-preemption-cascade

Conversation

@thromel

@thromel thromel commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds priority_preemption_cascade_hotel_reservation, a Hotel Reservation benchmark problem based on Grafana Labs' Kubernetes Pod Priorities outage in Hosted Prometheus.

The failure is a scheduler-policy bug. A tenant workload gets a medium PriorityClass, preempts an existing production pod with priority 0, and then blocks the replacement production pod from reclaiming capacity because the replacement inherits the same unsafe default priority. The visible symptom is an under-replicated reservation service, but the root cause is PriorityClass policy and scheduler preemption.

Real-world failure story

Grafana's incident writeup describes a Cortex rollout where new ingesters had medium priority while existing production ingesters had no priority. Under node pressure, Kubernetes preempted the existing ingesters for the new workload. Replacement production pods then had the wrong priority relationship and could not recover the cluster cleanly.

Related links:

Fault model

The problem starts from a normal Hotel Reservation deployment, then makes the scheduler state explicit:

  1. reservation gets a capped memory request while its running pod still has priority 0.
  2. reservation is pinned to the selected pressure node so its replacement cannot escape to another worker.
  3. platform-medium is created with globalDefault: true. This is the bad platform policy.
  4. production-critical is created with a higher value, but it is not applied to reservation during injection.
  5. Other Hotel Reservation deployments are assigned platform-medium, so reservation is the intended preemption victim.
  6. analytics-batch/report-cache-shard-* padding workloads are pinned to the same node with 8Gi or 16Gi memory requests and the same platform-medium priority as the tenant workload. They make large-memory nodes look like a busy cluster without making reservation or the tenant request hundreds of GiB.
  7. analytics-batch/tenant-ingester is pinned to the same node as reservation and requests enough memory that it can only schedule by preempting the lower-priority reservation pod.

The injector waits for actual evidence: the tenant workload is ready, reservation is unavailable, a scheduler preemption event exists, and the replacement reservation pod has inherited platform-medium.

What reviewers should see at runtime

When the fault is active:

  • analytics-batch/tenant-ingester is Running on the target node.
  • analytics-batch/report-cache-shard-* pods are Running on the same node with platform-medium priority and 8Gi or 16Gi requests.
  • reservation is under-replicated or unavailable.
  • scheduler events show preemption and failed scheduling pressure.
  • platform-medium exists and is still globalDefault: true.
  • production-critical exists but is not applied to the reservation deployment template.

Useful checks:

kubectl get events -A --sort-by=.lastTimestamp | grep -Ei "preempt|failedscheduling|reservation|tenant-ingester"

kubectl get pod -n hotel-reservation \
  -l io.kompose.service=reservation \
  -o custom-columns=NAME:.metadata.name,PHASE:.status.phase,NODE:.spec.nodeName,PRIORITY:.spec.priority,CLASS:.spec.priorityClassName,NOMINATED:.status.nominatedNodeName

kubectl get pod -n analytics-batch \
  -o custom-columns=NAME:.metadata.name,PHASE:.status.phase,NODE:.spec.nodeName,PRIORITY:.spec.priority,CLASS:.spec.priorityClassName,REQ:.spec.containers[*].resources.requests.memory

kubectl get priorityclass
kubectl describe node <target-node>

A good diagnosis should avoid app-level explanations like bad image, broken service selector, DNS, or reservation code. The useful evidence is in scheduler events, pod priorities, and node memory requests.

Expected mitigation

The intended fix is to repair the priority policy while keeping the tenant workload present:

  • make platform-medium no longer the global default;
  • protect deployment/reservation with a PriorityClass whose value is higher than platform-medium;
  • use production-critical for that protection, or use another explicit higher-valued class such as reservation-high-priority;
  • let the reservation rollout recover and regain ready endpoints.

The mitigation oracle rejects shortcuts that would make a generic health check pass while missing the fault:

  • deleting analytics-batch/tenant-ingester;
  • scaling the tenant workload to zero;
  • deleting the PriorityClasses instead of fixing the policy;
  • scaling any Hotel Reservation deployment below one replica;
  • reducing the memory requests used to create scheduler pressure.

Code changes

  • sregym/conductor/problems/priority_preemption_cascade.py: problem definition, scheduler setup, realistic request sizing, capacity padding, preemption evidence checks, and cleanup for app templates plus PriorityClasses.
  • sregym/conductor/oracles/priority_preemption_mitigation.py: mitigation oracle for policy recovery and shortcut rejection.
  • sregym/conductor/problems/registry.py: registers priority_preemption_cascade_hotel_reservation.
  • Problem List.md: adds the new problem entry.
  • tests/problems/test_priority_preemption_cascade.py and tests/oracles/test_priority_preemption_mitigation.py: focused coverage for injection assertions, padding behavior, cleanup, and oracle checks.

No new Python dependencies or RBAC changes are included.

Validation

Requested CI validation:

/validate-problem priority_preemption_cascade_hotel_reservation

Local checks run after the latest linked-comment fix:

python3 -m py_compile \
  sregym/conductor/problems/priority_preemption_cascade.py \
  tests/problems/test_priority_preemption_cascade.py

uv run pytest -q \
  tests/problems/test_priority_preemption_cascade.py \
  tests/oracles/test_priority_preemption_mitigation.py

uv run --with ruff ruff check \
  sregym/conductor/problems/priority_preemption_cascade.py \
  tests/problems/test_priority_preemption_cascade.py \
  tests/oracles/test_priority_preemption_mitigation.py

uv run --with black black --check \
  sregym/conductor/problems/priority_preemption_cascade.py \
  tests/problems/test_priority_preemption_cascade.py \
  tests/oracles/test_priority_preemption_mitigation.py

The focused unit suite passed with 29 tests.

A targeted local lifecycle on kind-sregym-calico-spike also passed before the latest review-fix commits: app deploy, fault injection, oracle failure while the fault was active, recovery, oracle success after mitigation, and cleanup of app namespace, tenant namespace, PriorityClasses, and Hotel Reservation PVs.

No agent-run result is claimed here. The evidence for this PR is the lifecycle validation and the scheduler state described above.

@thromel thromel closed this May 30, 2026
@thromel
thromel deleted the romel/priority-preemption-cascade branch May 30, 2026 05:00
@thromel
thromel restored the romel/priority-preemption-cascade branch May 30, 2026 05:07
@thromel thromel reopened this May 30, 2026
@Saadmrp1038
Saadmrp1038 self-requested a review May 30, 2026 06:24
@Saadmrp1038 Saadmrp1038 added the problem Adding a new problem to the benchmark label May 30, 2026
@Saadmrp1038

Copy link
Copy Markdown
Collaborator

@thromel Thanks for the PR! I will review it soon.

@Saadmrp1038

Copy link
Copy Markdown
Collaborator

@thromel It looks like another contributor opened an RFC for this exact problem 3 days ago(#795). Since they've completed their eval task and haven't started implementation of the fault yet, there's no wasted effort on either side.

That said, please do a quick check for open issues/PRs before creating a new one. With so many people actively implementing faults right now, duplicate efforts can be really unfortunate :)

Thanks!

@thromel

thromel commented May 30, 2026

Copy link
Copy Markdown
Contributor Author

@thromel It looks like another contributor opened an RFC for this exact problem 3 days ago(#795). Since they've completed their eval task and haven't started implementation of the fault yet, there's no wasted effort on either side.

That said, please do a quick check for open issues/PRs before creating a new one. With so many people actively implementing faults right now, duplicate efforts can be really unfortunate :)

Thanks!

@Saadmrp1038 Thanks for the review, and sorry about that. I should have checked for existing RFCs/issues before starting the implementation.

Fortunately, it sounds like there wasn't any overlapping implementation work yet, but I'll make sure to do a more thorough check next time to avoid duplicate effort.

Thanks for the heads-up!

@Saadmrp1038 Saadmrp1038 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thromel Everything works great! I left some comments below. Mostly minor things.
Ping me after you address them. I will merge the PR.

@Saadmrp1038

Saadmrp1038 commented Jun 1, 2026 •

Copy link
Copy Markdown
Collaborator

@thromel
After some agent runs I actually found another issue. Real clusters can have a lot of free memory. The nodes I am using each have 192GB of memory. So, the memory requests look something like below.

  • Node allocatable: ~192 Gi
  • reservation request: ~56 Gi
  • tenant-ingester request: ~159 Gi

From the agent's perspective this seems excessively large and it tries to modify the memory request instead of investigating deeper and finding the priority issue. Can we do something about it? Maybe deploy some padding pods (with believable framing and each taking 8Gi/16Gi memory) in some namespace to request memory in reasonable amount. Then allocate realistic amount of memory to reservation and tenant-ingestor. This makes the scenario more believable.

If there's some other way to achieve this that's also okay.

@thromel

thromel commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Good catch. I pushed a fix in dcfb4b9: reservation is capped at 8Gi, and the injector now adds pinned report-cache-shard-* padding pods with 8Gi/16Gi requests in analytics-batch. The tenant request stays realistic on large nodes, while the priority setup still forces the preemption issue onto reservation.

@thromel

thromel commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor Author

@Saadmrp1038 I addressed the review comments, please check again

@Saadmrp1038

Copy link
Copy Markdown
Collaborator

@thromel so fast! Thank you. Checking again.

@Saadmrp1038

Copy link
Copy Markdown
Collaborator

@thromel Thanks for adressing my comments so fast! Looks great now.
Congrats on your first PR merged here 🎉

@Saadmrp1038
Saadmrp1038 merged commit 6b7bdd5 into SREGym:main Jun 1, 2026
@Saadmrp1038

Copy link
Copy Markdown
Collaborator

ermias19 pushed a commit to ermias19/SREGym that referenced this pull request Jun 5, 2026
* Add priority preemption cascade problem

* Harden priority preemption cascade injection

* Tighten priority preemption cascade validation

* Address priority preemption review comments

* Keep priority preemption sizing realistic

---------

Co-authored-by: Saad Mohammad Rafid Pial <[email protected]>
ermias19 pushed a commit to ermias19/SREGym that referenced this pull request Jun 5, 2026
* Add priority preemption cascade problem

* Harden priority preemption cascade injection

* Tighten priority preemption cascade validation

* Address priority preemption review comments

* Keep priority preemption sizing realistic

---------

Co-authored-by: Saad Mohammad Rafid Pial <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

problem Adding a new problem to the benchmark

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants