Skip to content

fix(k8s): ignore the CNPG monitoring ConfigMap as an Argo CD orphan #5303

Closed

Description

@dan-petty

Problem Description

The Argo CD Applications llm, open-webui and qdrant show OrphanedResourceWarning: Application has 1 orphaned resources since 2026-11-06T06:42:01Z. The Application mattermost shows the same warning since 2026-10-31T21:23Z.

The orphan is the ConfigMap cnpg-default-monitoring. The CloudNativePG operator copies its default monitoring queries into each namespace that has a Cluster. The gateway database Cluster llm-gateway-db came on 2026-11-06, and the ConfigMap llm/cnpg-default-monitoring was created at 2026-11-06T06:42:00Z. The copy has the label app.kubernetes.io/managed-by=cloudnative-pg, no ownerReferences and no Argo CD tracking id. It is not in git.

The AppProject homelab warns on orphans (k8s/argocd/apps/projects.yaml:54-56), and its ignore list does not hold this name. The warning hides a real orphan among the expected ones.

Reproduction Steps

  1. Run kubectl get application -n argocd llm open-webui qdrant mattermost -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.conditions}{"\n"}{end}'.
  2. Run kubectl -n llm get configmap cnpg-default-monitoring -o yaml and read its labels and ownerReferences.

Expected vs Actual Behavior

Expected: Argo CD does not report the ConfigMap that the CloudNativePG operator writes as an orphan.

Actual: 4 Applications show OrphanedResourceWarning for cnpg-default-monitoring.

Environment Diagnostics

  • DevOps CLI Version: 0.124.0
  • Execution Environment: homelab Kubernetes cluster, managed by Argo CD, with the CloudNativePG operator

Logs, Traces, or Terminal Output

# kubectl get application -n argocd (2026-11-13)
llm, open-webui, qdrant: OrphanedResourceWarning: Application has 1 orphaned resources (since 2026-11-06T06:42:01Z)
mattermost:              OrphanedResourceWarning (since 2026-10-31T21:23Z)
devops:                  Application has 7 orphaned resources (since 2026-11-12T22:41:21Z)

Proposed Fix

  • k8s/argocd/apps/projects.yaml:56: add {group: '', kind: ConfigMap, name: cnpg-default-monitoring} to spec.orphanedResources.ignore of the AppProject homelab.
  • Do not set disableDefaultQueries on the Clusters. The default CloudNativePG metrics feed the database alerts.
  • Out of scope for the manifest change: the 7 orphans of the Application devops are the manual Jobs fix-plan-validate-*, and the ignore list covers only devops-cli-* Jobs. Delete the finished manual Jobs after use.

Acceptance Criteria

  • After the sync, the Applications llm, open-webui, qdrant and mattermost show no OrphanedResourceWarning for cnpg-default-monitoring.
  • The ConfigMap stays in place, and cnpg_collector_up and the default CloudNativePG metrics still have samples.
  • orphanedResources.warn stays true, so Argo CD still reports other orphans.

Alternatives check of 2026-11-16: in-use.
The repository already uses this tool.
Tool: argoproj/argo-cd (https://github.com/argoproj/argo-cd), Apache-2.0, last activity 2026-11-16, maintained.

Proposed design

Problem statement

Add {group: '', kind: ConfigMap, name: cnpg-default-monitoring} to the spec.orphanedResources.ignore list of the AppProject homelab. The CloudNativePG operator writes this ConfigMap into each namespace that has a Cluster. The ConfigMap has no ownerReferences and no Argo CD tracking id, so Argo CD reports it as an orphan. The Applications llm, open-webui, qdrant and mattermost show OrphanedResourceWarning for it, and the warning hides a real orphan among the expected ones.

Acceptance criteria

Requirement: The k8s manifests pass the k8s check

The changed k8s manifests MUST pass the k8s check.

Scenario: The k8s check passes on the change

  • WHEN uv run devops ci --check --only k8s runs on the change
  • THEN the command exits 0 and shows the k8s check as passed

Requirement: The homelab AppProject ignores the monitoring ConfigMap

The AppProject homelab SHALL list {group: '', kind: ConfigMap, name: cnpg-default-monitoring} in spec.orphanedResources.ignore.

Scenario: The AppProject shows the ignore entry after the sync

  • WHEN A person runs kubectl -n argocd get appproject homelab -o jsonpath='{.spec.orphanedResources.ignore}' after the sync
  • THEN the output holds cnpg-default-monitoring in the ignore list

Requirement: The four Applications report no orphan for the ConfigMap

The Applications llm, open-webui, qdrant and mattermost MUST show no OrphanedResourceWarning condition.

Scenario: The Applications show no orphan condition for the ConfigMap

  • WHEN A person runs kubectl get application -n argocd llm open-webui qdrant mattermost -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.conditions}{"\n"}{end}' after the sync
  • THEN the output shows no OrphanedResourceWarning condition for these four Applications

Requirement: The monitoring ConfigMap stays in place

The ConfigMap cnpg-default-monitoring MUST stay in the namespace llm with the label app.kubernetes.io/managed-by=cloudnative-pg.

Scenario: The operator keeps the ConfigMap

  • WHEN A person runs kubectl -n llm get configmap cnpg-default-monitoring -o yaml after the sync
  • THEN the command returns the ConfigMap with its CloudNativePG label

Requirement: The default CloudNativePG queries stay enabled

The Clusters MUST NOT set disableDefaultQueries, so the default monitoring queries stay active.

Scenario: The gateway database Cluster keeps the default queries

  • WHEN A person runs kubectl -n llm get cluster llm-gateway-db -o yaml after the sync
  • THEN the output holds no disableDefaultQueries field

Requirement: The exporter keeps its samples

The metric cnpg_collector_up MUST keep a sample for llm/llm-gateway-db.

Scenario: Prometheus returns the exporter sample

  • WHEN A person runs uv run devops prometheus query 'cnpg_collector_up{namespace="llm"}' after the sync
  • THEN the query returns the value 1 for the pod llm-gateway-db-1

Requirement: Argo CD still warns on other orphans

The AppProject homelab MUST keep orphanedResources.warn set to true.

Scenario: The AppProject keeps the orphan warning on

  • WHEN A person runs kubectl -n argocd get appproject homelab -o jsonpath='{.spec.orphanedResources.warn}' after the sync
  • THEN the output is true

Existing Tool Considered

argoproj/argo-cd (https://github.com/argoproj/argo-cd), Apache-2.0, maintained, last activity 2026-11-16. The repository already uses Argo CD, and its AppProject spec.orphanedResources.ignore covers the need. The tool lacks a way to stop the CloudNativePG operator from creating the per-namespace ConfigMap. It adds no ownerReferences or tracking id to the ConfigMap. The ignore list is maintained by hand, so each new operator-managed resource needs its own entry.

Key questions

  • How does the change stop Argo CD from reporting the operator-written ConfigMap as an orphan?: Add the entry {group: '', kind: ConfigMap, name: cnpg-default-monitoring} to spec.orphanedResources.ignore of the AppProject homelab. (best practice) [sources: k8s/argocd/apps/projects.yaml:55, https://argo-cd.readthedocs.io/en/stable/user-guide/orphaned-resources/]
    • Chosen: AppProject orphanedResources.ignore. It is Argo CD's own mechanism, and the project already uses it for other operator-written resources.
    • Rejected: Set disableDefaultQueries on the Clusters. It removes the default monitoring queries, so cnpg_collector_up and the database alerts lose their samples.
    • Rejected: Patch the ConfigMap with an ownerReference or a tracking id. The CloudNativePG operator writes the ConfigMap and sets no ownerReference, so a patch is reverted.
  • Which fields does the ignore entry need for a core/v1 ConfigMap?: The entry has three fields: group: '' for the core group, kind: ConfigMap and name: cnpg-default-monitoring. Argo CD defines an ignore rule as a Group, a Kind and a Name, and the rule has no namespace field, so the one entry matches the ConfigMap of that name in every namespace. The existing entries of the homelab project use the same three fields (page fetched 2026-11-17). [sources: https://argo-cd.readthedocs.io/en/stable/user-guide/orphaned-resources/, k8s/argocd/apps/projects.yaml:58, k8s/argocd/apps/projects.yaml:95]
  • Does the change keep the default CloudNativePG monitoring queries?: Yes. The Cluster llm-gateway-db in k8s/llm/gateway-db.yaml sets no disableDefaultQueries, and the change sets none, so cnpg_collector_up and the default metrics keep their samples. The GatewayDatabaseDown alert and the CloudNativePG dashboard read that metric. (best practice) [sources: k8s/llm/gateway-db.yaml:79, k8s/monitoring/prometheus-values.yaml:739, k8s/README.md:656, tests/fixtures/prometheus_rules/llm_gateway_db_tests.yaml:21, openspec/specs/llm-gateway-database/spec.md:73]
    • Chosen: Keep the default queries. The default metrics feed the database alerts, and GatewayDatabaseDown reads cnpg_collector_up.
    • Rejected: Set disableDefaultQueries: true. It stops the default queries, so the alerts that read cnpg_collector_up lose their samples.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

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

    @dan-petty
    OwnerAuthor
    • Related: dan-petty/homelab#329, which asks for a different change. Both edit the homelab AppProject in projects.yaml for orphan handling, but 1646 restricts allowed kinds and sets up orphan reporting while the candidate adds one ConfigMap to the ignore list.
  3. added
    priority/p2-medium
    on Nov 13, 2026
  4. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: Argo CD already ships the exact mechanism the issue proposes: AppProject orphanedResources ignore rules, keyed by Group, Kind and Name, prevent a resource from being reported as an orphan. The issue's body names Argo CD (and its AppProject ignore list) as a tool the homelab already runs, so the need is covered by a tool already in use rather than by new code.

    The repository already uses this tool.

    Tool: argoproj/argo-cd (https://github.com/argoproj/argo-cd)

    • License: Apache-2.0
    • Last activity: 2026-11-16
    • Maintained: yes

    Covers:

    • AppProject spec.orphanedResources.ignore rules suppress the OrphanedResourceWarning for a chosen group, kind and name (here group '', kind ConfigMap, name cnpg-default-monitoring)
    • The operator-managed ConfigMap and CloudNativePG's default monitoring queries stay in place, so cnpg_collector_up keeps its samples
    • orphanedResources.warn can stay true, so other orphaned resources are still reported

    Lacks:

    • Does not stop the CloudNativePG operator from creating the per-namespace cnpg-default-monitoring ConfigMap, and adds no ownerReferences or Argo CD tracking id to it
    • The ignore list is maintained by hand, so each new operator-managed resource needs its own entry

    Tools considered:

    Searches run:

    • Argo CD orphanedResources ignore ConfigMap AppProject, results: 5
    • CloudNativePG cnpg-default-monitoring ConfigMap Argo CD orphaned resource, results: 5
    • cloudnative-pg disable cnpg-default-monitoring configmap created in each namespace, results: 5

    Sources:

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

  5. added
    status/ready
    and removed
    status/new
    on Nov 17, 2026
  6. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

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

  7. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 18, 2026
  8. removed
    status/in-review
    on Nov 18, 2026
  9. 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/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