-
Notifications
You must be signed in to change notification settings - Fork 244
fix: regenerate localdns corefile if it goes missing #7604
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
base: main
Are you sure you want to change the base?
Conversation
pkg/agent/testdata/AKSUbuntu2204+KubeletServingCertificateRotation/CustomData
Outdated
Show resolved
Hide resolved
| # It creates the localdns corefile and slicefile, then enables and starts localdns. | ||
| # In this function, generated base64 encoded localdns corefile is decoded and written to the corefile path. | ||
| # This function also creates the localdns slice file with memory and cpu limits, that will be used by localdns systemd unit. | ||
| shouldEnableLocalDns() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this called by scriptless only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And also, why this function is called shouldEnableLocalDns()? it just enables localdns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this function is only called by scriptless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we need to make non-scriptless scenario to recreate the corefiles as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last we discussed about this topic - Scripless is about to be GA, so enable it for scriptless. For non-scriptless path, it needs lot of code changes in multiple files and we might have to cleanup after scriptless in is prod.
| return 1 | ||
|
|
||
| echo "Attempting to regenerate localdns corefile..." | ||
| if regenerate_localdns_corefile; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will localdns restart automatically when corefile is deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, localdns systemd unit will not restart automatically when the corefile get deleted. If the corefile gets deleted for any reason, and if watchdog restarts systemd unit inside the node, then localdns systemd unit will never come up. So this PR will handle this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, if the corefile is deleted, and the systemd unit is not restarted, will it still functioning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that is correct and that is what I have noticed on the node.
|
were you able to see why the checkin tests were failing? |
|
i think you need to merge with the latest main |
Yes, checkin tests that are failing are not related to my changes. |
yes, I need to merge the latest generated files. |
Yes, the checkin tests that are failing are not related to my changes. |
2a5601c to
4954da2
Compare

What type of PR is this?
Bug
What this PR does / why we need it:
If the localdns corefile goes missing for any reason on the node and localdns systemd unit is restarted, the code changes in this PR will handle regeneration of the corefile, so that localdns does not start crashing.
Which issue(s) this PR fixes:
Fixes #
Requirements:
Special notes for your reviewer:
Release note: