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

nodeup: Check if /run/systemd/resolve/resolv.conf exists on the node and use it #16495

Merged

Conversation

zak905
Copy link
Contributor

@zak905 zak905 commented Apr 26, 2024

fixes #16494
The PR is in draft because I have not tested yet on a Hetzner account (maybe worth checking also other cloud providers)

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 26, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @zak905. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 26, 2024
nodeup/pkg/model/kubelet.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 1, 2024
@zak905 zak905 requested a review from hakman May 1, 2024 16:48
@zak905
Copy link
Contributor Author

zak905 commented May 1, 2024

@hakman I added a task to check whether /run/systemd/resolve/resolv.conf is present. In case it is there, the resolvConf is set directly in the kubelet.conf file, otherwise kubelet defaults to /etc/resolv.conf, so we do not need to explicitely set it. WDYT ?

@hakman
Copy link
Member

hakman commented May 4, 2024

@hakman I added a task to check whether /run/systemd/resolve/resolv.conf is present. In case it is there, the resolvConf is set directly in the kubelet.conf file, otherwise kubelet defaults to /etc/resolv.conf, so we do not need to explicitely set it. WDYT ?

@zak905 Is there a need for a task in this case? Wouldn't just checking the existence be enough?

@zak905
Copy link
Contributor Author

zak905 commented May 4, 2024

I agree, but based on my current understanding, I did not find a way to access the node file system (when bootstrapping) except using a task. Can you please clarify ?

@hakman
Copy link
Member

hakman commented May 5, 2024

@zak905 I think the only change should be in HasLoopbackEtcResolvConf():

func (d *Distribution) HasLoopbackEtcResolvConf() bool {
	switch d.project {
	case "ubuntu":
		return d.version >= 18.04
	case "flatcar":
		return true
	default:
		if _, err := os.Stat("/run/systemd/resolve/resolv.conf"); err == nil {
 			return true
		}
		return false
	}
}

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 6, 2024
@zak905
Copy link
Contributor Author

zak905 commented May 6, 2024

I see thanks. Done. It's much cleaner:) I will try to do an end to end test on Hetzner.

@zak905 zak905 marked this pull request as ready for review May 6, 2024 17:27
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 6, 2024
@hakman
Copy link
Member

hakman commented May 7, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 7, 2024
@hakman hakman changed the title nodeup: use cloud provider(in addition to distibution) to determine kubelet resolver config Check if /run/systemd/resolve/resolv.conf on the node and use it May 7, 2024
@hakman
Copy link
Member

hakman commented May 7, 2024

I see thanks. Done. It's much cleaner:) I will try to do an end to end test on Hetzner.

Thanks @zak905. If you don't mind, please squash the commits.
Probably tests need an adjustment to fix resolvConf to some value and running hack/update-expected.sh:

kubelet:
featureGates:
ExperimentalCriticalPodAnnotation: "true"
AllowExtTrafficLocalEndpoints: "false"
podManifestPath: "/etc/kubernetes/manifests"

and
kubelet:
podManifestPath: "/etc/kubernetes/manifests"

@hakman hakman changed the title Check if /run/systemd/resolve/resolv.conf on the node and use it Check if /run/systemd/resolve/resolv.conf exists on the node and use it May 7, 2024
@hakman hakman changed the title Check if /run/systemd/resolve/resolv.conf exists on the node and use it nodeup: Check if /run/systemd/resolve/resolv.conf exists on the node and use it May 7, 2024
@zak905 zak905 force-pushed the fix_debia12_resolver_config_hetzner branch from f9e703c to 82c2015 Compare May 7, 2024 14:53
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 7, 2024
@hakman
Copy link
Member

hakman commented May 7, 2024

Thanks @zak905! 😄
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 7, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hakman

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 7, 2024
@k8s-ci-robot k8s-ci-robot merged commit 84db196 into kubernetes:master May 7, 2024
21 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.30 milestone May 7, 2024
@zak905
Copy link
Contributor Author

zak905 commented May 7, 2024

Welcome! sorry I did not catch your last comment about testing until later.

@hakman
Copy link
Member

hakman commented May 7, 2024

Welcome! sorry I did not catch your last comment about testing until later.

No worries! 👍

k8s-ci-robot added a commit that referenced this pull request May 8, 2024
…-upstream-release-1.28

Automated cherry pick of #16495: check /run/systemd/resolve/resolv.conf inside
k8s-ci-robot added a commit that referenced this pull request May 8, 2024
…-upstream-release-1.29

Automated cherry pick of #16495: check /run/systemd/resolve/resolv.conf inside
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. area/nodeup cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/office-hours lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provisioning a cluster on Hetzner with debian 12 images fails
3 participants