Skip to content

MGMT-20634: Revert global DNS workaround as RHEL-91250 resolved#10317

Closed
linoyaslan wants to merge 1 commit into
openshift:masterfrom
linoyaslan:remove_auto_dns_workaround
Closed

MGMT-20634: Revert global DNS workaround as RHEL-91250 resolved#10317
linoyaslan wants to merge 1 commit into
openshift:masterfrom
linoyaslan:remove_auto_dns_workaround

Conversation

@linoyaslan
Copy link
Copy Markdown
Contributor

@linoyaslan linoyaslan commented May 11, 2026

As RHEL-91250 is now resolved, we can remove our workaround for global DNS.
With this fix, if a user sets auto-dns: false and dhcp: true in their nmstate.yaml, the flow with nmstate.service should correctly apply the networking configuration files.

/cc @giladravid16

How it was tested:

I used the following nmstate file:

interfaces:
  - name: eth0
    type: ethernet
    state: up
    ipv4:
      enabled: true
      auto-dns: false
      dhcp: true
dns-resolver:
  config:
    server:
      - 192.168.122.1
routes:
  config:
    - destination: 0.0.0.0/0
      next-hop-address: 192.168.122.1
      next-hop-interface: eth0
      table-id: 254

Then I verified that /etc/resolv.conf was correctly configured both during discovery and after installation.

List all the issues related to this PR

  • New Feature
  • Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested)
  • No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

Summary by CodeRabbit

Release Notes

  • Refactor
    • Streamlined the static network configuration logic by removing legacy DNS-related workarounds. The system now uses a simplified approach for determining when to use the nmstate service, focusing solely on OpenShift version compatibility and network configuration identifiers.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 11, 2026
@openshift-ci openshift-ci Bot requested a review from giladravid16 May 11, 2026 16:52
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented May 11, 2026

@linoyaslan: This pull request references MGMT-20634 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

As RHEL-91250 is now resolved, we can remove our workaround for global DNS.
With this fix, if a user sets auto-dns: false and dhcp: true in their nmstate.yaml, the flow with nmstate.service should correctly apply the networking configuration files.

Note: this is still in draft because we need to verify that the fix was backported to all bootimages for OCP 4.18 and above.

/cc @giladravid16

How it was tested:

I used the following nmstate file:

interfaces:
 - name: eth0
   type: ethernet
   state: up
   ipv4:
     enabled: true
     auto-dns: false
     dhcp: true
dns-resolver:
 config:
   server:
     - 192.168.122.1
routes:
 config:
   - destination: 0.0.0.0/0
     next-hop-address: 192.168.122.1
     next-hop-interface: eth0
     table-id: 254

Then I verified that /etc/resolv.conf was correctly configured both during discovery and after installation.

List all the issues related to this PR

  • New Feature
  • Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested)
  • No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

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.

As RHEL-91250 is now resolved, we can remove our workaround for global DNS.
With this fix, if a user sets auto-dns: false and dhcp: true in their nmstate.yaml, the flow with nmstate.service should correctly apply the networking configuration files.
@linoyaslan linoyaslan force-pushed the remove_auto_dns_workaround branch from d1b51ee to acce747 Compare May 11, 2026 16:53
@openshift-ci openshift-ci Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 11, 2026
@linoyaslan linoyaslan marked this pull request as draft May 11, 2026 16:53
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

Walkthrough

Removed global DNS workaround detection logic from static network configuration backward compatibility handling. The CheckConfigForGlobalDnsCase method was deleted, and ShouldUseNmstateService was simplified to evaluate only OpenShift version compatibility and MAC address presence, removing the auto-dns: false with dhcp: true condition.

Changes

Cohort / File(s) Summary
Backward Compatibility Implementation
pkg/staticnetworkconfig/backward_compatibility.go
Removed CheckConfigForGlobalDnsCase exported method and simplified ShouldUseNmstateService logic to eliminate DNS configuration condition check; now only evaluates nmstate service support and MAC address identifier presence.
Backward Compatibility Tests
pkg/staticnetworkconfig/backward_compatibility_test.go
Updated table-driven tests for ShouldUseNmstateService by removing scenario covering auto-dns: false with dhcp: true case; retained test for missing MAC identifier with unsupported OpenShift version.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 12
✅ Passed checks (12 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: removing a global DNS workaround because the underlying issue (RHEL-91250) has been resolved.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed Test names are stable and deterministic with no dynamic content, generated IDs, timestamps, or variable interpolation. All dynamic parameters are in test bodies.
Test Structure And Quality ✅ Passed Tests follow established codebase patterns. Single responsibility, setup/cleanup appropriate. No timing issues. Assertion messages absent but consistent with existing tests in this repository.
Microshift Test Compatibility ✅ Passed This PR does not add new Ginkgo e2e tests. Changes are only to unit tests in pkg/staticnetworkconfig/. The custom check applies only to new e2e tests, making it not applicable here.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Not OpenShift e2e tests. These are assisted-service unit tests for static network config logic. No cluster topology or multi-node assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed This PR modifies utility functions for static network configuration parsing. It contains no deployment manifests, scheduling constraints, pod affinity, or topology-aware code.
Ote Binary Stdout Contract ✅ Passed PR changes staticnetworkconfig package logic. No stdout writes present. OTE contract check not applicable to this web service.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR removes code and updates unit tests, not adding new Ginkgo e2e tests. The test is a unit test parsing configuration strings, not an e2e test.
Description check ✅ Passed The pull request description is comprehensive and follows the template structure with all major sections completed including issue reference, environment impact, testing approach, and checklist items.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 11, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 11, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: linoyaslan

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 openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 11, 2026
Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
pkg/staticnetworkconfig/backward_compatibility_test.go (1)

47-50: ⚡ Quick win

Add an explicit positive regression case for the reverted DNS workaround.

The removed workaround is the main behavior change here, but the table no longer exercises auto-dns: false + dhcp: true on a supported version. Keeping one entry that expects true would protect this PR from silently drifting back to the old behavior.

Suggested test addition
 		withoutMacIdentifier = `interfaces:
 - name: eth0
   type: ethernet
   state: up
   ipv4:
     enabled: true
     address:
       - ip: 192.0.2.1
         prefix-length: 24`
+		withDhcpAndAutoDnsDisabled = `interfaces:
+- name: eth0
+  type: ethernet
+  state: up
+  ipv4:
+    enabled: true
+    dhcp: true
+    auto-dns: false`
 	)
@@
 		table.Entry("If the YAML contains a mac-identifier, and the version is < MinimalVersionForNmstatectl,  we shouldn't use the nmstate service flow", withMacIdentifier, "4.12", false),
 		table.Entry("If the YAML doesn't contain a mac-identifier and the version is >= MinimalVersionForNmstatectl, we should use the nmstate service flow", withoutMacIdentifier, common.MinimalVersionForNmstatectl, true),
+		table.Entry("If the YAML disables auto-dns while using DHCP and the version is >= MinimalVersionForNmstatectl, we should still use the nmstate service flow", withDhcpAndAutoDnsDisabled, common.MinimalVersionForNmstatectl, true),
 		table.Entry("If the YAML doesn't contain a mac-identifier, and the version < MinimalVersionForNmstatectl we shouldn't use the nmstate service flow.", withoutMacIdentifier, "4.12", false))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/staticnetworkconfig/backward_compatibility_test.go` around lines 47 - 50,
Add an explicit positive regression table entry to cover the reverted DNS
workaround: in the table.Entry list in backward_compatibility_test.go add a case
that uses common.MinimalVersionForNmstatectl with a test fixture/config that
sets auto-dns: false and dhcp: true (reuse the existing fixtures like
withMacIdentifier/withoutMacIdentifier as appropriate) and assert the expected
boolean is true; place the new table.Entry alongside the other table.Entry calls
so the test suite exercises the supported-version + (auto-dns:false, dhcp:true)
path and prevents regressing to the old behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/staticnetworkconfig/backward_compatibility_test.go`:
- Around line 47-50: Add an explicit positive regression table entry to cover
the reverted DNS workaround: in the table.Entry list in
backward_compatibility_test.go add a case that uses
common.MinimalVersionForNmstatectl with a test fixture/config that sets
auto-dns: false and dhcp: true (reuse the existing fixtures like
withMacIdentifier/withoutMacIdentifier as appropriate) and assert the expected
boolean is true; place the new table.Entry alongside the other table.Entry calls
so the test suite exercises the supported-version + (auto-dns:false, dhcp:true)
path and prevents regressing to the old behavior.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 9e0c71dd-7a54-49a8-8c41-92a748036e13

📥 Commits

Reviewing files that changed from the base of the PR and between babc11d and acce747.

📒 Files selected for processing (2)
  • pkg/staticnetworkconfig/backward_compatibility.go
  • pkg/staticnetworkconfig/backward_compatibility_test.go

@linoyaslan linoyaslan marked this pull request as ready for review May 12, 2026 10:06
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 12, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.32%. Comparing base (babc11d) to head (acce747).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10317      +/-   ##
==========================================
- Coverage   44.33%   44.32%   -0.01%     
==========================================
  Files         417      417              
  Lines       72837    72795      -42     
==========================================
- Hits        32294    32269      -25     
+ Misses      37609    37599      -10     
+ Partials     2934     2927       -7     
Files with missing lines Coverage Δ
pkg/staticnetworkconfig/backward_compatibility.go 54.34% <100.00%> (-3.61%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 12, 2026

@linoyaslan: 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/edge-e2e-ai-operator-ztp acce747 link true /test edge-e2e-ai-operator-ztp
ci/prow/verify-generated-code acce747 link true /test verify-generated-code

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.

@linoyaslan linoyaslan closed this May 12, 2026
@linoyaslan
Copy link
Copy Markdown
Contributor Author

This PR was closed because the changes were combined into another PR

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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants