Repository navigation
Description
Update 2026-11-26 (infra move): the llm manifests, gateway config and network policies moved to dan-petty/homelab.
This issue keeps the product part: the default Ollama URLs, gpu_matrix.json, the devcontainer template, the llm port-forward of Ollama in commands/k8s/, and the specs and tests that name the Services in llm. The namespace move, the Open WebUI securityContext and restricted llm are in the homelab follow-up. Both must land together.
Follow-up: dan-petty/homelab#290.
Problem Description
The gateway, with the provider keys and the spend database, runs in a privileged namespace only because of the Ollama hostPath. All other llm pods already meet the restricted Pod Security profile. This item is rank 22 of the cluster integration plan #4989.
Reproduction Steps
kubectl get namespace llm --show-labelsshows the Pod Security level.kubectl -n llm get podsand read the securityContext and volumes of each pod.
Expected vs Actual Behavior
Expected: the namespace that holds the provider keys enforces restricted Pod Security.
Actual: the Ollama DaemonSets need a hostPath model store and a CAP_CHOWN initContainer, so llm is privileged.
Proposed Fix
- Move the Ollama DaemonSets and Services to a new privileged namespace (hostPath model store, CAP_CHOWN initContainer).
- Give Open WebUI a restricted securityContext in
values-open-webui.yaml. - Set llm to enforce restricted.
- Change the 24 tracked files that name the Ollama Services in llm (gateway config,
config/defaults.py,gpu_matrix.json, the devcontainer template, specs and tests) and the gateway perimeter.
Do it after #3583, or fold #3583 in.
Environment Diagnostics
Homelab k3s cluster; Ollama DaemonSets on the GPU nodes. Study: read-only kubectl get, 2026-11-12.
Acceptance Criteria
- The llm namespace enforces restricted, and every llm pod runs.
- The Ollama pods run in their own namespace, and the gateway reaches them.
git grepfinds no Ollama Service name in the llm namespace.
Dependencies
#3583 (admit only the gateway to the Ollama pods).
Source: #4989
Alternatives check of 2026-12-01: none.
Tool: none found.
Reason: Searches found only policy engines and codemod tools; Kyverno cannot admit the hostPath and CAP_CHOWN Ollama pods, and no tool rewrites the tracked llm DNS names, so the edits stay manual.
Lacks:
- No tool moves the Ollama DaemonSets to a privileged namespace
- No tool rewrites the Ollama Service names in 24 tracked files
- No tool updates the port-forward, specs and tests together
- A policy engine blocks the hostPath and CAP_CHOWN pods instead of moving them
Proposed design
Problem statement
The llm Namespace holds the gateway with the provider keys and the spend database. The Ollama DaemonSets need a hostPath model store and a CAP_CHOWN initContainer, so llm cannot enforce restricted Pod Security. dan-petty/homelab#290 moves Ollama to an ollama Namespace and sets llm to restricted. This item changes the product files that name the Ollama Services in llm: the default URLs, gpu_matrix.json, the devcontainer endpoint, the port-forward, the specs and the tests. Both changes must land together.
Acceptance criteria
Requirement: CLI default Ollama URLs name the ollama Namespace
DEFAULT_OLLAMA_CLUSTER_URL and DEFAULT_OLLAMA_EMBEDDING_CLUSTER_URL SHALL name the ollama Namespace.
Scenario: Default URL test
- WHEN
uv run pytest tests/ai/rag/test_rag_embedding_urls.py -qruns - THEN The run passes, and the new test asserts that each default URL ends with
.ollama.svc.cluster.local:11434.
Requirement: Ollama port-forward targets the ollama Namespace
The Ollama port-forward of the k8s command group MUST target the ollama Namespace.
Scenario: Port-forward target test
- WHEN
uv run pytest tests/commands/k8s/test_k8s.py -qruns - THEN The run passes, and the new test asserts that the Ollama port-forward holds the namespace
ollama.
Requirement: Devcontainer Ollama endpoint names the ollama Namespace
.devcontainer/devcontainer.json MUST set ollama.endpoint to the ollama Namespace URL in the vscode and antigravity settings.
Scenario: Devcontainer endpoint lines
- WHEN
git grep -c 'ollama-48gib.ollama.svc.cluster.local' -- .devcontainer/devcontainer.jsonruns at the head of the branch - THEN The command prints
.devcontainer/devcontainer.json:2and exits 0.
Requirement: No tracked file names an Ollama Service in the llm Namespace
No tracked file SHALL name an Ollama Service with the llm Namespace.
Scenario: Repository invariant
- WHEN
git grep -nE 'ollama-[0-9]+gib\.llm\.svc\.cluster\.local' -- . ':!CHANGELOG.md' ':!openspec/changes/archive'runs at the head of the branch - THEN The command prints no line and exits 1.
Requirement: Pending a person after the merge
A person MUST merge this change in the same window as dan-petty/homelab#290, and the Ollama Service MUST answer in the ollama Namespace.
Scenario: Ollama Service answers in ollama
- WHEN
kubectl -n ollama run ollama-probe --rm -i --restart=Never --image=curlimages/curl -- curl -fsS http://ollama-48gib:11434/api/tagsruns after both merges - THEN The command prints the JSON model list and exits 0.
Existing Tool Considered
The alternatives check of 2026-11-25 in the issue body gives verdict none and names no tool; its Lacks: list holds the file edits that no tool does. The product part is a set of string edits in tracked files, so this change builds no code and has no build cost and no elapsed time beyond those edits.
Key questions
- Which tracked files name an Ollama Service in the
llmNamespace?:src/devops_cli/config/defaults.py:159andsrc/devops_cli/config/defaults.py:166hold the two default cluster URLs..devcontainer/devcontainer.jsonsetsollama.endpointtohttp://ollama-48gib.llm.svc.cluster.local:11434in the vscode and antigravity settings.tests/ai/rag/test_rag_embedding_urls.pycompares the settings with the defaults, andopenspec/specs/configured-service-urls/spec.mdholds the requirement text. The issue body also namesgpu_matrix.json, the Ollama port-forward incommands/k8s/and the specs and tests. Thegit grepcriterion covers each tracked file that this answer does not name. [sources: src/devops_cli/config/defaults.py:159, src/devops_cli/config/defaults.py:166, .devcontainer/devcontainer.json, tests/ai/rag/test_rag_embedding_urls.py, openspec/specs/configured-service-urls/spec.md] - Which DNS form do the default Ollama URLs and the devcontainer endpoint use after the move?: Keep each Service name and change the namespace segment to
ollama, so each name is<service>.ollama.svc.cluster.local:11434. (best practice) [sources: .devcontainer/devcontainer.json, src/devops_cli/config/defaults.py:159]- Chosen: Namespace-qualified DNS in
ollama. The cluster DNS name form is<service>.<namespace>.svc.cluster.local, and the homelab change moves the Services toollama. - Rejected: Keep the
llmnames. The Services leavellm, so the names stop resolving, andllmmust enforce restricted. - Rejected: Short Service name with no namespace. The gateway runs in
llmand the Ollama pods run inollama, so a short name resolves in the wrong Namespace.
- Chosen: Namespace-qualified DNS in
- Does the devcontainer change apply to both customization blocks?: Yes.
.devcontainer/devcontainer.jsonholdsollama.endpointin thevscodesettings and in theantigravitysettings, and both hold thellmURL. [sources: .devcontainer/devcontainer.json] - Does this item fold in fix(k8s): admit only the gateway to the Ollama pods #3583, or keep it as a dependency?: Keep fix(k8s): admit only the gateway to the Ollama pods #3583 as a dependency and do not fold it in. One item delivers one change, and fix(k8s): admit only the gateway to the Ollama pods #3583 holds its own acceptance criteria. (best practice) [sources: CONTEXT.md]
- Chosen: Keep fix(k8s): admit only the gateway to the Ollama pods #3583 as a dependency. The body lists fix(k8s): admit only the gateway to the Ollama pods #3583 under Dependencies, and one pull request delivers one change.
- Rejected: Fold fix(k8s): admit only the gateway to the Ollama pods #3583 into this item. The fold joins two changes and two sets of acceptance criteria in one pull request.
- Does the
git grepinvariant cover the historical changelog and the archived changes?: No. ExcludeCHANGELOG.mdandopenspec/changes/archive/with pathspecs. A changelog line and an archived change record the past, and this change edits neither. (best practice) [sources: CHANGELOG.md, CONTEXT.md]- Chosen: Exclude the history files with pathspecs. A historical changelog line or an archived change would fail the criterion, and this change must not edit them.
- Rejected: Grep the whole tree. It fails on a historical record that this change must not edit.
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 12, 2026
Both harden Ollama pod security, but #1060 sets per-pod securityContext fields while the candidate changes namespace-level admission and relocates workloads.devops-cli-service commentedon Nov 16, 2026
Owner question: Who confirms on the homelab cluster that llm enforces restricted and that every llm pod runs after the change? (a person decides)
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 18, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (9)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 21, 2026
Owner question: See the first point of Open questions in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 21, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files in the section Proposed design of the body.
devops-cli-service commentedon Nov 26, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.