Skip to content

OCPBUGS-98258: Fix upstreams for CoreDNS pods on Cloud platforms - #6383

Open
sadasu wants to merge 1 commit into
openshift:mainfrom
sadasu:fix-cloud-platform-upstreams
Open

OCPBUGS-98258: Fix upstreams for CoreDNS pods on Cloud platforms#6383
sadasu wants to merge 1 commit into
openshift:mainfrom
sadasu:fix-cloud-platform-upstreams

Conversation

@sadasu

@sadasu sadasu commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

On cloud platforms, the CoreDNS Corefile's Upstreams were getting generated using the host's /etc/resolv.conf that is modified by network manager to include the local host.

That resulted in the CoreDNS upstreams to include the IP of the node on which the CoreDNS static pod was running on. Fixed to use the NetworkManager's original upstream resolv.conf instead.

- What I did

- How to verify it

- Description for the changelog

Summary by CodeRabbit

  • Bug Fixes
    • Updated DNS resolution to use NetworkManager’s active resolver configuration, improving name resolution in cloud platform environments.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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: LGTM mode

@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Aug 6, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@sadasu: This pull request references Jira Issue OCPBUGS-98258, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

On cloud platforms, the CoreDNS Corefile's Upstreams were getting generated using the host's /etc/resolv.conf that is modified by network manager to include the local host.

That resulted in the CoreDNS upstreams to include the IP of the node on which the CoreDNS static pod was running on. Fixed to use the NetworkManager's original upstream resolv.conf instead.

- What I did

- How to verify it

- Description for the changelog

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

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Walkthrough

Changes

CoreDNS resolver integration

Layer / File(s) Summary
Use the NetworkManager resolver file
templates/common/cloud-platform-alt-dns/files/coredns.yaml
CoreDNS now reads /var/run/NetworkManager/resolv.conf. The render init container mounts the host NetworkManager directory at /var/run/NetworkManager.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: djoshy, ptalgulk01


Important

Pre-merge checks failed

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

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Container-Privileges ❌ Error The CoreDNS Pod manifest contains privileged: true for coredns-monitor and hostNetwork: true; both match the prohibited privilege patterns. Remove these settings where possible, or add an explicit security justification and least-privilege replacement for each required setting.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: fixing CoreDNS upstream generation on cloud platforms.
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 The commit changes only coredns.yaml; it adds no Ginkgo tests or test titles, so no unstable or overly-specific test name is introduced.
Test Structure And Quality ✅ Passed The patch changes only one CoreDNS YAML template; it adds no Ginkgo tests or It blocks, so the listed test-structure requirements do not apply.
Microshift Test Compatibility ✅ Passed The pull request changes only one CoreDNS YAML template and adds no Ginkgo e2e tests, so MicroShift test compatibility is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The pull request changes only a CoreDNS YAML template; it adds no Ginkgo e2e tests or multi-node test assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The only modified manifest changes the resolver path and adds a NetworkManager volume mount; it adds no topology-sensitive scheduling constraint.
Ote Binary Stdout Contract ✅ Passed The HEAD patch changes only CoreDNS YAML; no Go paths changed, and the template contains no stdout or logging writes, so the OTE stdout contract is unaffected.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR changes only a CoreDNS YAML template; it adds no Ginkgo e2e tests or IPv4/external connectivity assumptions.
No-Weak-Crypto ✅ Passed The PR changes only CoreDNS resolver paths and host mounts; the diff contains no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret-comparison code.
No-Sensitive-Data-In-Logs ✅ Passed The commit changes only CoreDNS resolver configuration and a NetworkManager hostPath mount; it adds no logging, credentials, tokens, PII, hostnames, or customer data.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci
openshift-ci Bot requested review from djoshy and ptalgulk01 August 6, 2026 20:33
@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sadasu
Once this PR has been reviewed and has the lgtm label, please assign cheesesashimi for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@sadasu

