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

Fix NGF fails to recover if conf files are unexpectedly removed #1132

Merged
merged 6 commits into from
Oct 13, 2023

Conversation

bjee19
Copy link
Contributor

@bjee19 bjee19 commented Oct 11, 2023

Proposed changes

Problem: When the http.conf file did not exist, any updates to NGF would cause NGF to error as it could not "replace" that file as it didn't exist.

Solution: Added a check to see if the error returned from trying to remove a conf file was a IsNotExist, if so, continue and act as if the file has been deleted.

Testing: Manually tested that NGF was able to recover after manually deleting the http.conf file and deploying an example. Also checked for config-version.conf and saw the same fixed results.

Note: Part of AC was determining how the http.conf file could be removed as a part of our normal workflow and I worked with @kate-osborn to run through some of the most realistic scenarios and they all felt very unlikely to happen and we decided to log an error message at the debug level for when this occurs and not to pursue looking into it anymore. Perhaps when looking through log messages if one sees the log message, they can revisit this situation with more information.

Closes #1110

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

@bjee19 bjee19 requested a review from a team as a code owner October 11, 2023 22:38
@github-actions github-actions bot added the bug Something isn't working label Oct 11, 2023
internal/mode/static/nginx/file/manager.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/file/manager.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/file/manager.go Show resolved Hide resolved
@bjee19 bjee19 force-pushed the bug/fail-to-recover-from-missing-conf branch from a00bdb7 to a2c6b27 Compare October 12, 2023 18:14
@bjee19 bjee19 changed the title Add change so NGF does not fail if conf file does not exist when updating Fix NGF fails to recover if conf files are unexpectedly removed Oct 12, 2023
internal/mode/static/nginx/file/manager.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/file/manager.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/file/manager.go Outdated Show resolved Hide resolved
@bjee19 bjee19 requested a review from pleshakov October 12, 2023 21:40
Copy link
Contributor

@pleshakov pleshakov left a comment

Choose a reason for hiding this comment

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

looks good! one change request

internal/mode/static/nginx/file/manager_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@kate-osborn kate-osborn left a comment

Choose a reason for hiding this comment

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

🚀

@bjee19 bjee19 requested a review from pleshakov October 13, 2023 15:58
Copy link
Contributor

@pleshakov pleshakov left a comment

Choose a reason for hiding this comment

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

👍

@bjee19 bjee19 force-pushed the bug/fail-to-recover-from-missing-conf branch from ae37218 to 06cdadf Compare October 13, 2023 16:10
@bjee19 bjee19 merged commit 5324908 into nginxinc:main Oct 13, 2023
22 checks passed
@bjee19 bjee19 deleted the bug/fail-to-recover-from-missing-conf branch November 20, 2023 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

NGF fails to recover if conf files are unexpectedly removed
5 participants