Skip to content

CNTRLPLANE-2202: Check for debug pod (regardless of ns) in default service account monitor test#30815

Open
ehearne-redhat wants to merge 2 commits intoopenshift:mainfrom
ehearne-redhat:fix-debug-pod-exception
Open

CNTRLPLANE-2202: Check for debug pod (regardless of ns) in default service account monitor test#30815
ehearne-redhat wants to merge 2 commits intoopenshift:mainfrom
ehearne-redhat:fix-debug-pod-exception

Conversation

@ehearne-redhat
Copy link
Contributor

@ehearne-redhat ehearne-redhat commented Feb 26, 2026

This fix addresses debug pod using default service account detection in https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/openshift_cluster-network-operator/2868/pull-ci-openshift-cluster-network-operator-master-4.22-upgrade-from-stable-4.21-e2e-azure-ovn-upgrade/2026955427433943040 .

Summary by CodeRabbit

  • Tests
    • Added an exception for the nmstate console plugin in authentication monitoring.
    • Improved detection of debug-related pods by checking pod names across all namespaces, enhancing test coverage and monitoring reliability.

@openshift-ci-robot
Copy link

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Feb 26, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Feb 26, 2026

@ehearne-redhat: This pull request references CNTRLPLANE-2202 which is a valid jira issue.

Details

In response to this:

This fix addresses debug pod detection using default service account in https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/openshift_cluster-network-operator/2868/pull-ci-openshift-cluster-network-operator-master-4.22-upgrade-from-stable-4.21-e2e-azure-ovn-upgrade/2026955427433943040 .

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2026

Walkthrough

Broadens a monitoring test exception: the check now treats any pod whose name contains "debug" as an exception regardless of namespace; related comment was generalized to match the new behavior.

Changes

Cohort / File(s) Summary
Exception Handler Logic
pkg/monitortests/authentication/nodefaultserviceaccountoperatortests/monitortest.go
Removed namespace-specific filtering from the debug-pod exception check so it matches any pod with "debug" in its name; updated accompanying comment to reflect generalized behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 inconclusive)

Check name Status Explanation Resolution
Stable And Deterministic Test Names ❌ Error Test names are dynamically generated using fmt.Sprintf with namespace names interpolated, violating the requirement for stable and deterministic test names across runs. Remove namespace name from test title and use a static, descriptive name instead; preserve namespace context in test output fields rather than the title.
Test Structure And Quality ❓ Inconclusive Custom check designed for traditional Ginkgo test files is inapplicable to monitor test analyzer implementing monitortestframework.MonitorTest interface. Clarify whether check applies only to Ginkgo test suites or define separate quality criteria for monitor test analyzers with specific interface implementation requirements.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: updating the default service account monitor test to check for debug pods regardless of namespace.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.5.0)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Feb 26, 2026

@ehearne-redhat: This pull request references CNTRLPLANE-2202 which is a valid jira issue.

Details

In response to this:

This fix addresses debug pod using default service account detection in https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/openshift_cluster-network-operator/2868/pull-ci-openshift-cluster-network-operator-master-4.22-upgrade-from-stable-4.21-e2e-azure-ovn-upgrade/2026955427433943040 .

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Feb 26, 2026

@ehearne-redhat: This pull request references CNTRLPLANE-2202 which is a valid jira issue.

Details

In response to this:

This fix addresses debug pod using default service account detection in https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/openshift_cluster-network-operator/2868/pull-ci-openshift-cluster-network-operator-master-4.22-upgrade-from-stable-4.21-e2e-azure-ovn-upgrade/2026955427433943040 .

Summary by CodeRabbit

  • Tests
  • Refined exception handling in authentication monitoring to recognize debug-related pods system-wide, enhancing test coverage and improving monitoring reliability.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from deads2k and p0lyn0mial February 26, 2026 17:29
@openshift-ci-robot
Copy link

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@ehearne-redhat
Copy link
Contributor Author

/retest

@neisw
Copy link
Contributor

neisw commented Feb 27, 2026

/approve

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 27, 2026
Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 27, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 27, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ehearne-redhat, everettraven, neisw

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ehearne-redhat
Copy link
Contributor Author

/hold

We seem to have missed one.

https://prow.ci.openshift.org/view/gs/test-platform-results/logs/periodic-ci-openshift-release-main-nightly-4.22-e2e-aws-ovn-serial-ipsec/2027144866420494336

openshift-nmstate/nmstate-console-plugin is using a default service account. I believe this one was missed as the script looked at its conformance test and didn't report the actual test itself.

I'm going to add this one and discuss this with my team on next steps.

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 27, 2026
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 27, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 27, 2026

New changes are detected. LGTM label has been removed.

@ehearne-redhat
Copy link
Contributor Author

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 27, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Feb 27, 2026

@ehearne-redhat: This pull request references CNTRLPLANE-2202 which is a valid jira issue.

Details

In response to this:

This fix addresses debug pod using default service account detection in https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/openshift_cluster-network-operator/2868/pull-ci-openshift-cluster-network-operator-master-4.22-upgrade-from-stable-4.21-e2e-azure-ovn-upgrade/2026955427433943040 .

Summary by CodeRabbit

  • Tests
  • Added an exception for the nmstate console plugin in authentication monitoring.
  • Improved detection of debug-related pods by checking pod names across all namespaces, enhancing test coverage and monitoring reliability.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@pkg/monitortests/authentication/nodefaultserviceaccountoperatortests/monitortest.go`:
- Around line 92-96: The current debug-pod detection in the anonymous function
(func(pod corev1.Pod) (string, bool)) uses strings.Contains(pod.Name, "debug")
and should be tightened; change the logic to detect true oc debug pods by either
using strings.HasSuffix(pod.Name, "-debug") or, preferably, checking for the
debug annotation on the Pod (presence of "debug.openshift.io/source-resource" in
pod.Annotations) and return the same exemption when that condition is met
instead of the broad substring match.

ℹ️ Review info

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 7c6a322 and 2203355.

📒 Files selected for processing (1)
  • pkg/monitortests/authentication/nodefaultserviceaccountoperatortests/monitortest.go

Comment on lines +92 to 96
// Handle the outlier manually
// This one checks if it is a debug pod or not.
func(pod corev1.Pod) (string, bool) {
if pod.Namespace == "openshift-commatrix-test" && strings.Contains(pod.Name, "debug") {
if strings.Contains(pod.Name, "debug") {
return "https://issues.redhat.com/browse/OCPBUGS-77201", true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

OpenShift oc debug command pod naming pattern identity metadata labels

💡 Result:

oc debug pod naming pattern

  • Debugging a workload/pod (e.g., oc debug pod/foo, oc debug deploy/bar, oc debug dc/baz): the debug pod name is typically <original-name>-debug (example: nbviewer-debug). [1]
  • Debugging a node (e.g., oc debug node/<node>): the debug pod name is formed from the node name with dots (.) replaced by dashes (-), with -debug appended. [2]
  • Node debugging may also create a temporary namespace with a generated name like openshift-debug-… / openshift-debug-node-… (implementation/detail varies by version/config). [3][4]

Identity / traceability metadata (annotations)

oc debug uses annotations to record what you debugged:

  • debug.openshift.io/source-resource: points at the source object (pod/node/etc.). [5]
  • debug.openshift.io/source-container: records the source container name. [5]

Labels behavior

  • By default, the debug pod is a copy of the source pod but with labels stripped (unless you explicitly request otherwise, e.g. --keep-labels). [6]

Sources:
[1] OpenShift Cookbook example showing nbviewer-debug pod name output from oc debug dc/nbviewer. (cookbook.openshift.org)
[2] Red Hat blog describing node debug pod name creation (node-name-debug, dots replaced with dashes). (redhat.com)
[3] Red Hat Customer Portal example showing Creating debug namespace/openshift-debug-node-.... (access.redhat.com)
[4] oc source code showing temp namespace GenerateName: "openshift-debug-" for node debug when needed. (raw.githubusercontent.com)
[5] Example debug pod YAML showing debug.openshift.io/source-resource and debug.openshift.io/source-container annotations. (publicdoc.rbbn.com)
[6] oc debug help text stating the debug pod is created with “labels stripped” (unless kept). (docs.okd.io)

Citations:


Use the documented debug pod pattern instead of a broad substring match.

Line 95 exempts any pod with "debug" anywhere in its name using strings.Contains(). OpenShift's documented pattern for debug pods created via oc debug is more specific: workload debug pods are named <original-name>-debug (suffix), and debug pods carry annotations like debug.openshift.io/source-resource. The current substring match risks incorrectly exempting unrelated workloads with "debug" in their name (e.g., "debugging-tool", "debugger").

Replace with strings.HasSuffix(pod.Name, "-debug") or, more reliably, check for the presence of the debug.openshift.io/source-resource annotation to properly distinguish true debug pods.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pkg/monitortests/authentication/nodefaultserviceaccountoperatortests/monitortest.go`
around lines 92 - 96, The current debug-pod detection in the anonymous function
(func(pod corev1.Pod) (string, bool)) uses strings.Contains(pod.Name, "debug")
and should be tightened; change the logic to detect true oc debug pods by either
using strings.HasSuffix(pod.Name, "-debug") or, preferably, checking for the
debug annotation on the Pod (presence of "debug.openshift.io/source-resource" in
pod.Annotations) and return the same exemption when that condition is met
instead of the broad substring match.

@openshift-ci-robot
Copy link

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 27, 2026

@ehearne-redhat: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ovn-microshift 2203355 link true /test e2e-aws-ovn-microshift
ci/prow/e2e-aws-ovn-serial-1of2 2203355 link true /test e2e-aws-ovn-serial-1of2
ci/prow/e2e-aws-ovn-fips 2203355 link true /test e2e-aws-ovn-fips

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants