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

Add configurable data plane log level #2561

Closed
wants to merge 20 commits into from

Conversation

bjee19
Copy link
Contributor

@bjee19 bjee19 commented Sep 16, 2024

Add Nginx error log level to NginxProxy.

Problem: Users would like to assign a log level for the data plane.

Solution: Add Nginx error log level to NginxProxy which allows users to set the error log level for Nginx.

Testing: Unit tests and manual testing.

Manual testing included

  • Validating the enum values in the new ErrorLevel field in the NginxProxy resource.
  • Deploying NGF, setting up the cafe-app, deploying an NginxProxy resource, and testing each of the possible log levels and checking that the nginx conf (the main.conf file and running nginx -T) in the nginx container was updated correctly.
  • Checked that if the error level was not set in the NginxProxy resource, the nginx conf would be correctly updated back to the default of info log level.
  • Tested that if a log level was set to something "beneath" notice such as the error level, after making changes which would result in notice log levels being outputted (such as deleting and re-applying cafe.yaml in the cafe example), no notice log levels are outputted.
  • nginx -T correctly shows the main.conf configuration file being included in the nginx configuration.
  • ps aux |grep nginx when inside the nginx container correctly showed nginx-debug processes.
  • Deployed the cafe example and deleted it a few times and NGF still worked properly with no error logs in either container.

Closes #901

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

Release notes

If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.


@github-actions github-actions bot added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 16, 2024
Copy link

codecov bot commented Sep 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.23%. Comparing base (edbd856) to head (9b6c854).
Report is 27 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2561      +/-   ##
==========================================
- Coverage   89.34%   89.23%   -0.11%     
==========================================
  Files         100      101       +1     
  Lines        7630     7667      +37     
  Branches       50       50              
==========================================
+ Hits         6817     6842      +25     
- Misses        756      768      +12     
  Partials       57       57              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

apis/v1alpha1/nginxproxy_types.go Outdated Show resolved Hide resolved
@github-actions github-actions bot added the helm-chart Relates to helm chart label Sep 19, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we think this is needed? Also, if we should add a NGINX Plus in debug mode tab?

@@ -88,6 +88,9 @@ nginx:
# -- Is NGINX Plus image being used
plus: false

# -- Is NGINX run in debug mode. This should be used with setting the NGINX error log level to debug.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kate-osborn Should the wording on the comment be more strict to specify "require"?

I think it'd be fine to run NGINX in debug mode without NGINX error log level being debug, there'd be no point but I'd be fine with that. I can change this to something like "In order for this to be useful, NGINX error log level should be set to debug" or anything you suggest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

would an nginx-plus in debug mode be beneficial to generate?

@bjee19 bjee19 marked this pull request as ready for review September 24, 2024 18:50
@bjee19 bjee19 requested a review from a team as a code owner September 24, 2024 18:50
@bjee19 bjee19 requested a review from a team as a code owner September 24, 2024 18:50
@bjee19
Copy link
Contributor Author

bjee19 commented Sep 24, 2024

Ready for review, still testing to make sure everything works with NGINX plus.

internal/mode/static/state/dataplane/configuration.go Outdated Show resolved Hide resolved
internal/mode/static/state/dataplane/configuration.go Outdated Show resolved Hide resolved
site/content/how-to/data-plane-configuration.md Outdated Show resolved Hide resolved
be [run with NGINX in debug mode](#run-nginx-gateway-fabric-with-nginx-in-debug-mode) upon startup through the addition
of a few arguments. {{</ note >}}

## Run NGINX Gateway Fabric with NGINX in debug mode
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, this feels like it should be somewhere else...troubleshooting guide maybe?

@bjee19
Copy link
Contributor Author

bjee19 commented Sep 25, 2024

Closing this PR and moving to #2603

@bjee19 bjee19 closed this Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request helm-chart Relates to helm chart
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Configurable Data Plane Log-Level
5 participants