Skip to content

[release-4.22] OCPBUGS-99406: Custom dns configuration backport#7085

Merged
openshift-merge-bot[bot] merged 16 commits into
openshift:release-4.22from
pacevedom:custom-dns-backport
Jul 23, 2026
Merged

[release-4.22] OCPBUGS-99406: Custom dns configuration backport#7085
openshift-merge-bot[bot] merged 16 commits into
openshift:release-4.22from
pacevedom:custom-dns-backport

Conversation

@pacevedom

Copy link
Copy Markdown
Contributor

No description provided.

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

openshift-ci-robot commented Jul 21, 2026

Copy link
Copy Markdown

@pacevedom: This pull request references USHIFT-6968 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 story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

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 Jul 21, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: be95e7b5-c16d-45da-888d-76571235e6ec

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

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

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.

@openshift-ci
openshift-ci Bot requested review from copejon and ggiguash July 21, 2026 16:43
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 21, 2026
@pacevedom

Copy link
Copy Markdown
Contributor Author

/retest

@pacevedom pacevedom changed the title [release-4.22] USHIFT-6968: Custom dns configuration backport [release-4.22] OCPBUGS-99406: Custom dns configuration backport Jul 22, 2026
@openshift-ci-robot openshift-ci-robot added the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Jul 22, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@pacevedom: This pull request references Jira Issue OCPBUGS-99406, which is invalid:

  • expected the bug to target the "4.22.0" version, but no target version was set
  • release note text must be set and not match the template OR release note type must be set to "Release Note Not Required". For more information you can reference the OpenShift Bug Process.
  • expected Jira Issue OCPBUGS-99406 to depend on a bug targeting a version in 5.0.0 and in one of the following states: MODIFIED, ON_QA, VERIFIED, but no dependents were found

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:

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.

@pacevedom

Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown

@pacevedom: This pull request references Jira Issue OCPBUGS-99406, which is invalid:

  • release note text must be set and not match the template OR release note type must be set to "Release Note Not Required". For more information you can reference the OpenShift Bug Process.
  • expected Jira Issue OCPBUGS-99406 to depend on a bug targeting a version in 5.0.0 and in one of the following states: MODIFIED, ON_QA, VERIFIED, but no dependents were found

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.

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.

@pacevedom

Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown

@pacevedom: This pull request references Jira Issue OCPBUGS-99406, which is invalid:

  • expected Jira Issue OCPBUGS-99406 to depend on a bug targeting a version in 5.0.0 and in one of the following states: MODIFIED, ON_QA, VERIFIED, but no dependents were found

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.

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.

@pmtk

pmtk commented Jul 22, 2026

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 22, 2026
@pacevedom pacevedom removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Jul 22, 2026
@pacevedom

Copy link
Copy Markdown
Contributor Author

/label jira/valid-bug
/label backport-risk-assessed
/verified by CI

@openshift-ci openshift-ci Bot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 22, 2026
@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 22, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@pacevedom: This PR has been marked as verified by CI.

Details

In response to this:

/label jira/valid-bug
/label backport-risk-assessed
/verified by CI

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.

Add a new ConfigFile field to the DNS config struct that allows users
to specify a custom CoreDNS Corefile path. Validation ensures mutual
exclusivity with dns.hosts, and checks that the file is absolute,
exists, is readable, non-empty, and within the 1MiB ConfigMap limit.
When dns.configFile is set, read the file and apply its contents
directly as the Corefile key in the dns-default ConfigMap, bypassing
the default template rendering. When unset, existing behavior is
preserved.
Add DNSConfigurationWatcherManager that watches the custom Corefile
specified by dns.configFile for changes at runtime, updating the
dns-default ConfigMap when the file is modified. Follows the same
fsnotify + SHA256 hashing pattern as the existing hosts watcher.
Cover mutual exclusivity with dns.hosts, non-absolute path, missing
file, empty file, file exceeding 1MiB limit, valid config, and
default behavior when configFile is unset.
RobotFramework tests covering:
- Custom Corefile is used by CoreDNS instead of the default
- Runtime reload propagates changes without MicroShift restart
- Cluster-local resolution works with custom Corefile
- Use apierrors.IsNotFound for ConfigMap Get errors instead of treating
  any error as not-found
- Merge annotations into existing ConfigMap instead of replacing them to
  avoid clobbering annotations set by the asset apply
- Handle atomic-rename file updates (Rename/Remove events) and re-add
  the file watch on Create so the watcher survives vim/sed -i edits
- Reject non-regular files (directories, FIFOs) in validateConfigFile
- Fix Should Contain assertion in robot test that treated the hostname
  as a failure message instead of a second assertion
- Add retry wrapper to ConfigMap verification after restart
pacevedom and others added 9 commits July 23, 2026 00:42
Deduplicate keywords shared between dns.robot and dns-custom-config.robot
by moving them into a common resource file. Also fixes a bug in dns.robot
where Router Should Resolve Hostname passed the hostname as a failure
message to Should Contain instead of asserting it separately.
…test

Add a ConfigMap content check after updating the Corefile at runtime,
before attempting DNS resolution. This confirms the file watcher
propagated the change and provides a faster, clearer failure signal.
- Consolidate duplicate file validation logic in dns.go into a shared
  validateFilePath helper used by both validateConfigFile and
  validateHosts. Also fixes validateHosts calling os.Stat twice and
  missing regular-file and empty-file checks.
- Depend on infrastructure-services-manager instead of kube-apiserver
  directly, ensuring the initial DNS ConfigMap exists before the watcher
  starts.
- Avoid double-closing the fsnotify watcher by returning ctx.Err() on
  context cancellation and letting the defer handle Close().
- Return lastHash instead of currentHash on updateConfigMap failure so
  the next identical change is not skipped.
…raction

Extract shared file-watching logic from dnsconfigurationwatcher.go and
hostswatcher.go into a common fileWatcher struct in filewatcher.go.
Both concrete watchers become thin wrappers that embed fileWatcher and
only provide constructors with their specific configuration.

Also fixes bugs in the hosts watcher: double-closing the fsnotify
watcher, treating any Get error as not-found, and returning currentHash
on update failure.
Add a dedicated log message when the watched file is removed, and a test
that verifies the ConfigMap retains its last known content after the
Corefile is deleted from disk. The test uses journal cursor + log pattern
matching to confirm the watcher processed the removal event before
asserting ConfigMap contents.
@pacevedom
pacevedom force-pushed the custom-dns-backport branch from 9684ffb to c4c4024 Compare July 22, 2026 22:42
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 22, 2026
@openshift-ci-robot openshift-ci-robot removed the verified Signifies that the PR passed pre-merge verification criteria label Jul 22, 2026
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 22, 2026
@pmtk

pmtk commented Jul 23, 2026

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 23, 2026
@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pacevedom, pmtk

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 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

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

@pacevedom

Copy link
Copy Markdown
Contributor Author

/verified by CI

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 23, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@pacevedom: This PR has been marked as verified by CI.

Details

In response to this:

/verified by CI

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 180981f into openshift:release-4.22 Jul 23, 2026
16 checks passed
@openshift-ci-robot

Copy link
Copy Markdown

@pacevedom: Jira Issue OCPBUGS-99406: All pull requests linked via external trackers have merged:

All linked pull requests have the verified tag. Jira Issue OCPBUGS-99406 has been moved to the VERIFIED state.

Details

In response to this:

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.

@pacevedom
pacevedom deleted the custom-dns-backport branch July 23, 2026 09:38
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. backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. 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. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants