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

Use node ip autodiscovery #1513

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions images/base/files/usr/local/bin/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ enable_network_magic(){
cp /etc/resolv.conf /etc/resolv.conf.original
sed -e "s/${docker_embedded_dns_ip}/${docker_host_ip}/g" /etc/resolv.conf.original >/etc/resolv.conf

# use dns to resolve hostnames with more priority than files
cp /etc/nsswitch.conf /etc/nsswitch.conf.original
Copy link
Member

Choose a reason for hiding this comment

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

what was the original value?
why aren't we statically rewriting this in the baseimage build?

Copy link
Member

Choose a reason for hiding this comment

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

debian should be hosts: dns [!UNAVAIL=return] files I think, which is actually a little surprising, I thought most distros were shipping ~files dns

golang/go#35305
https://manpages.debian.org/stretch/manpages/nsswitch.conf.5.en.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct, the original was files dns

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't think about the original bare honestly, added to the entry point because is where we are adding these hacks

sed -e "s/^hosts:.*/hosts: dns files/" /etc/nsswitch.conf.original >/etc/nsswitch.conf
aojea marked this conversation as resolved.
Show resolved Hide resolved

# fixup IPs in manifests ...
# TODO: ensure this supports rebooting the host w/ IPv6 clusters
curr_ip=$(hostname --ip-address)
Expand Down
9 changes: 9 additions & 0 deletions pkg/cluster/internal/kubeadm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,15 @@ func Config(data ConfigData) (config string, err error) {
data.FeatureGates = make(map[string]bool)
}

if ver.AtLeast(version.MustParseSemantic("v1.18.0")) {
// Use IP autodiscovery
if data.IPv6 {
data.NodeAddress = "::"
} else {
data.NodeAddress = ""
}
}

// assume the latest API version, then fallback if the k8s version is too low
templateSource := ConfigTemplateBetaV2
if ver.LessThan(version.MustParseSemantic("v1.12.0")) {
Expand Down