Skip to content

NO-JIRA: Refactor get_coredns_config: Use DynamicClient & testify/suite#151

Merged
openshift-merge-bot[bot] merged 3 commits intoopenshift:mainfrom
bentito:refactor/NE-2449-coredns-dynamic-client
Mar 16, 2026
Merged

NO-JIRA: Refactor get_coredns_config: Use DynamicClient & testify/suite#151
openshift-merge-bot[bot] merged 3 commits intoopenshift:mainfrom
bentito:refactor/NE-2449-coredns-dynamic-client

Conversation

@bentito
Copy link

@bentito bentito commented Feb 19, 2026

This PR refactors the get_coredns_config tool introduced in #131 to align with the patterns established in #144.

Changes:

  • Dynamic Client: Switched from controller-runtime client to DynamicClient for consistency with inspect_route.
  • Test Suite: Migrated tests to testify/suite for better grouping and setup logic.
  • New Test Suite: Created pkg/toolsets/netedge/suite_test.go to house the shared NetEdgeTestSuite.

This addresses feedback from @matzew regarding test grouping and client usage.

Related PRs:

@openshift-ci openshift-ci bot requested review from Cali0707 and matzew February 19, 2026 19:35
bentito added a commit to bentito/openshift-mcp-server that referenced this pull request Feb 19, 2026
This refactors query_prometheus to use DynamicClient and NetEdgeTestSuite, aligning with PR openshift#151 and PR openshift#144. Moves query_prometheus to the netedge package to share test infrastructure.

Signed-off-by: bentito <btofel@redhat.com>
@bentito
Copy link
Author

bentito commented Feb 25, 2026

@matzew I think this one is all set

@bentito
Copy link
Author

bentito commented Mar 10, 2026

/assign @matzew

@bentito
Copy link
Author

bentito commented Mar 10, 2026

@matzew I think re-review, when you can thanks

@matzew
Copy link
Member

matzew commented Mar 13, 2026

/override "Konflux kflux-prd-rh02 / openshift-mcp-server-on-pull-request"

@matzew
Copy link
Member

matzew commented Mar 13, 2026

Note that you may need to `git add --force` ignored files in the vendor/ dir.
Unregistering from: subscription.rhsm.redhat.com:443/subscription
System has been unregistered.

something in the Red Hat Konflux / openshift-mcp-server-on-pull-request report.. 🤔

Copy link
Member

@matzew matzew left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

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

openshift-ci bot commented Mar 13, 2026

@matzew: Overrode contexts on behalf of matzew: Konflux kflux-prd-rh02 / openshift-mcp-server-on-pull-request

Details

In response to this:

/override "Konflux kflux-prd-rh02 / openshift-mcp-server-on-pull-request"

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.

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 13, 2026
bentito added a commit to bentito/openshift-mcp-server that referenced this pull request Mar 13, 2026
This refactors query_prometheus to use DynamicClient and NetEdgeTestSuite, aligning with PR openshift#151 and PR openshift#144. Moves query_prometheus to the netedge package to share test infrastructure.

Signed-off-by: bentito <btofel@redhat.com>
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 16, 2026
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 16, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b6fb1e79-87e1-41a9-b5c6-a20da5eaa49b

📥 Commits

Reviewing files that changed from the base of the PR and between 2d1704d and f6c39c9.

📒 Files selected for processing (2)
  • pkg/toolsets/netedge/coredns.go
  • pkg/toolsets/netedge/coredns_test.go

Walkthrough

This change refactors DNS configuration retrieval from controller-runtime typed clients to Kubernetes dynamic clients, replacing structured ConfigMap handling with unstructured data access and adding error handling for missing data.

Changes

Cohort / File(s) Summary
Core DNS Configuration Client Refactoring
pkg/toolsets/netedge/coredns.go
Replaced controller-runtime client with dynamic client for ConfigMap retrieval. Switched from typed ConfigMap (corev1.ConfigMap) to unstructured data access via NestedStringMap. Added error handling for missing data and parse failures. Updated imports accordingly (removed REST/controller-runtime dependencies, added metav1, unstructured, runtime/schema).
Test Suite Updates
pkg/toolsets/netedge/coredns_test.go
Updated test setup to use dynamic fake client with runtime scheme instead of controller-runtime fake client. Added new test case "failure - data not found" to validate behavior when ConfigMap data is absent. Removed newClientFunc override and updated test harness to wire dynamic client via s.SetDynamicClient.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

bentito and others added 3 commits March 16, 2026 08:25
Add test case for missing ConfigMap 'data' map and ensure
AddToScheme does not return an error in test setup.

Signed-off-by: bentito <btofel@redhat.com>
…'controller-runtime' packages

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
@matzew matzew force-pushed the refactor/NE-2449-coredns-dynamic-client branch from 2d1704d to f6c39c9 Compare March 16, 2026 07:26
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 16, 2026
@matzew
Copy link
Member

matzew commented Mar 16, 2026

/override "Konflux kflux-prd-rh02 / openshift-mcp-server-on-pull-request"

@openshift-ci
Copy link

openshift-ci bot commented Mar 16, 2026

@matzew: Overrode contexts on behalf of matzew: Konflux kflux-prd-rh02 / openshift-mcp-server-on-pull-request

Details

In response to this:

/override "Konflux kflux-prd-rh02 / openshift-mcp-server-on-pull-request"

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.

Copy link
Member

@matzew matzew left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

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

openshift-ci bot commented Mar 16, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bentito, matzew

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

@openshift-ci
Copy link

openshift-ci bot commented Mar 16, 2026

@bentito: all tests passed!

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.

@matzew matzew changed the title Refactor get_coredns_config (NE-2449): Use DynamicClient & testify/suite NE-2449: Refactor get_coredns_config: Use DynamicClient & testify/suite Mar 16, 2026
@openshift-ci-robot
Copy link

@bentito: An error was encountered searching for bug NE-2449 on the Jira server at https://issues.redhat.com. No known errors were detected, please see the full error message for details.

Full error message. request failed. Please analyze the request body for more details. Status code: 403:

Please contact an administrator to resolve this issue, then request a bug refresh with /jira refresh.

Details

In response to this:

This PR refactors the get_coredns_config tool introduced in #131 to align with the patterns established in #144.

Changes:

  • Dynamic Client: Switched from controller-runtime client to DynamicClient for consistency with inspect_route.
  • Test Suite: Migrated tests to testify/suite for better grouping and setup logic.
  • New Test Suite: Created pkg/toolsets/netedge/suite_test.go to house the shared NetEdgeTestSuite.

This addresses feedback from @matzew regarding test grouping and client usage.

Related PRs:

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.

@matzew matzew changed the title NE-2449: Refactor get_coredns_config: Use DynamicClient & testify/suite NO-JIRA: Refactor get_coredns_config: Use DynamicClient & testify/suite Mar 16, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 16, 2026
@openshift-ci-robot
Copy link

@bentito: This pull request explicitly references no jira issue.

Details

In response to this:

This PR refactors the get_coredns_config tool introduced in #131 to align with the patterns established in #144.

Changes:

  • Dynamic Client: Switched from controller-runtime client to DynamicClient for consistency with inspect_route.
  • Test Suite: Migrated tests to testify/suite for better grouping and setup logic.
  • New Test Suite: Created pkg/toolsets/netedge/suite_test.go to house the shared NetEdgeTestSuite.

This addresses feedback from @matzew regarding test grouping and client usage.

Related PRs:

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-merge-bot openshift-merge-bot bot merged commit 795ca0f into openshift:main Mar 16, 2026
10 of 11 checks passed
matzew pushed a commit to bentito/openshift-mcp-server that referenced this pull request Mar 16, 2026
This refactors query_prometheus to use DynamicClient and NetEdgeTestSuite, aligning with PR openshift#151 and PR openshift#144. Moves query_prometheus to the netedge package to share test infrastructure.

Signed-off-by: bentito <btofel@redhat.com>
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. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants