Skip to content

fix(k8s): a direct embedding call must not reach the 48 GiB tier #3574

Closed

Description

@dan-petty

Problem or Motivation

The tiers ollama-48gib and ollama-64gib load qwen3.8:27b alone (#3567). A client that calls the default Ollama Service ollama-fast straight, past the gateway, can still ask for another model. Ollama then unloads qwen3.8:27b to load it.

Two paths do this today:

  • devops k8s configure-urls writes ai.ollama_urls with the default Ollama Service, which is the 48 GiB tier (DEFAULT_OLLAMA_CLUSTER_SERVICE). The default ai.provider is ollama, and the RAG embedding code uses ai.ollama_urls when no embedding URL is set (src/devops_cli/ai/rag/embeddings.py, _get_ollama_urls). So qwen3-embedding:0.6b goes to the 48 GiB tier.
  • The NetworkPolicy llm-default-perimeter admits every pod of the llm namespace, the monitoring namespace and Traefik to the Ollama pods, and ollama-ingress exposes ollama-fast.

Proposed Solution & Architectural Design

Send direct embedding calls to an embedding Service (DEFAULT_OLLAMA_EMBEDDING_CLUSTER_URL) and not to the default Service, or send them through the gateway. Decide with the owner whether the Ollama pods admit the gateway alone. Add a test that fails when a default URL for an embedding call names a tier that loads one chat model.

Target Subsystem

Kubernetes & Minikube Automation

Existing Tool Considered

Kubernetes NetworkPolicy for the admission rule, and the gateway for the embedding route. Nothing is built.

Related: #3567

Proposed design

Problem statement

ollama-48gib and ollama-64gib load qwen3.8:27b alone. A client that calls the default Ollama Service ollama-fast can ask for another model. Ollama then unloads qwen3.8:27b to load it. devops k8s configure-urls writes ai.ollama_urls with ollama-fast. The default ai.provider is ollama, and the RAG embedding code reads ai.ollama_urls. Thus a direct embedding call reaches the 48 GiB tier.

Acceptance criteria

Requirement: Embedding URL setting

The AI configuration SHALL hold an embedding URL setting that defaults to DEFAULT_OLLAMA_EMBEDDING_CLUSTER_URL.

Scenario: Default embedding URL

  • WHEN no embedding URL is set in the configuration
  • THEN the resolved embedding URL list is [DEFAULT_OLLAMA_EMBEDDING_CLUSTER_URL].

Requirement: Embedding engine endpoint

The embedding engine MUST send a direct Ollama embedding request to the embedding URL and MUST NOT send it to ai.ollama_urls.

Scenario: Chat URLs set to the default Service

  • WHEN ai.ollama_urls holds DEFAULT_OLLAMA_CLUSTER_URL and ai.provider is ollama
  • THEN the request goes to DEFAULT_OLLAMA_EMBEDDING_CLUSTER_URL and no request goes to DEFAULT_OLLAMA_CLUSTER_URL.

Requirement: Configured embedding URL wins

A configured embedding URL SHALL win over the default embedding URL.

Scenario: An operator sets one embedding URL

  • WHEN the embedding URL setting holds one URL
  • THEN the engine sends every direct embedding request to that URL.

Requirement: Configure URLs writes the embedding URL

devops k8s configure-urls SHALL write DEFAULT_OLLAMA_EMBEDDING_CLUSTER_URL into the embedding URL setting.

Scenario: Configure URLs against a cluster

  • WHEN a person runs devops k8s configure-urls for a cluster
  • THEN the written configuration holds the embedding Service as the embedding URL and keeps the default Ollama Service only as a chat URL.

Requirement: Guard against a one-model tier

A test MUST fail when a default embedding URL names a tier that loads one chat model.

Scenario: The embedding URL names the 48 GiB tier

  • WHEN DEFAULT_OLLAMA_EMBEDDING_CLUSTER_URL is set to the URL of a tier that loads one chat model
  • THEN the test fails and names that tier.

Existing Tool Considered

No alternatives check has run. Kubernetes NetworkPolicy covers the admission rule, and the LiteLLM gateway covers the embedding route with DEFAULT_OLLAMA_EMBEDDING_CLUSTER_URL. The NetworkPolicy cannot see the model that a request names. The gateway cannot stop a client that calls the Ollama Service directly. The change builds no code beyond one setting, one resolver change and one test.

Key questions

  • Which setting does a direct Ollama embedding call read today?: _get_ollama_urls returns ai.ollama_urls, else ai.api_base_url. The provider ollama sends the embedding batch to those URLs. The default ai.ollama_urls that devops k8s configure-urls writes is the default Ollama Service, which is the 48 GiB tier. [sources: src/devops_cli/ai/rag/embeddings.py:707, src/devops_cli/config/defaults.py:106, src/devops_cli/config/defaults.py:108]
  • Which Service is the default Ollama Service, and which model does its tier load?: DEFAULT_OLLAMA_CLUSTER_SERVICE is ollama-fast, and DEFAULT_OLLAMA_CLUSTER_URL is http://ollama-fast.llm.svc.cluster.local:11434. The archived change 3567 records that the default Ollama Service is the 48 GiB tier, and that tier loads qwen3.8:27b alone. [sources: src/devops_cli/config/defaults.py:106, src/devops_cli/config/defaults.py:108, openspec/changes/archive/2026-11-05-3567-one-model-48-64gib-tiers/design.md:10, openspec/changes/archive/2026-11-05-3567-one-model-48-64gib-tiers/proposal.md:18]
  • Which embedding URL and which gateway route already exist?: DEFAULT_OLLAMA_EMBEDDING_CLUSTER_URL names the embedding Service. The devops-embedding route of DEFAULT_GATEWAY_ROUTES uses it as its backend URL. The direct path has no such URL. [sources: src/devops_cli/ai/gateway.py:78, src/devops_cli/config/defaults.py, openspec/changes/archive/2026-11-05-3567-one-model-48-64gib-tiers/tasks.md:7]
  • Where must a direct embedding call go?: A direct embedding call goes to the embedding Service through a dedicated embedding URL setting. The direct path then matches the gateway route that 3567 delivered. (best practice) [sources: openspec/changes/archive/2026-11-05-3567-one-model-48-64gib-tiers/design.md:10, src/devops_cli/ai/gateway.py:78]
    • Chosen: Embedding Service through a dedicated URL setting. The archived change 3567 records that the default Ollama Service no longer serves an embedding model. The gateway route already uses DEFAULT_OLLAMA_EMBEDDING_CLUSTER_URL, so the direct path matches it.
    • Rejected: Send embedding calls through the gateway only. The gateway needs a URL, a key and a reachable port-forward. The direct Ollama path serves a cluster without the gateway, and change 2524 keeps it.
    • Rejected: Keep ai.ollama_urls and add only the test. The test would fail on the default configuration, and the default ollama provider would still reach the 48 GiB tier.
  • Which setting holds the embedding URL, and who writes it?: A new setting ai.embedding_ollama_urls holds the embedding URLs, and its default is [DEFAULT_OLLAMA_EMBEDDING_CLUSTER_URL]. devops k8s configure-urls writes it with the embedding Service and keeps ai.ollama_urls for chat. (best practice) [sources: src/devops_cli/commands/k8s/networking.py:501, src/devops_cli/config/defaults.py:106, src/devops_cli/ai/rag/embeddings.py:707]
    • Chosen: New setting ai.embedding_ollama_urls. It keeps the chat URLs and the embedding URLs apart, and devops k8s configure-urls writes each one to its own Service. The engine reads one list, and an error message shows it.
    • Rejected: Reuse ai.ollama_urls and swap the default Service at read time. A hidden rewrite of a person's setting is hard to see in the configuration file and in an error message.
    • Rejected: Reuse ai.api_base_url. That field is the base URL of an OpenAI-compatible endpoint, and the gateway provider reads it.
  • How does the test prove that a default embedding URL does not name a one-model tier?: The test reads the default embedding URL, resolves the tier that serves it, and asserts that the tier does not load exactly one chat model. It extends tests/ai/benchmark/test_k8s_llm_gateway.py, which already tests both URL constants. (best practice) [sources: tests/ai/benchmark/test_k8s_llm_gateway.py, openspec/changes/archive/2026-11-05-3567-one-model-48-64gib-tiers/design.md:10]
    • Chosen: Extend tests/ai/benchmark/test_k8s_llm_gateway.py. The file already tests DEFAULT_OLLAMA_EMBEDDING_CLUSTER_URL and the tier that serves it, and the 3567 design records a tier check there. One guard stays in one file.
    • Rejected: Add a new test module under tests/ai/rag/. It duplicates the tier check of the gateway test and splits one guard across two files.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/k8s
    status/new
    value/high
    effort/medium
    on Nov 5, 2026
  2. dan-petty commented on Nov 5, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/k8s. The (k8s) scope of the title gives the scope.
    • Priority: P1-High. A live path unloads the only chat model on the 48 GiB tier, breaking RAG and chat availability.
    • Value: High. Every direct embedding call can evict qwen3.8:27b, stopping both RAG and chat on that tier.
    • Effort: Medium. The fix touches URL configuration, NetworkPolicy rules, and adds a guard test across two subsystems.
    • Related: feat(k8s): the 48 GiB and 64 GiB Ollama tiers serve qwen3.8:27b alone #3567, which asks for a different change. Both concern the 48 GiB tier serving qwen3.8:27b alone; #3567 defines the tier rule, the candidate fixes a URL and NetworkPolicy path that bypasses it.
  3. added
    priority/p1-high
    on Nov 5, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 5, 2026
  5. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at ce689f4 (see proposed design in issue body).

    Moved to new items: #3583.

  6. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Staged: branch fix/3574-a-direct-embedding-call-must-not, draft pull request #3952. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:

    1. Send a direct embedding request to the embedding URL: 32225 tokens
    2. Configure URLs writes the embedding Service: 13656 tokens
    3. Guard the default embedding URL against a one-model tier: 8583 tokens
    4. Regenerate the configuration documents: 22184 tokens

    The runs of the planner and the review made 37 model request(s), and used 2153702 input tokens and 37163 output tokens. The tool calls, in order:

    1. read_file({"path":"src/devops_cli/config/defaults.py","start_line":80,"end_line":160})
    2. search_code({"text":"DEFAULT_OLLAMA_EMBEDDING_CLUSTER_URL"})
    3. search_code({"text":"ollama_urls"})
    4. search_code({"text":"get_ollama_urls"})
    5. search_code({"text":"\"ai.ollama_urls\""})
    6. search_code({"text":"def setting_default"})
    7. read_file({"path":"src/devops_cli/config/settings.py","start_line":700,"end_line":800})
    8. read_file({"path":"src/devops_cli/config/settings.py","start_line":1330,"end_line":1420})
    9. read_file({"end_line":700,"path":"src/devops_cli/config/settings.py","start_line":630})
    10. read_file({"end_line":380,"path":"src/devops_cli/commands/k8s/networking.py","start_line":280})
    11. read_file({"end_line":640,"path":"src/devops_cli/commands/k8s/networking.py","start_line":430})
    12. search_code({"text":"configure-urls"})
    13. read_file({"end_line":1230,"path":"src/devops_cli/commands/k8s/stack_lifecycle.py","start_line":1170})
    14. file_symbols({"path":"src/devops_cli/commands/k8s/networking.py"})
    15. read_file({"path":"tests/ai/benchmark/test_k8s_llm_gateway.py","start_line":1560,"end_line":1700})
    16. search_code({"text":"qwen3.8:27b"})
    17. search_code({"text":"_serving_tiers"})
    18. read_file({"end_line":1560,"path":"tests/ai/benchmark/test_k8s_llm_gateway.py","start_line":1440})
    19. read_file({"end_line":1960,"path":"tests/ai/benchmark/test_k8s_llm_gateway.py","start_line":1740})
    20. read_file({"end_line":80,"path":"tests/ai/benchmark/test_k8s_llm_gateway.py","start_line":1})
    21. list_files({"directory":"k8s/llm/profiles"})
    22. read_file({"end_line":140,"path":"tests/ai/benchmark/test_k8s_llm_gateway.py","start_line":78})
    23. read_file({"path":"k8s/llm/profiles/services.yaml"})
    24. search_code({"text":"def _tiers_of"})
    25. search_code({"text":"SINGLE_MODEL_TIERS"})
    26. read_file({"end_line":1010,"path":"tests/ai/benchmark/test_k8s_llm_gateway.py","start_line":920})
    27. read_file({"end_line":1740,"path":"tests/ai/benchmark/test_k8s_llm_gateway.py","start_line":1700})
    28. read_file({"path":"tests/config/test_service_url_defaults.py"})
    29. read_file({"path":"src/devops_cli/ai/rag/embeddings.py","start_line":700,"end_line":745})
    30. read_file({"end_line":860,"path":"src/devops_cli/config/settings.py","start_line":800})
    31. read_file({"end_line":620,"path":"src/devops_cli/config/settings.py","start_line":560})
    32. search_code({"text":"tasks.embedding.ollama_urls"})
    33. search_code({"text":"TASK_EMBEDDING_OLLAMA_URLS"})
    34. search_code({"text":"embedding_ollama_urls"})
    35. read_file({"path":"tests/security/test_config_declarations.py"})
    36. read_file({"path":"tests/security/test_config_declarations.py","start_line":168,"end_line":330})
    37. search_code({"text":"ENV_VARS.md"})
    38. search_code({"text":"ci docs"})
    39. search_code({"text":"def setting_variables"})
    40. search_code({"text":"Variable marker"})
    41. list_files({"directory":"tests/ai/rag"})
    42. list_files({"directory":"tests/commands/k8s"})
    43. search_code({"text":"_get_ollama_urls"})
    44. search_code({"text":"SINGLE_MODEL_TIERS"})
    45. read_file({"path":"src/devops_cli/ai/rag/embeddings.py","start_line":700,"end_line":740})
    46. search_code({"text":"ollama_urls"})
    47. search_code({"text":"def _tiers_of"})
    48. search_code({"text":"def get_ollama_urls"})
    49. search_code({"text":"_NODEPORT_KEYS_LLM"})
    50. search_code({"text":"_configure_llm_stack_urls"})
    51. search_code({"text":"DEFAULT_OLLAMA_EMBEDDING_CLUSTER_URL"})
    52. read_file({"path":"src/devops_cli/config/settings.py","start_line":700,"end_line":790})
    53. read_file({"path":"src/devops_cli/commands/k8s/networking.py","start_line":480,"end_line":660})
    54. read_file({"path":"src/devops_cli/config/defaults.py","start_line":100,"end_line":125})
    55. read_file({"path":"tests/ai/benchmark/test_k8s_llm_gateway.py","start_line":1590,"end_line":1640})
    56. read_file({"path":"tests/ai/benchmark/test_k8s_llm_gateway.py","start_line":1700,"end_line":1760})
    57. read_file({"path":"src/devops_cli/commands/k8s/networking.py","start_line":430,"end_line":480})
    58. search_code({"text":"def _update_ollama_urls"})
    59. search_code({"text":"embedding_no_ollama_urls"})
    60. file_symbols({"path":"tests/ai/rag/test_embedding_providers.py"})
    61. search_code({"text":"ollama_urls: Annotated"})
    62. read_spec({"capability":"configured-service-urls"})
    63. read_spec({"capability":"ai-gateway-routing"})
    64. search_code({"text":"def _resolve_accessible_url"})
    65. search_code({"text":"def _detect_service_url"})
    66. read_file({"path":"src/devops_cli/commands/k8s/networking.py","start_line":315,"end_line":365})
    67. find_issues({"terms":"embedding ollama_urls configure-urls"})
    68. list_files({"directory":""})
    69. read_file({"path":"src/devops_cli/config/defaults.py","start_line":95,"end_line":130})
    70. search_code({"text":"_get_ollama_urls"})
    71. search_code({"text":"def get_ollama_urls"})
    72. read_file({"path":"src/devops_cli/ai/rag/embeddings.py","start_line":690,"end_line":760})
    73. read_file({"path":"src/devops_cli/config/settings.py","start_line":700,"end_line":800})
    74. list_files({"directory":"tests/ai/rag"})
    75. list_files({"directory":"tests/ai/benchmark"})
    76. list_files({"directory":"k8s/llm/profiles"})
    77. list_files({"directory":"docs"})

    Tool calls: file_symbols=2 (empty=0), find_issues=1 (empty=1), list_files=8 (empty=0), read_file=32 (empty=0), read_spec=2 (empty=0), search_code=32 (empty=1)

    The stage job read the open pull requests and their files in 1 GraphQL request(s).

  7. added
    owner/service
    status/in-progress
    and removed
    status/ready
    on Nov 7, 2026
  8. 5 remaining items

  9. added
    owner/agent
    status/in-progress
    and removed
    status/blocked
    on Nov 18, 2026
  10. added 2 commits that reference this issue on Nov 18, 2026
    d6d3f9f
    ad30ed4
  11. added
    status/in-review
    and removed
    status/in-progress
    on Nov 18, 2026
  12. removed
    status/in-review
    owner/agent
    on Nov 18, 2026
  13. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-18 16:28 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p1-highscope/k8ssource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions