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

Dynamic reload of SSL certificates for NGINX Plus #4764

Merged
merged 57 commits into from Dec 12, 2023
Merged

Conversation

oseoin
Copy link
Contributor

@oseoin oseoin commented Dec 7, 2023

Proposed changes

Enable lazy loading of SSL Certificates for NGINX Plus. This works by replacing the /etc/nginx/secrets with a map which returns that path by default for the variable $secret_dir_path.

E.g.

ssl_certificate /etc/nginx/secrets/default-my-secret.crt

Becomes:

map $nginx_version $secret_dir_path {
    default "/etc/nginx/secrets";
}

...

ssl_certificate $secret_dir_path/default-my-secret.crt

When this is enabled NIC checks secret updates and skips a reload of NGINX if there are no changes to the configuration files which reference that secret.

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

@github-actions github-actions bot added the helm_chart Pull requests that update the Helm Chart label Dec 7, 2023
Copy link

codecov bot commented Dec 7, 2023

Codecov Report

Attention: 146 lines in your changes are missing coverage. Please review.

Comparison is base (a122d11) 52.11% compared to head (cfd97c3) 51.96%.

Files Patch % Lines
internal/configs/configurator.go 28.44% 78 Missing ⚠️
internal/nginx/manager.go 0.00% 21 Missing ⚠️
cmd/nginx-ingress/main.go 0.00% 14 Missing ⚠️
internal/nginx/fake_manager.go 0.00% 11 Missing ⚠️
internal/configs/transportserver.go 85.00% 4 Missing and 2 partials ⚠️
cmd/nginx-ingress/flags.go 0.00% 4 Missing ⚠️
internal/k8s/controller.go 0.00% 4 Missing ⚠️
internal/configs/ingress.go 76.92% 2 Missing and 1 partial ⚠️
internal/configs/virtualserver.go 86.95% 2 Missing and 1 partial ⚠️
internal/configs/version1/template_executor.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4764      +/-   ##
==========================================
- Coverage   52.11%   51.96%   -0.16%     
==========================================
  Files          59       60       +1     
  Lines       17100    17191      +91     
==========================================
+ Hits         8912     8933      +21     
- Misses       7890     7954      +64     
- Partials      298      304       +6     

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

@oseoin oseoin linked an issue Dec 12, 2023 that may be closed by this pull request
@oseoin oseoin added this to the v3.4.0 milestone Dec 12, 2023
@vepatel
Copy link
Contributor

vepatel commented Dec 12, 2023

  File "/workspace/tests/suite/test_virtual_server_tls.py", line 201, in test_tls_termination
    assert reloads == expected_reloads, f"expected {expected_reloads} reloads, got {reloads}"
AssertionError: expected 0 reloads, got 1
assert 1 == 0

@oseoin oseoin requested a review from a team as a code owner December 12, 2023 13:29
@github-actions github-actions bot added the documentation Pull requests/issues for documentation label Dec 12, 2023
@oseoin
Copy link
Contributor Author

oseoin commented Dec 12, 2023

  File "/workspace/tests/suite/test_virtual_server_tls.py", line 201, in test_tls_termination
    assert reloads == expected_reloads, f"expected {expected_reloads} reloads, got {reloads}"
AssertionError: expected 0 reloads, got 1
assert 1 == 0

Should hopefully be resolved in the latest commit, always passed locally but upstream ordering for the virtualserver resource was not stable before now.

Copy link
Contributor

@shaun-nx shaun-nx left a comment

Choose a reason for hiding this comment

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

👏

@oseoin oseoin merged commit bd29988 into main Dec 12, 2023
62 checks passed
@oseoin oseoin deleted the dynamic-reload-ssl branch December 12, 2023 15:57
@oseoin oseoin mentioned this pull request Dec 13, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Pull requests/issues for documentation helm_chart Pull requests that update the Helm Chart tests Pull requests that update tests
Projects
Status: Done 🚀
Development

Successfully merging this pull request may close these issues.

Support "lazy loading" for SSL Certificates
4 participants