Skip to content

Conversation

@SriHarsha001
Copy link
Contributor

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:

  • uses conventional commit messages
  • includes documentation
  • adds unit tests
  • tested upgrade from previous version
  • commits are GPG signed and Github marks them as verified

Special notes for your reviewer:

Release note:

none

@SriHarsha001
Copy link
Contributor Author

Tested manually -

image

Will work on e2e test for this which will take some time as it is slightly difficult.

# 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() {
Copy link
Member

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?

Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

@saewoni
Copy link

saewoni commented Jan 7, 2026

were you able to see why the checkin tests were failing?

@saewoni
Copy link

saewoni commented Jan 7, 2026

i think you need to merge with the latest main

@SriHarsha001
Copy link
Contributor Author

were you able to see why the checkin tests were failing?

Yes, checkin tests that are failing are not related to my changes.

@SriHarsha001
Copy link
Contributor Author

i think you need to merge with the latest main

yes, I need to merge the latest generated files.

@SriHarsha001 SriHarsha001 reopened this Jan 7, 2026
@SriHarsha001
Copy link
Contributor Author

were you able to see why the checkin tests were failing?

Yes, the checkin tests that are failing are not related to my changes.

@SriHarsha001 SriHarsha001 force-pushed the sharsha/ReGenerateLocaldnsCoreFile3 branch from 2a5601c to 4954da2 Compare January 7, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants