Skip to content

fix(k8s): uncap ollama memory limits and elevate daemonset/deployment thresholds (#209) - #210

Merged
dan-petty merged 2 commits into
release/v0.2.18from
fix/209-uncap-ollama-memory-elevate-k8s-limits
Sep 15, 2026
Merged

dan-petty merged 2 commits into
release/v0.2.18from
fix/209-uncap-ollama-memory-elevate-k8s-limits

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Summary

  • Uncap Ollama Memory Limits: Removed static limits.memory: 26Gi from k8s/llm/ollama-daemonset.yaml and k8s/llm/values-ollama.yaml to prevent kernel OOM kills (Exit 137) on 16GiB worker nodes and eliminate arbitrary 26Gi throttling on 64GiB GPU worker nodes.
  • ArgoCD Repo-Server Limits: Elevated memory limits from 2048Mi to 4096Mi and CPU limits from 2 to 4 in k8s/argocd/values.yaml to prevent memory spikes during large manifest generation.
  • Fluent Bit Logging Limits: Elevated memory limits from 512Mi to 1024Mi in k8s/logging/fluent-bit-values.yaml to prevent log buffer drops on high-throughput nodes.
  • Test Contracts: Updated tests/test_k8s.py assertions to enforce unconstrained Ollama memory limits and elevated threshold values.

Closes #209

@dan-petty
dan-petty force-pushed the fix/209-uncap-ollama-memory-elevate-k8s-limits branch from 58583dc to a950c41 Compare September 14, 2026 21:59
@dan-petty
dan-petty marked this pull request as ready for review September 15, 2026 02:11
Copilot AI lite review requested due to automatic review settings September 15, 2026 02:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unbounded Ollama memory usage and incomplete resource-test coverage leave unresolved safety concerns.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR adjusts Kubernetes resource settings for Ollama, ArgoCD repo-server, and Fluent Bit.

Changes:

  • Removes Ollama memory limits.
  • Raises ArgoCD and Fluent Bit resource limits.
  • Updates Kubernetes tests and task documentation.
File summaries
File Summary
tests/test_k8s.py Updates resource assertions.
k8s/logging/fluent-bit-values.yaml Raises Fluent Bit memory limit.
k8s/llm/values-ollama.yaml Removes Helm memory limit.
k8s/llm/ollama-daemonset.yaml Removes DaemonSet memory limit.
k8s/argocd/values.yaml Raises repo-server CPU and memory limits.
docs/agent/tasks/task-209-uncap-ollama-memory-elevate-k8s-limits.md Updates task documentation.
Review details

Suppressed comments (7)

docs/agent/tasks/task-209-uncap-ollama-memory-elevate-k8s-limits.md:16

  • The ratio in this root-cause statement is incorrect: 26Gi is 162.5% of 16Gi, which is 62.5% over the node's physical memory, not 174% overcommit. Please correct the percentage so the operational rationale is accurate.
- `llm/ollama`: Terminated with Exit Code 137 on 16GiB worker nodes where a blanket `26Gi` limit allowed the container to exceed host physical RAM (174% overcommit), while artificially capping 64GiB GPU worker nodes.

docs/agent/tasks/task-209-uncap-ollama-memory-elevate-k8s-limits.md:23

  • Removing the limit is not node-adaptive in a safe sense: the 8Gi request only affects scheduling, so Ollama can consume all remaining memory on every GPU-labeled node and trigger node-level OOM or evictions of other workloads. Pair this with dedicated/tainted GPU nodes or a node-size-aware cap; otherwise the change can reproduce the stated Exit 137 failure at node scope.
   - Remove static `limits.memory: 26Gi` to permit node-adaptive unconstrained memory scaling across 16GiB to 64GiB nodes.

k8s/argocd/values.yaml:45

  • The PR changes the repo-server CPU limit to 4000m, but the test contract only checks its memory and therefore a regression to 2000m would pass. Add an exact CPU-limit assertion alongside the memory assertion.
      cpu: 4000m

k8s/llm/ollama-daemonset.yaml:69

  • Removing the only memory limit leaves this DaemonSet unbounded: on a 16GiB GPU node, Ollama can grow past the node's allocatable memory, trigger node-level OOM/eviction, and starve other DaemonSets. A 26Gi limit being too high does not make no limit node-adaptive; use per-node bounded limits (for example, node-specific overlays/DaemonSets) or another mechanism that derives a safe cap from allocatable memory.
              memory: 8Gi

k8s/llm/values-ollama.yaml:31

  • Removing the Helm chart's only memory limit has the same node-level failure mode as the DaemonSet: a pod scheduled with a 4Gi request may consume all remaining memory on a small node and cause node OOM/eviction. Replace the static 26Gi value with a capacity-aware bounded configuration rather than making the chart unbounded.
    memory: 4Gi

tests/test_k8s.py:918

  • This assertion still accepts the old 512Mi value, so the Fluent Bit limit increase is not enforced by the test. Assert 1024Mi exactly to prevent the changed manifest from regressing silently.
    assert fb_values["resources"]["limits"]["memory"] in ("512Mi", "1024Mi")

tests/test_k8s.py:819

  • With only an 8Gi request, removing the memory limit does not cap runtime usage on a 16Gi node; Ollama can consume the remaining node memory and still trigger node-level eviction/OOM, including Exit 137. If unbounded growth is intentional, revise the stated OOM-prevention rationale and add a node-pressure safeguard; otherwise use a node-appropriate limit or placement policy.
    assert "limits" not in resources or "memory" not in resources.get("limits", {})
  • Files reviewed: 6/6 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/test_k8s.py Resolved
@dan-petty
dan-petty merged commit 1381259 into release/v0.2.18 Sep 15, 2026
4 of 5 checks passed
@dan-petty
dan-petty deleted the fix/209-uncap-ollama-memory-elevate-k8s-limits branch September 15, 2026 03:40
@dan-petty dan-petty mentioned this pull request Sep 15, 2026
11 tasks done
dan-petty added a commit that referenced this pull request Sep 16, 2026
* feat(release): v0.2.18

* fix(security): harden secret sanitizer boundaries and safe path exclusions (#116) (#203)

* fix(security): harden secret sanitizer boundaries and safe path exclusions (#116)

* fix(release): default release PRs to draft mode

* fix(security): harden secret boundaries, remove extension lookahead, and update task status (#116)

* fix(security): remediate devsecops findings and add native rate management (#204)

* test

* fix(security): remediate devsecops findings and add native rate management

* docs(task): update task-204 status to in review and link PR #204

* fix(security): permit token masking in filesystem path arguments

* fix(security): remediate review findings, exclude home in sandbox, and relocate MockProvider (#205) (#206)

* fix(security): remediate review findings, exclude home in sandbox, and relocate MockProvider (#205)

* docs(task): update task-205 status to in review and link PR #206

* test(sandbox): provide explicit tmp_path workspace_dir in test_docker_sandbox_wait_timeout

* fix(rag): support both gitignore and gitwildmatch pathspec factories

* feat(sandbox): multi-tier networking options and decommission task.md (#207) (#208)

* feat(sandbox): multi-tier networking options and decommission task.md index (#207)

* docs(agent): transition task 207 to in-review with PR #208

* test(projects): update test fixtures to eliminate task.md references

* fix(security): replace concrete RFC 1918 and internal homelab endpoints with standard documentation values

* fix(sandbox): harden network containment, secret output masking, and rate limiter caching

* fix(sandbox): remediate egress containment, dns resolution, and output masking findings (#207)

* fix(security): stream sandbox container output directly to sys streams avoiding logger sink cleartext alerts (#207)

* docs(agents): mandate working pull requests from oldest to newest (FIFO)

* docs(roadmap): add v0.2.23 reactive workstation command center and interactive TUI

* docs(agents): mandate root-cause remediation, roadmap synthesis, and interaction improvement

* fix(docs): escape placeholder angle brackets and prune completed roadmap matrix items

* fix(security): stream sandbox output via centralized output writers to resolve codeql cleartext alerts

* fix(k8s): uncap ollama memory limits and elevate daemonset/deployment thresholds (#209) (#210)

* fix(k8s): uncap ollama memory limits and elevate daemonset/deployment thresholds (#209)

* fix(k8s): add CoreDNS resource configs and tighten test assertions (#209)

* fix(github): enforce gh request throttling, disk quota persistence, and diff-only project sync (#211) (#212)

* fix(github): enforce window-budgeted rate pacing, disk quota persistence, and diff-only project sync (#211)

* docs(agent): record PR #212 in task 211 tracking

* fix(github): enforce low-quota circuit breakers, preamble-tolerant JSON parsing, and casing-safe project diffing (#211)

* fix(github): replace quota thresholds with logical exponential backoff (#211)

* test(github): patch run_gh instead of run_subprocess in reconcile tests (#211)

* fix(github): derive rate limit pacing from actual response values without hardcoded windows (#211)

* fix(ci): stop running all of the ci tasks every time a pr is marked ready for review.

* fix(ci): decouple project automation into dedicated workflow and add quota safety guards (#211)

* fix(github): align rate limiter baseline velocity and add quota test coverage (#211)

* refactor(ai): eliminate inline function parameter defaults in favor of defaults submodule

* fix(github): enforce strict non-negative rate quotas, 25% threshold, and remediate review findings (#211)

* fix(typecheck): resolve Path None guard and optional quota remaining in mypy (#211)

* docs: refresh CLI and MCP references for updated commands and errors (#211)

* fix(ci): enforce mandatory pre-push devops ci gate, handle unauthenticated acquire, and expand test coverage (#211)

* fix(pr): align checks fallback to run_subprocess and isolate rate limiter sleep test (#211)

* fix(ci): complete pre-push gate, argo drift tests, and coverage expansion (#211)

* docs(agent): update task-211 documentation with linear window pacing and pre-push quality gate (#211)

* fix(pr): guard pr ready against failing checks and fix project automation uv sync (#211)

* docs(pr): update cli and mcp reference for pr ready --force

* fix(github): address pr 212 review comments on workflows, sandbox, defaults, and rate limiter (#211)

* fix(security): derive artifact version from package metadata and validate whitelist tokens (#211)

* feat(security): sigstore cosign container provenance and image signing (#112) (#213)

* fix(ci): prune all merged PR devcontainer images from ghcr and guard in-flight builds

* feat(security): sigstore cosign container provenance and image signing (#112)

* docs(agent): link PR 213 in task 112 tracking doc

* fix(security): resolve review comments for cosign container provenance (#112)

* ci: re-trigger validation after resolving all review threads

* feat(security): falco ebpf runtime security and anomaly streamer (#113) (#214)

* feat(security): falco ebpf runtime security and anomaly streamer (#113)

* fix(security): resolve review comments for falco ebpf runtime security (#113)

* chore: retrigger validation after resolving all review threads

* feat(security): distributed threat intelligence valkey l2 cache and radar batching (#122) (#215)

* feat(security): distributed threat intelligence valkey l2 cache and radar batching (#122)

* fix(security): resolve review comments for threat intel valkey l2 cache and batching (#122)

* chore: retrigger validation after resolving all review threads

* perf(github): adjust rate limit no-delay used threshold to 30%
@dan-petty dan-petty mentioned this pull request Sep 16, 2026
7 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants