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

update nginx template for TLS passthrough #2166

Conversation

sarthyparty
Copy link
Contributor

@sarthyparty sarthyparty commented Jun 20, 2024

Proposed changes

Problem: Nginx templates didn't support TLS passthrough inside stream block

Solution: I added nginx template for stream servers and also added a Layer4Server type to data plane

Testing: Tested the conversion from data plane type to nginx template

Please focus on (optional): If you any specific areas where you would like reviewers to focus their attention or provide
specific feedback, add them here.

Closes #ISSUE

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 enhancement New feature or request helm-chart Relates to helm chart labels Jun 20, 2024
@sarthyparty sarthyparty requested a review from kate-osborn June 20, 2024 20:13
@sarthyparty
Copy link
Contributor Author

I didn't add anything to data plane for upstreams yet, I was thinking of reusing the existing type BackendGroup and just adding an IsStream boolean

@sarthyparty sarthyparty force-pushed the feature/add-nginx-template-config-for-tls-route branch 2 times, most recently from d76b1c4 to d48dba2 Compare June 20, 2024 20:23
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.

@sarthyparty nice work! Please see my review

internal/mode/static/nginx/conf/nginx.conf Show resolved Hide resolved
internal/mode/static/nginx/config/generator.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/maps.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/maps.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/stream_servers_test.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/upstreams.go Outdated Show resolved Hide resolved
internal/mode/static/state/dataplane/types.go Show resolved Hide resolved
internal/mode/static/state/dataplane/types.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/maps.go Outdated Show resolved Hide resolved
@sarthyparty sarthyparty force-pushed the feature/add-nginx-template-config-for-tls-route branch from eb22a09 to fa2812f Compare June 21, 2024 19:27
internal/mode/static/nginx/config/maps.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/servers.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/servers.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/servers.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/servers.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/maps.go Show resolved Hide resolved
internal/mode/static/state/dataplane/types.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/maps.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/maps.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/maps.go Show resolved Hide resolved
Parameters: []http.MapParameter{
{
Value: t.Hostname,
Result: "unix:/var/lib/nginx/" + t.Hostname + fmt.Sprint(t.Port) + ".sock",
Copy link
Contributor

Choose a reason for hiding this comment

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

Hostnames can have * which are not valid characters for file names.

  • are fine :)
server {
    listen unix:/var/run/*.server.sock;
    access_log off;

    return 200 "hello\n";
}
ls /var/run/*.sock
'/var/run/*.server.sock'

internal/mode/static/nginx/conf/nginx.conf Show resolved Hide resolved
@sarthyparty sarthyparty force-pushed the feature/add-nginx-template-config-for-tls-route branch from a5e35b7 to af649df Compare June 26, 2024 20:34
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jun 26, 2024
@sarthyparty sarthyparty marked this pull request as ready for review June 26, 2024 20:35
@sarthyparty sarthyparty requested review from a team as code owners June 26, 2024 20:35
Copy link
Contributor

@sjberman sjberman left a comment

Choose a reason for hiding this comment

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

Can we rebase the feature branch feature/tls-passthrough on main to reduce the diff in this PR? Some extra stuff in there from other unrelated commits.

@@ -170,7 +170,7 @@ func newEventHandlerImpl(cfg eventHandlerConfig) *eventHandlerImpl {

func (h *eventHandlerImpl) HandleEventBatch(ctx context.Context, logger logr.Logger, batch events.EventBatch) {
start := time.Now()
logger.V(1).Info("Started processing event batch")
logger.V(1).Info("Started processing event batch hello", "name", "sarthak")
Copy link
Contributor

Choose a reason for hiding this comment

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

Debugging log can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok will do

@sarthyparty sarthyparty force-pushed the feature/add-nginx-template-config-for-tls-route branch from 23f8b38 to 47ba96e Compare June 26, 2024 21:37
@github-actions github-actions bot removed the documentation Improvements or additions to documentation label Jun 26, 2024
@pleshakov
Copy link
Contributor

would it make sense to enable GitHub pipeline including linting for the branch feature/tls-passthrough ?

@kate-osborn
Copy link
Contributor

kate-osborn commented Jun 27, 2024

would it make sense to enable GitHub pipeline including linting for the branch feature/tls-passthrough ?

Yes, definitely, good catch.

@lucacome what's the best way to do that? Should I just add the feature branch name to the on push in ci.yml on the feature branch?

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.

Leaving a partial review. I'm about half-way through, but want to give you something to work on while I finish.

internal/mode/static/nginx/conf/nginx.conf Show resolved Hide resolved
internal/mode/static/nginx/config/maps.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/maps.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/maps.go Show resolved Hide resolved
internal/mode/static/nginx/config/maps_test.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/maps.go Show resolved Hide resolved
Copy link

codecov bot commented Jun 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.79%. Comparing base (04cfbc3) to head (3f5ee8b).

Additional details and impacted files
@@                     Coverage Diff                     @@
##           feature/tls-passthrough    #2166      +/-   ##
===========================================================
+ Coverage                    87.59%   87.79%   +0.20%     
===========================================================
  Files                           96       98       +2     
  Lines                         6698     6810     +112     
  Branches                        50       50              
===========================================================
+ Hits                          5867     5979     +112     
  Misses                         774      774              
  Partials                        57       57              

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

internal/mode/static/nginx/config/servers.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/servers.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/servers_template.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/servers_test.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/stream_servers.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/stream_servers_test.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/upstreams.go Outdated Show resolved Hide resolved
internal/mode/static/state/dataplane/configuration.go Outdated Show resolved Hide resolved
@sarthyparty sarthyparty requested a review from kate-osborn July 1, 2024 20:49
sarthyparty and others added 5 commits July 1, 2024 14:52
Problem: nginx configuration templates didn't support TLS passthrough

Solution: I added a template setup fro stream servers
Co-authored-by: Kate Osborn <50597707+kate-osborn@users.noreply.github.com>
@sarthyparty sarthyparty requested a review from kate-osborn July 2, 2024 20:40
internal/mode/static/nginx/config/maps.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/maps_test.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/maps_test.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/maps_test.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/stream_servers_test.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/stream_servers_test.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/stream_servers_test.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/upstreams.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/upstreams_test.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/conf/nginx-plus.conf Outdated Show resolved Hide resolved
internal/mode/static/nginx/conf/nginx.conf Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/servers.go Outdated Show resolved Hide resolved
@sarthyparty sarthyparty requested a review from sjberman July 3, 2024 14:59
internal/mode/static/nginx/config/maps.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/maps.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/sockets.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/upstreams.go Outdated Show resolved Hide resolved
internal/mode/static/nginx/config/upstreams_test.go Outdated Show resolved Hide resolved
@sarthyparty sarthyparty requested a review from pleshakov July 5, 2024 18:50
@sarthyparty sarthyparty merged commit 1bc8be4 into nginxinc:feature/tls-passthrough Jul 8, 2024
20 checks passed
sarthyparty added a commit that referenced this pull request Jul 8, 2024
Update nginx template for TLS passthrough

Problem: nginx configuration templates didn't support TLS passthrough

Solution: I added a template setup fro stream servers
sarthyparty added a commit to sarthyparty/nginx-gateway-fabric that referenced this pull request Jul 23, 2024
Update nginx template for TLS passthrough

Problem: nginx configuration templates didn't support TLS passthrough

Solution: I added a template setup fro stream servers
sarthyparty added a commit to sarthyparty/nginx-gateway-fabric that referenced this pull request Jul 23, 2024
Update nginx template for TLS passthrough

Problem: nginx configuration templates didn't support TLS passthrough

Solution: I added a template setup fro stream servers
sarthyparty added a commit that referenced this pull request Jul 23, 2024
Update nginx template for TLS passthrough

Problem: nginx configuration templates didn't support TLS passthrough

Solution: I added a template setup fro stream servers
sarthyparty added a commit to sarthyparty/nginx-gateway-fabric that referenced this pull request Jul 23, 2024
Update nginx template for TLS passthrough

Problem: nginx configuration templates didn't support TLS passthrough

Solution: I added a template setup fro stream servers
sarthyparty added a commit to sarthyparty/nginx-gateway-fabric that referenced this pull request Jul 31, 2024
Update nginx template for TLS passthrough

Problem: nginx configuration templates didn't support TLS passthrough

Solution: I added a template setup fro stream servers
sarthyparty added a commit to sarthyparty/nginx-gateway-fabric that referenced this pull request Aug 7, 2024
Update nginx template for TLS passthrough

Problem: nginx configuration templates didn't support TLS passthrough

Solution: I added a template setup fro stream servers
sarthyparty added a commit that referenced this pull request Aug 8, 2024
Update nginx template for TLS passthrough

Problem: nginx configuration templates didn't support TLS passthrough

Solution: I added a template setup fro stream servers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants