Skip to content

chore(k8s): remove the unused Portkey gateway and provider #5007

Done

Description

@dan-petty

Update 2026-11-26 (infra move): the Portkey manifests go to dan-petty/homelab.

This issue keeps the removal of the provider and of ai.portkey_url from src/ with its tests, documents and specs, and of the three llm/portkey/ lines of MANIFESTS_BY_STACK. k8s/llm/portkey/ and its kustomization and NetworkPolicy lines are deleted in homelab. Merge the two changes together, else deploy-stack can name a missing file.

Follow-up: dan-petty/homelab#288.


Problem or Motivation

Portkey has no client: 0 log lines in 7 d, no route, egress only to Ollama, and the live config uses provider gateway. It holds 200m CPU and 256Mi of requests for 1m and 81Mi of use. It is one more gateway to patch and document, and no ADR keeps it. This item is rank 17 of the cluster integration plan #4989.

Proposed Solution & Architectural Design

  1. Delete the llm/portkey/ lines of MANIFESTS_BY_STACK. The manifests are deleted in dan-petty/homelab.
  2. Remove the portkey provider from src/devops_cli (9 files).
  3. Add ai.portkey_url to CONST_REMOVED_CONFIG_KEYS, so that the load error names devops config unset ai.portkey_url.

Owner decision

After the merge, run devops config unset ai.portkey_url on each workstation config. The ai section refuses unknown keys, and agents never change config.yaml. The recommended answer on #4989 is yes.

Target Subsystem

AI & Agentic Review Pipeline (src/devops_cli, k8s/llm/).

Existing Tool Considered

The LiteLLM gateway already serves every route. Removal builds nothing.

Acceptance Criteria

  • git grep -i portkey finds only the removed-key entry, its test and the changelog.
  • A config with ai.portkey_url fails to load, and the error names devops config unset ai.portkey_url.
  • Argo CD prunes the Portkey objects.

Dependencies

None. Owner decision 4 on #4989 comes after the merge.

Source: #4989

Alternatives check of 2026-11-26: not-applicable.
Class: chore, no model call.
Tool: none found.

Proposed design

Problem statement

Portkey has no client: no route names it, it served no request in 7 days, and its traffic went only to Ollama. It holds 200m CPU and 256Mi of requests for 1m and 81Mi of use, it is one more gateway to patch and document, and no ADR keeps it. This item is rank 17 of the cluster integration plan #4989. The change removes the Portkey provider and ai.portkey_url from src/, updates tests, documents and specs, and removes the three llm/portkey/ lines of MANIFESTS_BY_STACK. dan-petty/homelab#288 deletes the manifests in homelab, and both changes merge together.

Acceptance criteria

Requirement: Cascade provider list

The cascade model MUST build with no Portkey provider and no ai.portkey_url.

Scenario: Cascade with no Portkey URL

  • WHEN A test builds the cascade model from settings with ai.portkey_url unset.
  • THEN The build raises no ConfigurationError, and CONST_AI_CASCADE_PROVIDERS holds no portkey entry.

Requirement: AI settings fields

The ai settings section MUST declare no portkey_url field.

Scenario: Fields of the ai section

  • WHEN A test reads the fields of the AIConfig settings model.
  • THEN The field names hold no portkey_url.

Requirement: Refused config key

A config that holds ai.portkey_url MUST fail to load and MUST name devops config unset ai.portkey_url.

Scenario: Loader refuses the removed key

  • WHEN A test passes a settings dict that holds ai.portkey_url to the config loader.
  • THEN The load fails, and the error text names devops config unset ai.portkey_url.

Requirement: Removed key record

CONST_REMOVED_CONFIG_KEYS MUST hold ai.portkey_url.

Scenario: Removed key map

  • WHEN A test reads CONST_REMOVED_CONFIG_KEYS.
  • THEN The map holds the key ai.portkey_url.

Requirement: Gateway provider constants

The gateway provider constants MUST hold no Portkey provider or Portkey URL setting.

Scenario: Gateway provider constants

  • WHEN A test reads CONST_AI_GATEWAY_PROVIDERS, CONST_AI_GATEWAY_PROVIDER_PORTKEY and CONST_AI_GATEWAY_URL_SETTINGS.
  • THEN The provider tuple holds no portkey, the Portkey provider constant is absent, and the URL settings map has no portkey key.

Requirement: Manifest stack entries

MANIFESTS_BY_STACK MUST hold no llm/portkey/ entry.

Scenario: Manifest stack list

  • WHEN A test reads MANIFESTS_BY_STACK.
  • THEN No value holds the text llm/portkey/.

Requirement: No Portkey reference

The live source, the documents, the research watch list and the live specs MUST hold no portkey reference, except the removed-key entry in src/devops_cli/config/constants.py.

Scenario: Search the live files at the branch head

  • WHEN A test runs ! git grep -n -i -F portkey src/ ':!src/devops_cli/config/constants.py' docs/CONFIGURATION.md docs/MCP_TOOLS.md docs/commands/ai.md docs/SERVICE_PATTERNS.md config.example.yaml k8s/README.md .devops/research-watch.toml openspec/specs/ at the branch head.
  • THEN The test passes and the command prints no line.

Requirement: Generated documents

The generated settings and command documents MUST hold no Portkey row.

Scenario: The docs check

  • WHEN uv run devops ci --check --only docs runs on the branch after uv run devops docs generate.
  • THEN The docs row reports success.

Requirement: Pending a person after the merge

Each workstation config MUST no longer hold ai.portkey_url after the merge.

Scenario: Workstation config cleanup

  • WHEN After the merge, a person runs devops config unset ai.portkey_url on each workstation config.
  • THEN The command succeeds, and the next settings load reports no error.

Requirement: Pending a person after the merge

The change MUST merge together with dan-petty/homelab#288, which deletes the Portkey manifests.

Scenario: Coordinated merge and cluster prune

  • WHEN A person merges this change and dan-petty/homelab#288 together.
  • THEN Argo CD prunes the Portkey objects, and kubectl get deployment,service,configmap -A -o name | grep -i portkey returns no line.

Existing Tool Considered

The alternatives check of 2026-11-26 in the issue body gives verdict not-applicable and names no tool. The change removes code and adds one removed-key entry, so it builds no tool or library: the cost is 0 tokens and 0 elapsed time. The LiteLLM gateway already serves every remaining route.

Key questions

  • Which live files hold the Portkey provider and the ai.portkey_url setting that the change removes?: The code holds the Portkey constants in src/devops_cli/config/constants.py and the portkey_url field in src/devops_cli/config/settings.py. The router holds the Portkey URL and provider branches in src/devops_cli/ai/gateway.py, and the spend report reads the URL in src/devops_cli/ai/spend/pricing.py. The bridge and the --provider help also name it. The documents and live specs are config.example.yaml, docs/CONFIGURATION.md, docs/MCP_TOOLS.md, docs/commands/ai.md, docs/SERVICE_PATTERNS.md, k8s/README.md, .devops/research-watch.toml, openspec/specs/ai-gateway-routing/spec.md and openspec/specs/k8s-network-policies/spec.md. [sources: src/devops_cli/config/constants.py, src/devops_cli/config/settings.py, src/devops_cli/ai/gateway.py, src/devops_cli/ai/spend/pricing.py, src/devops_cli/ai/pydantic_ai_bridge.py, src/devops_cli/commands/ai_gateway.py, config.example.yaml, docs/CONFIGURATION.md, docs/MCP_TOOLS.md, docs/commands/ai.md, docs/SERVICE_PATTERNS.md, k8s/README.md, .devops/research-watch.toml, openspec/specs/ai-gateway-routing/spec.md, openspec/specs/k8s-network-policies/spec.md]
  • Does the load error name devops config unset ai.portkey_url without an entry in CONST_REMOVED_CONFIG_KEYS?: Yes. _describe in src/devops_cli/config/unknown_keys.py builds devops config unset <dotted key> for each key that a section refuses. _reason adds a release only when the removed-key map holds the key. A config with ai.portkey_url therefore fails to load and names the command before the map entry exists. The change adds the map entry to record the release. [sources: src/devops_cli/config/unknown_keys.py, src/devops_cli/config/constants.py, docs/CONFIGURATION.md]
  • Must the change remove portkey from CONST_AI_CASCADE_PROVIDERS in the same pull request?: Yes. The tuple holds (litellm, portkey, ollama) today. The bridge reads ai.portkey_url for the Portkey member. A cascade member with an unset URL raises a ConfigurationError. The same pull request removes the member. (best practice) [sources: src/devops_cli/config/constants.py, src/devops_cli/ai/pydantic_ai_bridge.py]
    • Chosen: Remove the member in this change. The cascade model fails as soon as a person unsets ai.portkey_url, which is the owner's step after the merge.
    • Rejected: File a separate item for the tuple. It leaves the cascade model broken between two merges.
  • Does the change update the live specs that name Portkey?: Yes. openspec/specs/ai-gateway-routing/spec.md says a configured gateway has the origin of ai.gateway_url or ai.portkey_url. openspec/specs/k8s-network-policies/spec.md requires the Portkey perimeter NetworkPolicy. The change edits both with the removal, so no live requirement names a setting or a policy that no longer exists. (best practice) [sources: openspec/specs/ai-gateway-routing/spec.md, openspec/specs/k8s-network-policies/spec.md]
    • Chosen: Edit both live specs in this change. Both requirements name a setting and a manifest that the change deletes.
    • Rejected: Leave the specs for a later item. The live spec then requires a setting that no config can hold and a policy that no manifest declares.
  • Must the change remove the note about the portkeyai/gateway image from .devops/research-watch.toml?: Yes. The file holds no watch entry for the image. Line 30 is the last item of the Not mapped comment at lines 28-30. The change removes that item because the image leaves the repository. (best practice) [sources: .devops/research-watch.toml]
    • Chosen: Remove the Not mapped item. The note names an image that no manifest pins after the change.
    • Rejected: Keep the note. It documents an image that the project no longer deploys.
  • Which Portkey references stay in the tree?: Keep CHANGELOG.md, docs/SELF_IMPROVEMENT.md and the archived OpenSpec changes under openspec/changes/archive/. They record a past release or a past scan. The change removes live references only. (best practice) [sources: CHANGELOG.md, docs/SELF_IMPROVEMENT.md, openspec/changes/archive/2026-10-27-2046-portkey-unused-config/proposal.md]
    • Chosen: Keep the release and scan records. A changelog entry and a remediated finding record a past release, not a live reference.
    • Rejected: Rewrite the records. It edits the history that release-please writes and the record of a past finding.
  • How does the change handle ai.portkey_url on workstation configs after the merge?: The change adds ai.portkey_url to CONST_REMOVED_CONFIG_KEYS, so the load error names devops config unset ai.portkey_url. After the merge, a person runs that command on each workstation config. Agents never change config.yaml. (best practice) [sources: src/devops_cli/config/unknown_keys.py, src/devops_cli/config/constants.py, docs/CONFIGURATION.md]
    • Chosen: Add the key to the removed-key map and let a person unset it after the merge. The ai section refuses unknown keys, and an agent must not change config.yaml.
    • Rejected: Change config.yaml in this pull request. The repository rules forbid an agent from changing config.yaml.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/chore
    scope/k8s
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p3-low
    on Nov 12, 2026
  5. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor

    New evidence (2026-11-13, read-only investigation of the LiteLLM gateway):

    • The local ai.portkey_url holds the same URL as ai.gateway_url. Thus devops ai gateway status and devops ai gateway routes --provider portkey probe LiteLLM, not Portkey.
    • Portkey has no clients and no route to LiteLLM. No Ingress names Portkey, and k8s/llm/portkey/networkpolicy.yaml allows egress only to Ollama port 11434 and DNS. Loki over 7 days: 16 Portkey lines, all from the 2026-11-12T14:29Z rollout, and no request. No x-portkey-* header is in src.
    • CONST_AI_CASCADE_PROVIDERS = (litellm, portkey, ollama) (src/devops_cli/config/constants.py:2951) uses ai.portkey_url for its second step, so the cascade calls LiteLLM a second time.
    • The removal must also drop portkey from CONST_AI_CASCADE_PROVIDERS. If not, the model cascade fails with a ConfigurationError when the URL is unset (src/devops_cli/ai/pydantic_ai_bridge.py:84-90, 302-307).
  6. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Alternatives check: not-applicable

    Class: chore. The check makes no search and no model call for an item of this class.

    Tool: none found

    Checked on 2026-11-15. A person decides what this means for the item. The check changes no label and closes no issue.

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

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  8. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  9. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  10. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  11. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 29, 2026
  12. removed
    status/in-review
    on Nov 29, 2026
  13. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 16:50 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/p3-lowscope/k8ssource/agenttype/chorevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions