Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1919271: [on-prem] NM resolve prepender: support appending a nameserver for systemd-resolved #2359

Conversation

vrutkovs
Copy link
Member

FCOS 33 doesn't use NM to manage resolv.conf. Instead it uses systemd-resolved.

The script should not replace /etc/resolv.conf in this case, but instead create a dropin for systemd-resolved

4.6 cherry-pick: #2356

@openshift-ci-robot
Copy link
Contributor

@vrutkovs: This pull request references Bugzilla bug 1919271, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

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

In response to this:

Bug 1919271: NM resolve prepender: support appending a nameserver for systemd-resolved

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/test-infra repository.

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Jan 22, 2021
@vrutkovs
Copy link
Member Author

/test okd-e2e-vsphere

@vrutkovs
Copy link
Member Author

/retest

@vrutkovs
Copy link
Member Author

/retest

@vrutkovs vrutkovs force-pushed the nameserver-prepend-systemd-resolved-support branch from 36d4f95 to d494572 Compare January 27, 2021 09:32
@vrutkovs
Copy link
Member Author

/test okd-e2e-vsphere

Copy link
Contributor

@yuqi-zhang yuqi-zhang left a comment

Choose a reason for hiding this comment

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

Code looks fine, I'm not sure if the Only leave the first 3 nameservers in /etc/resolv.conf moving into the $NAMESERVER_IP condition affects anything. It'd be good for the metal team to have the final lgtm

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 27, 2021
/var/run/NetworkManager/resolv.conf > /etc/resolv.tmp
source /etc/os-release
if [[ "$NAME" == "Fedora" ]]; then
echo "[Resolve]" > /etc/systemd/resolved.conf.d/kni.conf
Copy link
Contributor

Choose a reason for hiding this comment

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

https://www.freedesktop.org/software/systemd/man/resolved.conf.html

I think we should use something like 60-kni.conf to make ordering easier.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea, updated

…lved

FCOS 33 doesn't use NM to manage resolv.conf. Instead it uses systemd-resolved.

The script should not replace /etc/resolv.conf in this case, but instead create a dropin for systemd-resolved
@vrutkovs vrutkovs force-pushed the nameserver-prepend-systemd-resolved-support branch from d494572 to 558b245 Compare January 27, 2021 16:58
@vrutkovs
Copy link
Member Author

vrutkovs commented Jan 27, 2021

I'm not sure if the Only leave the first 3 nameservers in /etc/resolv.conf moving into the $NAMESERVER_IP condition affects anything

Nameservers would be cleaned up on RHCOS when new interface is up and NAMESERVER_IP is resolved (previously we'd clean those regardless of NAMESERVER_IP result). I don't think this would regress in any corner case really

@iamemilio
Copy link

/test e2e-openstack

@kikisdeliveryservice kikisdeliveryservice changed the title Bug 1919271: NM resolve prepender: support appending a nameserver for systemd-resolved Bug 1919271: [on-prem] NM resolve prepender: support appending a nameserver for systemd-resolved Jan 27, 2021
@kikisdeliveryservice
Copy link
Contributor

holding for on-prem reviews

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 27, 2021
@kikisdeliveryservice
Copy link
Contributor

/assign @bcrochet @EmilienM @jcpowermac @yboaron

-e "/Generated by/c# Generated by KNI resolv prepender NM dispatcher script\nsearch $DOMAIN\nnameserver $NAMESERVER_IP" \
/var/run/NetworkManager/resolv.conf > /etc/resolv.tmp
source /etc/os-release
if [[ "$NAME" == "Fedora" ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

What sets the $NAME variable? Don't you also need to check the version of Fedora?

Perhaps a better check would be to look for the use of systemd-resolved, so that there's no surprise when RHCOS switches to it.

Copy link
Member Author

Choose a reason for hiding this comment

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

What sets the $NAME variable?

Its being set after source /etc/os-release

Don't you also need to check the version of Fedora?

We could add this later, but OKD 4.6 uses F33+, so systemd-resolved would certainly be used

Perhaps a better check would be to look for the use of systemd-resolved

That was my initial approach, but its not clear if there is a nice way to do that - check that /etc/resolv.conf is a symlink? systemd-resolved service is running?

Copy link
Member

Choose a reason for hiding this comment

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

I think the most robust is systemctl is-active --quiet systemd-resolved

Copy link
Member Author

Choose a reason for hiding this comment

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

For some reason that didn't work. I'll have another look and follow up on that later

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, don't worry too much about it. I think we'll know where to look if suddenly DNS stops working.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think checking for the link should be fine.

@iamemilio
Copy link

/lgtm

I think this is good to go

-e "/Generated by/c# Generated by KNI resolv prepender NM dispatcher script\nsearch $DOMAIN\nnameserver $NAMESERVER_IP" \
/var/run/NetworkManager/resolv.conf > /etc/resolv.tmp
source /etc/os-release
if [[ "$NAME" == "Fedora" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

I think checking for the link should be fine.

if [[ "$NAME" == "Fedora" ]]; then
echo "[Resolve]" > /etc/systemd/resolved.conf.d/60-kni.conf
echo "DNS=$NAMESERVER_IP" >> /etc/systemd/resolved.conf.d/60-kni.conf
echo "Domains=$DOMAIN" >> /etc/systemd/resolved.conf.d/60-kni.conf
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be nicer to have a single heredoc or an echo with "\n" instead of three separate echo?

Copy link
Member Author

Choose a reason for hiding this comment

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

The most cleanest way would be creating this file unconditionally - and it would be caught up in RHEL when it does the switch. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't have a preference how to write the file, seems echo with '\n' would the cleanest option. I don't mind rewriting it if you insist

@jcpowermac
Copy link
Contributor

/lgtm

@cybertron
Copy link
Member

/lgtm

Seems like everyone is in agreement on the functionality of this. If we want to modify how things get done we can always do that in a followup.

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cybertron, Fedosin, iamemilio, jcpowermac, mandre, vrutkovs, yuqi-zhang

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

The pull request process is described here

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

@kikisdeliveryservice
Copy link
Contributor

/hold cancel

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

/retest

Please review the full test history for this PR and help us cut down flakes.

13 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@vrutkovs
Copy link
Member Author

Skipping optional tests
/skip

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 30, 2021

@vrutkovs: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/okd-e2e-vsphere d49457253b0c3a3da863026841df6ff74b2bb235 link /test okd-e2e-vsphere
ci/prow/okd-e2e-aws 558b245 link /test okd-e2e-aws
ci/prow/e2e-aws-workers-rhel7 558b245 link /test e2e-aws-workers-rhel7

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 3ca5c67 into openshift:master Jan 30, 2021
@openshift-ci-robot
Copy link
Contributor

@vrutkovs: All pull requests linked via external trackers have merged:

Bugzilla bug 1919271 has been moved to the MODIFIED state.

In response to this:

Bug 1919271: [on-prem] NM resolve prepender: support appending a nameserver for systemd-resolved

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/test-infra repository.

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. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet