Skip to content

fix(infra): the cluster config has no infra.repos, so drift is a no-op #7460

Done

Description

@dan-petty

Problem Description

The daily infra-drift Workflow (#5129) checks no repository. devops k8s deploy-stack renders ConfigMap devops-cli-config from the template and copies only the section service from config.yaml (render_devops_configmap_content in src/devops_cli/k8s/configmap.py). The section infra never reaches the cluster. With no entry in infra.repos, run_drift_all (src/devops_cli/infra/drift.py) returns exit 0 and the message drift_all_no_repos. So the Workflow ends Succeeded and checks nothing.

Evidence, 2026-11-27

  • After fix(infra): add the push-secrets row of the infra-drift SSH key #7434 the owner pushed Secret devops/infra-ssh-key, and Workflow infra-drift-manual-nsc84 ran from cronwf/infra-drift. It ended Succeeded in 10 seconds (19:25:59 to 19:26:09 UTC). Loki holds no output line of devops infra drift --all for it.
  • The live ConfigMap has no key infra. The workstation config.yaml has one entry in infra.repos with agent_access: full.

Expected Behavior

  • deploy-stack copies infra.repos from config.yaml into the ConfigMap, as it does for service.repos. The repository names stay out of the committed template.
  • A scheduled run that has no eligible repository does not end green. devops infra drift --all exits non-zero when no entry of infra.repos has the access level plan or higher, and its message names the setting.

Acceptance Criteria

  • A test: the rendered ConfigMap holds the infra.repos entries of the settings, and a template with no infra section still renders.
  • A test: devops infra drift --all with no eligible entry exits non-zero and names infra.repos.
  • Pending a person or an agent after the release and deploy-stack: a Workflow from cronwf/infra-drift reads the environment repository and writes its drift report.

Related

Alternatives check of 2026-11-27: none.
Tool: none found.
Reason: Searches turned up only generic manifest and ConfigMap tooling such as Kustomize and ConfigMap generators; none copies the project's own infra.repos settings into the deployed ConfigMap or makes devops infra drift --all fail on an empty repo list, so the fix stays in this repository's renderer and drift command.

Lacks:

  • Copies a named section of this project's config.yaml into the ConfigMap
  • Renders a ConfigMap when the template has no infra section
  • Non-zero exit when no infra.repos entry is eligible

Proposed design

Problem statement

The daily infra-drift Workflow checks no repository. devops k8s deploy-stack renders ConfigMap devops-cli-config and copies only the service section from config.yaml, so the section infra never reaches the cluster. devops infra drift --all then finds no eligible entry and exits 0 with the message drift_all_no_repos, so the Workflow ends Succeeded and checks nothing.

Acceptance criteria

Requirement: Active settings reach the renderer

render_active_devops_configmap SHALL pass the infra.repos entries of the active settings to render_devops_configmap_content.

Scenario: Deploy-stack render holds the infra repos

  • WHEN The settings hold one infra repo at agent_access: full, and render_active_devops_configmap renders the product template k8s/devops/configmap.example.yaml.
  • THEN The rendered devops-cli.yaml holds an infra.repos list with that repo name and its access level.

Requirement: The renderer writes the infra section

The renderer SHALL replace the infra.repos list of the template with the entries that the caller passes.

Scenario: The template's own repo name leaves the render

  • WHEN The template's config holds infra.repos with the repo example/one, and the caller passes the repo example/two at agent_access: plan.
  • THEN The rendered config holds example/two at plan, holds no example/one, and Settings.model_validate accepts the rendered config.

Requirement: A template with no infra section

The renderer MUST render a template whose config holds no infra section when the settings hold no infra repo.

Scenario: A cluster with no infra repo renders

  • WHEN The settings hold no infra.repos entry, and the template's config holds no infra section.
  • THEN The render returns a manifest whose devops-cli.yaml holds no infra key, and Settings.model_validate accepts it.

Requirement: Drift exit code with no eligible repo

run_drift_all SHALL return exit code 1 when no entry of infra.repos has agent_access of plan or higher.

Scenario: No eligible infra repo

  • WHEN devops infra drift --all runs with every infra.repos entry at agent_access: none.
  • THEN The command exits 1 and prints No repo in infra.repos has agent access level plan or higher.

Requirement: Pending a person after the merge

The cluster MUST run the drift check of the environment repository from CronWorkflow cronwf/infra-drift after the release and deploy-stack.

Scenario: The scheduled drift reads the environment repo

  • WHEN A person triggers Workflow infra-drift-manual from CronWorkflow cronwf/infra-drift in namespace devops after the release and deploy-stack.
  • THEN The Workflow ends Succeeded, and its pod log holds the report line of devops infra drift --all for the environment repository.

Existing Tool Considered

The alternatives check of 2026-11-27 in the issue body gives the verdict none, and it names no tool. The check found no open tool that reads the infra.repos settings of this project or that fails the drift command on an empty list. The proposal keeps the fix in render_devops_configmap_content and run_drift_all. The written cost is about 3,000 tokens to build the two edits and the four tests. The keep and fix of that code costs about 1,500 tokens a year, and the elapsed time is about half a day.

Key questions

  • Which code writes the infra.repos entries into the ConfigMap?: render_devops_configmap_content writes the section, as it writes service. render_active_devops_configmap passes the entries of the active settings. The renderer writes each entry as the model dump of the settings entry, so the validation of the rendered config accepts it. (best practice) [sources: src/devops_cli/k8s/configmap.py:81, src/devops_cli/config/settings.py:2759, tests/k8s/test_k8s_configmap.py]
    • Chosen: Set the section in the renderer from the settings. The renderer already replaces service from the settings, and its validation of the rendered config catches a bad entry.
    • Rejected: Keep the section in the committed template. The repository names would enter git, which the issue forbids.
    • Rejected: Mount config.yaml in the cluster as a whole. It puts credentials and workstation-only settings into the cluster.
  • Which exit code does devops infra drift --all return when no infra.repos entry is eligible?: Exit code 1. run_drift_all returns 0 today, and the spec gives 1 for a failure. The message No repo in infra.repos has agent access level plan or higher. already names the setting, so only the return value changes. (best practice) [sources: openspec/specs/infra-drift/spec.md, src/devops_cli/infra/drift.py:268, src/devops_cli/lang/en/messages.py:1553]
    • Chosen: Exit 1, the failure code. The spec gives 1 for a failure, and a missing configuration is a failure.
    • Rejected: Exit 0, as today. A no-op that ends green hides the misconfiguration.
    • Rejected: Exit 2, the drift code. No host has drift, so 2 would report a drift that does not exist.
  • Which fields does each infra.repos entry hold in the ConfigMap?: Each entry holds repo, path and agent_access, as the settings model dumps it with no None value. The drift gate reads agent_access, and the target resolution reads path. A field that the settings leave unset keeps its model default. (best practice) [sources: src/devops_cli/infra/drift.py, src/devops_cli/config/settings.py:2759, CONTEXT.md]
    • Chosen: The model dump of each settings entry. The drift command reads the same fields, and the model dump keeps the settings validation.
    • Rejected: The repository names alone. The drift gate would read no access level, so each entry would fall to none.
  • How does the live proof show that the cluster reads the environment repository?: A person triggers Workflow infra-drift-manual from CronWorkflow cronwf/infra-drift after the release and deploy-stack. The pod log must hold the report line of devops infra drift --all. The spec already asks for a live drift check on the environment repository. (best practice) [sources: openspec/specs/infra-drift/spec.md, src/devops_cli/infra/drift.py]
    • Chosen: One manual Workflow run and its pod log. It reads the deployed ConfigMap, the Secret and the egress of the drift pod in one run.
    • Rejected: Wait for the next daily schedule. It delays the proof by up to one day and gives no faster signal.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    scope/infra
    source/agent
    status/new
    value/medium
    effort/medium
    priority/p2-medium
    on Nov 27, 2026
  2. devops-cli-service commented on Nov 27, 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)

    Searches run:

    • open source infrastructure drift detection tool git repositories, results: 5
    • python render Kubernetes ConfigMap from YAML config file section, results: 5
    • kustomize configMapGenerator from env file or literals, results: 5
    • driftctl detect unmanaged infrastructure drift, results: 5
    • Kubernetes ConfigMap generator kustomize documentation, results: 5
    • kubernetes-sigs kustomize configMapGenerator behavior envs files, results: 5
    • Argo CD drift detection out of sync automation, results: 5
    • python kubernetes client create configmap yaml manifest library, results: 5
    • snyk driftctl infrastructure as code drift github, results: 5
    • kustomize configMapGenerator configmap from files kubernetes.io docs, results: 5

    Sources:

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

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

    @devops-cli-service
    Contributor

    Live since 2026-11-28 23:51 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/p2-mediumscope/infrasource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions