Skip to content

fix(k8s): catalog of an environment tree lists no product SLO #7313

Done

Description

@dan-petty

Problem

devops k8s catalog reads SLO specs only from <environment tree>/devops/monitoring/slos. The product specs stay in k8s/devops/monitoring/slos of this repository (#7290), and an environment repository holds no devops/ folder. A catalog of that tree lists no SLO. The command warns and succeeds.

Done when

  • Decide the source of the product SLO specs, then a catalog of an environment tree lists them, or the document says that it does not.

Alternatives check of 2026-11-26: none.
Tool: none found.
Reason: Searches found SLO rule generators and a spec format (Sloth, Pyrra, OpenSLO), but each renders Prometheus rules or defines SLO YAML; none reads a product repository's SLO specs into an environment-tree catalog, so the source decision stays the project's own.

Lacks:

  • No read of product repo SLO specs from a tree path
  • No catalog document listing products and their SLOs
  • No answer to which tree the catalog should read

Proposed design

Problem statement

devops k8s catalog reads SLO specs only from devops/monitoring/slos of the environment tree. The product specs live in k8s/devops/monitoring/slos of the devops-cli repository, and an environment repository holds no devops/ folder, so a catalog of that tree lists no SLO and only warns. The change reads the SLO specs of the environment tree and of the product base that resolve_product_root() gives, names the root and the path of each SLO in the document, and warns only when both roots hold none.

Acceptance criteria

Requirement: Product SLO source

devops k8s catalog SHALL list each Sloth spec under monitoring/slos of the product base k8s/devops for an environment tree that holds no devops/monitoring/slos.

Scenario: A tree with no devops folder

  • WHEN a test runs devops k8s catalog --format json --k8s-dir <tree> from a temporary repository whose k8s/devops/monitoring/slos holds roadmap-service-rounds.yaml and whose tree holds a catalog.toml entry for roadmap-service and no devops/monitoring/slos
  • THEN the JSON slos list holds one entry whose name is the name of that spec and whose service is roadmap-service

Requirement: Environment tree override

An SLO spec of the environment tree MUST replace the product spec that holds the same service and SLO name.

Scenario: One SLO in both roots

  • WHEN a test builds the catalog for a tree whose devops/monitoring/slos/roadmap-service-rounds.yaml holds service = "roadmap-service" and SLO name = "rounds" with objective 99.9, and the product base holds a spec with the same service and name and objective 99
  • THEN the catalog holds one SLO entry for that service and name, its objective is 99.9%, and its source starts with tree:

Requirement: Source in the document

The catalog document MUST name the root and the path of each SLO that it lists.

Scenario: A product SLO in the document

  • WHEN a test renders the catalog document for a tree with no devops/monitoring/slos and a product base whose monitoring/slos holds roadmap-service-rounds.yaml
  • THEN the SLO table row for that spec holds product:monitoring/slos/roadmap-service-rounds.yaml in its Source column

Requirement: Warning only when both roots hold none

devops k8s catalog SHALL warn about missing SLO specs only when the environment tree and the product base both hold none.

Scenario: Both roots empty

  • WHEN a test runs devops k8s catalog --format json --k8s-dir <tree> from a temporary repository whose k8s/devops holds no monitoring/slos, and the tree holds no devops/monitoring/slos
  • THEN the JSON slos list is empty and standard error holds one warning that names devops/monitoring/slos and k8s/devops/monitoring/slos

Requirement: Generated command page

The command page of devops k8s catalog and docs/CLI_REFERENCE.md SHALL state the two SLO roots of the command.

Scenario: Docs regeneration

  • WHEN the command help text names devops/monitoring/slos and k8s/devops/monitoring/slos, uv run devops docs generate has regenerated the pages, and uv run devops ci --check --only docs runs
  • THEN uv run devops ci --check --only docs exits 0 with the regenerated command page and CLI reference

Existing Tool Considered

No open, maintained tool or library covers the need. The alternatives check of 2026-11-26 records the verdict none, and the closest tools it considered each stop short: Sloth (https://github.com/slok/sloth) and Pyrra (https://github.com/prometheus-community/pyrra) render Prometheus rules from SLO specs, and OpenSLO (https://github.com/OpenSLO/OpenSLO) defines an SLO document format; none reads the SLO specs of an environment tree and a product base into a service catalog document. The alternatives block of the issue body lists what no tool covers. The change builds its own code: it reads monitoring/slos of the product base as a second folder for _load_and_join_slos, merges the two sets, and adds a source field to each SLO summary. Cost of the code that the project builds and keeps: about 15k tokens to build, keep and fix it, and about 3 hours of elapsed time.

Key questions

  • Which source holds the product SLO specs that a catalog of an environment tree lists?: The catalog reads two roots: devops/monitoring/slos under the environment tree root, and monitoring/slos under the product base that resolve_product_root() gives, which is k8s/devops of the repository of the current folder. The product specs are k8s/devops/monitoring/slos, so the folder under the product base is monitoring/slos and not the tree-relative devops/monitoring/slos. A catalog run from the devops-cli checkout therefore lists the product SLOs of an environment tree; a run inside an environment repository, which holds no k8s/devops, reads the tree only, and the warning and the command page say so. (best practice) [sources: src/devops_cli/k8s/environment.py:194, src/devops_cli/commands/grafana.py:285, src/devops_cli/prometheus/slo_rules.py:9, src/devops_cli/k8s/catalog.py:35]
    • Chosen: Environment tree, then the product base of the current repository. devops grafana dashboards already reads its content from the environment tree and then from the product base of the current repository (src/devops_cli/commands/grafana.py:285), and resolve_product_root gives that base (src/devops_cli/k8s/environment.py:194). The product specs are a folder of the product base, k8s/devops/monitoring/slos (src/devops_cli/prometheus/slo_rules.py:9).
    • Rejected: The environment tree only, and document the gap. An environment repository holds no devops/ folder, so every catalog of a tree would list no SLO, which is the gap this issue closes.
    • Rejected: Add a --product-dir option to devops k8s catalog. The dashboards read the product base with no such option (src/devops_cli/commands/grafana.py:293), and a catalog of a tree runs from the devops-cli checkout or names the tree with --k8s-dir, so a second option adds CLI surface and regenerated docs for a case that the command page can state.
    • Rejected: The product base only. The SLO specs that an environment tree holds, and the override of a product objective that the SRE guideline gives the environment, would be lost.
  • Which root wins when the environment tree and the product base hold the same SLO?: The environment tree wins: its spec replaces the product spec with the same service and SLO name, and the catalog drops the product spec before the two sets are joined. The SRE guideline gives the environment tree the SLO objectives that differ from a default, and load_slo_specs refuses two specs with one service and one SLO name, so the merge must keep one of the pair. (best practice) [sources: docs/guidelines/sre.md:3, src/devops_cli/prometheus/slo_rules.py:199, src/devops_cli/k8s/catalog.py:850]
    • Chosen: The environment tree wins. docs/guidelines/sre.md:3 gives the README of the environment tree the SLO objectives that differ from a default, and the rule labels carry the service and the SLO name (src/devops_cli/prometheus/slo_rules.py:199), so one pair has one spec.
    • Rejected: The product base wins. The environment could then not set an objective that differs from the product default, which the SRE guideline gives it.
    • Rejected: Refuse the pair with an error. A tree that tunes a product SLO would fail every catalog run, though the SRE guideline expects that override.
  • Which code resolves the path of the shipped product base k8s/devops for the devops k8s commands?: resolve_product_root in src/devops_cli/k8s/environment.py:194: the product_dir argument when given, else k8s/devops of the repository that holds the current folder, from _PRODUCT_BASE at src/devops_cli/k8s/environment.py:34 and the branch at src/devops_cli/k8s/environment.py:200. devops grafana calls it with no argument (src/devops_cli/commands/grafana.py:293) and devops k8s deploy-stack passes its --product-dir option (src/devops_cli/commands/k8s/stack_lifecycle.py:1492). The SLO folder under that base is monitoring/slos, so the specs are k8s/devops/monitoring/slos (src/devops_cli/prometheus/slo_rules.py:9). [sources: src/devops_cli/k8s/environment.py:194, src/devops_cli/k8s/environment.py:34, src/devops_cli/k8s/environment.py:200, src/devops_cli/commands/grafana.py:293, src/devops_cli/commands/k8s/stack_lifecycle.py:1492, src/devops_cli/prometheus/slo_rules.py:9]
  • How does the catalog document say which root an SLO came from?: The SLO table gains a Source column that holds the root name and the path of the spec under that root: tree:devops/monitoring/slos/<file> for the environment tree and product:monitoring/slos/<file> for the product base. Both paths are relative to their root, so the generated CATALOG.md stays the same on every machine that --check compares. (best practice) [sources: src/devops_cli/k8s/catalog.py:1037, src/devops_cli/k8s/catalog.py:188, src/devops_cli/k8s/catalog.py:35]
    • Chosen: A root-labelled relative path. The two roots give the same relative path in different repositories, so the tree: and product: labels keep the origin readable, and a relative path keeps the generated file stable across machines.
    • Rejected: An absolute path. CATALOG.md is generated and compared with --check (src/devops_cli/commands/k8s/catalog.py:96), so an absolute path would differ per machine and host.
    • Rejected: No source column. With two roots and an override, a reader could not tell which root a listed SLO came from.
  • Must the change update the documents that name the SLO source?: Yes, in the same pull request. k8s/README.md states the two roots in its SLO paragraph, the command help text names them, and uv run devops docs generate regenerates docs/commands/k8s.md and docs/CLI_REFERENCE.md before uv run devops ci --check --only docs. The change's spec delta replaces the requirement A tree with no SLO folder is said (openspec/specs/k8s-service-catalog/spec.md:135) with the both-roots rule, and the warning message in src/devops_cli/lang/en/messages.py:806 names both folders. (best practice) [sources: AGENTS.md:14, k8s/README.md:156, openspec/specs/k8s-service-catalog/spec.md:135, src/devops_cli/lang/en/messages.py:806, src/devops_cli/commands/k8s/catalog.py:67]
    • Chosen: Update the documents in the same pull request. AGENTS.md rule 8 makes a wrong document part of the same change, and the generated command page is refused by the docs row when it is not the output of its generator.
    • Rejected: Leave the documents unchanged. k8s/README.md and the generated command page would still name the environment tree as the only source, which the change makes wrong.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor
  2. added
    type/bug
    scope/k8s
    source/agent
    status/new
    value/medium
    effort/low
    priority/p2-medium
    on Nov 26, 2026
  3. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    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 (10)

    Tools considered:

    Searches run:

    • OpenSLO specification tooling catalog SLO definitions, results: 5
    • open source tool generate SLO specs from Kubernetes directory Prometheus, results: 5
    • Pyrra SLO Kubernetes operator, results: 5
    • Sloth Prometheus SLO generator Kubernetes CRD, results: 5
    • OpenSLO openslo github, results: 5
    • sloth slok github SLO generator, results: 5
    • SLO as code tool, results: 5
    • Sloth SLO, results: 5
    • Pyrra SLO, results: 5
    • SLO catalog open source list service level objectives from files, results: 5

    Sources:

  4. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  5. 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.

  6. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 29, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 29, 2026
  8. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 03:13 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/lowpriority/p2-mediumscope/k8ssource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions