Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

ignore dns servers from dhcp when providing nameservers #4023

Conversation

tylerschultz
Copy link
Contributor

@tylerschultz tylerschultz commented Nov 28, 2022

What this PR does / why we need it

When users specify nameservers via CONTROL_PLANE_NODE_NAMESERVERS or WORKER_NODE_NAMESERVERS, CAPV is configured to ignore nameservers configured from DHCP. Without this change nameservers from DHCP will be added to the list of available nameservers.

CAPV v1.5+ was recently bumped, which contains the ability to configure DHCP overrides, so this change can be validated

Which issue(s) this PR fixes

Fixes #1103

Describe testing done for PR

Deployed clusters while using WORKER_NODE_NAMESERVERS and CONTROL_PLANE_NODE_NAMESERVERS and saw that CAPV was correctly configured with the VSphereMachineTemplate .spec.template.spec.network.dhcpOverrides.useDNS is set to false. SSH onto node vms and verfiy networkctl is configured correctly.

Release note

When WORKER_NODE_NAMESERVERS or CONTROL_PLANE_NODE_NAMESERVERS variables are set, nameservers from DHCP are ignored.

Additional information

Special notes for your reviewer

@tylerschultz tylerschultz added the do-not-merge/wip Still work in progress label Nov 28, 2022
@tylerschultz tylerschultz requested review from a team as code owners November 28, 2022 22:34
@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/4023/20221128224717/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@codecov
Copy link

codecov bot commented Nov 29, 2022

Codecov Report

Merging #4023 (99a8d0f) into main (88865cb) will decrease coverage by 0.10%.
The diff coverage is n/a.

❗ Current head 99a8d0f differs from pull request most recent head a601b39. Consider uploading reports for the commit a601b39 to get more accurate results

@@            Coverage Diff             @@
##             main    #4023      +/-   ##
==========================================
- Coverage   48.53%   48.43%   -0.11%     
==========================================
  Files         446      434      -12     
  Lines       44110    43345     -765     
==========================================
- Hits        21410    20993     -417     
+ Misses      20657    20359     -298     
+ Partials     2043     1993      -50     
Impacted Files Coverage Δ
cli/runtime/config/clientconfig_factory.go 60.52% <0.00%> (-13.16%) ⬇️
cli/runtime/config/config_factory.go 51.61% <0.00%> (-12.10%) ⬇️
cli/runtime/config/lock.go 54.28% <0.00%> (-6.69%) ⬇️
tkg/client/common.go 15.81% <0.00%> (-5.62%) ⬇️
...cli/plugin-admin/codegen/generators/feature/gen.go 38.09% <0.00%> (-3.94%) ⬇️
cli/runtime/config/contexts.go 57.82% <0.00%> (-3.57%) ⬇️
cli/runtime/config/legacy_clientconfig.go 31.37% <0.00%> (-3.12%) ⬇️
addons/controllers/machine_controller.go 65.65% <0.00%> (-3.04%) ⬇️
...eaturegates/client/pkg/featuregateclient/client.go 53.43% <0.00%> (-2.37%) ⬇️
tkg/managementcomponents/helper.go 88.35% <0.00%> (-1.95%) ⬇️
... and 44 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@tylerschultz tylerschultz force-pushed the dhcp-ignore-dns-when-providing-nameservers branch from b57dc06 to 9d8c52a Compare December 1, 2022 00:50
@tylerschultz
Copy link
Contributor Author

/test install-vc7

@tylerschultz tylerschultz removed the do-not-merge/wip Still work in progress label Dec 1, 2022
@tylerschultz tylerschultz changed the title WIP: ignore dns servers from dhcp when providing nameservers ignore dns servers from dhcp when providing nameservers Dec 1, 2022
@github-actions
Copy link

github-actions bot commented Dec 1, 2022

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/4023/20221201005915/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@alfredthenarwhal
Copy link
Collaborator

@tylerschultz: /test install-vc7
Commit: 9d8c52a

Build failed! Build no: 3418

@christianang
Copy link
Contributor

/test install-vc7

@flawedmatrix flawedmatrix force-pushed the dhcp-ignore-dns-when-providing-nameservers branch from 9d8c52a to 07dba41 Compare December 1, 2022 19:11
@github-actions
Copy link

github-actions bot commented Dec 1, 2022

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/4023/20221201192106/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@adobley
Copy link
Contributor

adobley commented Dec 2, 2022

Looks like the install-vc7 tests passed, we should be good to go after a review

@flawedmatrix flawedmatrix force-pushed the dhcp-ignore-dns-when-providing-nameservers branch from 07dba41 to a601b39 Compare December 6, 2022 18:30
@github-actions
Copy link

github-actions bot commented Dec 6, 2022

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/4023/20221206183936/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@adobley
Copy link
Contributor

adobley commented Dec 7, 2022

/test install-vc7

@tylerschultz tylerschultz force-pushed the dhcp-ignore-dns-when-providing-nameservers branch from a601b39 to 0896e22 Compare December 7, 2022 18:49
@github-actions
Copy link

github-actions bot commented Dec 7, 2022

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/4023/20221207190034/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@alfredthenarwhal
Copy link
Collaborator

@adobley: /test install-vc7
Commit: a601b39

Build failed! Build no: 3501

@tylerschultz
Copy link
Contributor Author

/test install-vc7

@flawedmatrix flawedmatrix force-pushed the dhcp-ignore-dns-when-providing-nameservers branch from 0896e22 to f809d42 Compare December 8, 2022 18:48
@github-actions
Copy link

github-actions bot commented Dec 8, 2022

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/4023/20221208185737/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@tylerschultz
Copy link
Contributor Author

/test install-vc7

@alfredthenarwhal
Copy link
Collaborator

@tylerschultz: /test install-vc7
Commit: f809d42

Tests failed! Build no: 3561

@tylerschultz tylerschultz force-pushed the dhcp-ignore-dns-when-providing-nameservers branch from f809d42 to 4c47eb4 Compare December 13, 2022 00:23
@tylerschultz tylerschultz force-pushed the dhcp-ignore-dns-when-providing-nameservers branch from 98dd506 to 762860e Compare January 3, 2023 21:43
@adobley
Copy link
Contributor

adobley commented Jan 3, 2023

/test install-vc7

@github-actions
Copy link

github-actions bot commented Jan 3, 2023

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/4023/20230103215158/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@alfredthenarwhal
Copy link
Collaborator

@adobley: /test install-vc7
Commit: 762860e

Build failed! Build no: 3726

@adobley
Copy link
Contributor

adobley commented Jan 5, 2023

/test install-vc7

@alfredthenarwhal
Copy link
Collaborator

@adobley: /test install-vc7
Commit: 762860e

Tests failed! Build no: 3748

@adobley
Copy link
Contributor

adobley commented Jan 5, 2023

/test install-vc7

@tylerschultz tylerschultz force-pushed the dhcp-ignore-dns-when-providing-nameservers branch from 762860e to 4978716 Compare January 6, 2023 22:27
@github-actions
Copy link

github-actions bot commented Jan 6, 2023

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/4023/20230106223420/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@tylerschultz
Copy link
Contributor Author

/test install-vc7

@adobley
Copy link
Contributor

adobley commented Jan 11, 2023

It looks like the tests didn't run the last two times :(

@adobley
Copy link
Contributor

adobley commented Jan 11, 2023

/test install-vc7

@alfredthenarwhal
Copy link
Collaborator

@adobley: /test install-vc7
Commit: 4978716

Build failed! Build no: 3833

@flawedmatrix flawedmatrix force-pushed the dhcp-ignore-dns-when-providing-nameservers branch from 4978716 to b2e5267 Compare January 17, 2023 23:44
@tylerschultz
Copy link
Contributor Author

/test install-vc7

@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/4023/20230117235049/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@navidshaikh
Copy link
Contributor

/test install-vc7

@alfredthenarwhal
Copy link
Collaborator

@navidshaikh: /test install-vc7
Commit: b2e5267

Build failed! Build no: 3889

@adobley
Copy link
Contributor

adobley commented Jan 19, 2023

/test install-vc7

@alfredthenarwhal
Copy link
Collaborator

@adobley: /test install-vc7
Commit: b2e5267

Tests failed! Build no: 3905

@adobley
Copy link
Contributor

adobley commented Jan 20, 2023

/test install-vc7

Copy link
Contributor

@adobley adobley left a comment

Choose a reason for hiding this comment

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

LGTM

Co-authored-by: Tyler Schultz <tschultz@vmware.com>
Co-authored-by: Edwin Xie <exie@vmware.com>
Co-authored-by: Christian Ang <angc@vmware.com>
@tylerschultz tylerschultz force-pushed the dhcp-ignore-dns-when-providing-nameservers branch from b2e5267 to cd44e89 Compare January 26, 2023 18:03
@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/4023/20230126180940/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

Copy link
Contributor

@imikushin imikushin left a comment

Choose a reason for hiding this comment

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

LGTM

@imikushin imikushin added the ok-to-merge PRs should be labelled with this before merging label Jan 27, 2023
@tylerschultz tylerschultz merged commit 49aa1e6 into vmware-tanzu:main Jan 27, 2023
@tylerschultz tylerschultz deleted the dhcp-ignore-dns-when-providing-nameservers branch January 27, 2023 21:56
tylerschultz added a commit to tylerschultz/tanzu-framework that referenced this pull request Feb 1, 2023
This feature had been feature-flagged because it had unexpected
behavior. Previously, when setting custom nameservers, they would not
always apply becuase nameservers supplied by DHCP would 'compete' with
the configured nameservers. Typically the OS would only apply 3
nameservers and ignoring the rest. This meant that often the addresses
supplied by DHCP would take precedence over the configured nameservers.

Recent changes, made in PR vmware-tanzu#4023, causes the OS to ignore nameservers
supplied from DHCP when using the WORKER_NODE_NAMESERVERS or
CONTROL_PLANE_NAMESERVERS variables.

Now that the functionality for specifying custom nameservers works as
expected, the feature flags can be removed.

Co-authored-by: Edwin Xie <exie@vmware.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-not-required ok-to-merge PRs should be labelled with this before merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nameservers from DHCP clobber the CONTROL_PLANE_NODE_NAMESERVERS or WORKER_NODE_NAMESERVERS settings
7 participants