sadasu commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Aug 6, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@sadasu: This pull request references Jira Issue OCPBUGS-98258, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

On cloud platforms, the CoreDNS Corefile's Upstreams were getting generated using the host's /etc/resolv.conf that is modified by network manager to include the local host.

That resulted in the CoreDNS upstreams to include the IP of the node on which the CoreDNS static pod was running on. Fixed to use the NetworkManager's original upstream resolv.conf instead.

- What I did

- How to verify it

- Description for the changelog

Summary by CodeRabbit

  • Bug Fixes
  • Updated DNS resolution to use NetworkManager’s active resolver configuration, improving name resolution in cloud platform environments.

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
Copy Markdown
Contributor

@sadasu: This pull request references Jira Issue OCPBUGS-98258, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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 coderabbitai Bot left a comment

Copy link
Copy Markdown

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@templates/common/cloud-platform-alt-dns/files/coredns.yaml`:
- Line 50: Add the existing nm-resolv volume mount to the render-config-coredns
init container, matching the mount configuration already used by
coredns-monitor, so /var/run/NetworkManager/resolv.conf resolves to the host
file during runtimecfg render.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 161884e4-64cb-4bd4-bcfa-40ccb1a59feb

📥 Commits

Reviewing files that changed from the base of the PR and between d690173 and c8d3cd1.

📒 Files selected for processing (1)
  • templates/common/cloud-platform-alt-dns/files/coredns.yaml

Comment thread templates/common/cloud-platform-alt-dns/files/coredns.yaml
On cloud platforms, the CoreDNS Corefile's Upstreams were getting
generated using the host's /etc/resolv.conf that is modified by
network manager to include the local host.

That resulted in the CoreDNS upstreams to include the IP of the
node on which the CoreDNS static pod was running on. Fixed to
use the NetworkManager's original upstream resolv.conf instead.
@sadasu
sadasu force-pushed the fix-cloud-platform-upstreams branch from c8d3cd1 to 8f541d0 Compare August 7, 2026 20:03

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@templates/common/cloud-platform-alt-dns/files/coredns.yaml`:
- Around line 62-64: Add readOnly: true to the nm-resolv volumeMount alongside
mountPath and mountPropagation, ensuring the NetworkManager resolver path is
mounted read-only while preserving the existing mount configuration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 2d628202-4f14-480a-82dd-543c043d0343

📥 Commits

Reviewing files that changed from the base of the PR and between c8d3cd1 and 8f541d0.

📒 Files selected for processing (1)
  • templates/common/cloud-platform-alt-dns/files/coredns.yaml

Comment on lines +62 to +64
- name: nm-resolv
mountPath: "/var/run/NetworkManager"
mountPropagation: HostToContainer

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Make the NetworkManager mount read-only.

runtimecfg render reads this path as resolver input. Without readOnly: true, the init container can modify the node's NetworkManager resolver files if it is compromised or malfunctions. Add the read-only flag.

Proposed fix
         - name: nm-resolv
           mountPath: "/var/run/NetworkManager"
           mountPropagation: HostToContainer
+          readOnly: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: nm-resolv
mountPath: "/var/run/NetworkManager"
mountPropagation: HostToContainer
- name: nm-resolv
mountPath: "/var/run/NetworkManager"
mountPropagation: HostToContainer
readOnly: true
🤖 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 `@templates/common/cloud-platform-alt-dns/files/coredns.yaml` around lines 62 -
64, Add readOnly: true to the nm-resolv volumeMount alongside mountPath and
mountPropagation, ensuring the NetworkManager resolver path is mounted read-only
while preserving the existing mount configuration.

@openshift-ci

openshift-ci Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@sadasu: 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/unit 8f541d0 link true /test unit
ci/prow/perfscale-control-plane-6nodes 8f541d0 link false /test perfscale-control-plane-6nodes

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

jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. 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.

2 participants