-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
support custom configuration to main context of nginx config #2895
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2895 +/- ##
=======================================
Coverage 47.56% 47.56%
=======================================
Files 76 76
Lines 5483 5483
=======================================
Hits 2608 2608
Misses 2540 2540
Partials 335 335
Continue to review full report at Codecov.
|
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.
Looks reasonable to me. Would you mind adding a simple e2e test to make sure custom directives make it to the config?
## main-snippet | ||
|
||
Adds custom configuration to the main section of the nginx configuration. | ||
_**default:**_ "" |
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.
I think you can remove that default: ""
from all *-snippet descriptions (including the ones that are not part of this PR). It is mentioned in the table, and is kind of obvious.
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.
33a284ac0c96899e018af79a39692897b236dec2
I'll add the e2e tests and ping when it's ready, thanks for the quick review. |
@antoineco I've added a very naive e2e test: 60a4c3fb454e049515a5dc9550e7897b969963df similar to other tests, it simply asserts the value is contained within the entire configuration file. obviously this is not ideal and preferably we should assert that it is included inside the once this is approved I will squash the commits. |
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.
The test you added should do since each test runs in its own isolated namespace. Thanks for that!
test/e2e/settings/main_snippet.go
Outdated
err := f.UpdateNginxConfigMapData(mainSnippet, expectedComment) | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
ing, err := f.EnsureIngress(framework.NewSingleIngress( |
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.
Not relevant for that particular test.
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.
87455d7445255f68629b155baf26072113a5086b
Thanks @tomxor 🙌 I'll wait for you to squash these 4 commits and approve the PR. |
@antoineco squashed, thanks for the review! |
/lgtm |
/lgtm cancel |
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.
Apologizes for the round-trips, I missed that one. Feel free to git commit --amend --no-edit
.
test/e2e/settings/main_snippet.go
Outdated
mainSnippet := "main-snippet" | ||
|
||
BeforeEach(func() { | ||
err := f.NewEchoDeployment() |
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.
Also irrelevant.
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 worries, pushed.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: antoineco, tomxor The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
Adding custom configuration to the main context of the nginx config file is currently only possible by providing a custom template. IMO doing so should be considered a last resort since it could make the upgrade process more painful. This PR introduces the
main-snippet
ConfigMap option which enables addition of custom settings to the main context of the nginx config file.Release note:
Special notes for your reviewer:
Didn't see any tests for similar functions (e.g.
http-snippet
). I assume this can be verified in the e2e tests but I wasn't entirely sure if that's the proper place to test it.