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

add dns server to ovs-if-br-ex nm connection #194

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions pkg/bundle/setup/clustersetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,41 @@ address=/$hostName.crc.testing/192.168.126.11
EOF

stop_if_failed $? "failed to write Dnsmasq configuration in $DNSMASQ_CONF"
pr_info "enabling & starting Dnsmasq service"
systemctl enable dnsmasq.service
systemctl start dnsmasq.service
sleep 2
stop_if_failed $? "failed to start Dnsmasq service"
}

update_ovs_nm_config() {
cat << EOF > /etc/systemd/system/crc-cloud-ovs-nm.service
[Unit]
Description=CRC Cloud Unit for configuring nm ovs connection
Requires=ovs-configuration.service
After=ovs-configuration.service

[Service]
Type=oneshot
ExecStart=nmcli con modify --temporary ovs-if-br-ex ipv4.dns "$IIP,169.254.169.254"
StandardOutput=journal

[Install]
RequiredBy=kubelet-dependencies.target
EOF

stop_if_failed $? "failed to write systemd unit file for network manager ovs connection update"
pr_info "adding Dnsmasq as primary DNS"
sleep 2
nmcli connection modify Wired\ connection\ 1 ipv4.dns "$IIP,169.254.169.254"

systemctl enable crc-cloud-ovs-nm.service
systemctl start crc-cloud-ovs-nm.service
stop_if_failed $? "failed to modify NetworkManager settings"

pr_info "restarting NetworkManager"
sleep 2
systemctl restart NetworkManager
systemctl restart NetworkManager
stop_if_failed $? "failed to restart NetworkManager"
pr_info "enabling & starting Dnsmasq service"
systemctl enable dnsmasq.service
systemctl start dnsmasq.service
sleep 2
stop_if_failed $? "failed to start Dnsmasq service"
}

Copy link
Member

Choose a reason for hiding this comment

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

when I was testing this last week (and that's the reason I didn't put PR) is as soon as Network restart happen and then we start kubelet somehow it again trigger ovs-configuration.service and it fails :( do test this scenario once.

Copy link
Member Author

Choose a reason for hiding this comment

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

ahh, but this is working on crc somehow? maybe we just need to down/up the connection instead of restarting NetworkManager service?

enable_and_start_kubelet() {
Expand Down Expand Up @@ -247,6 +269,7 @@ set_credentials() {
}

setup_dsnmasq
update_ovs_nm_config

enable_and_start_kubelet
replace_default_pubkey
Expand Down
Loading