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

Refactor internal/envoy/v3 package functions #6871

Merged
merged 6 commits into from
Jan 31, 2025

Conversation

davinci26
Copy link
Contributor

Take two of #5523

That introduces a struct NewEnvoysGen that allows us to modify the behaviour of Envoy config generation. This will help with

#6806

On the debate on singleton vs struct approach. I thought this again and I realized that struct is probably worth the big diff here. For the following reason:

  • It allows us to test the behaviour much easier. With a singleton it would be impossible for higher level tests like tests in internal/featuretests to modify the behaviour of the Envoy config generation. With a struct, we can just pass the config options to the struct and test the behaviour.

Take two of projectcontour#5523

That introduces a struct `NewEnvoysGen` that allows us to modify the
behaviour of Envoy config generation. This will help with

projectcontour#6806

On the debate on `singleton` vs `struct` approach. I thought this again
and I realized that `struct` is probably worth the big diff here. For the
following reason:

* It allows us to test the behaviour much easier. With a singleton it would be
impossible for higher level tests like tests in `internal/featuretests` to modify
the behaviour of the Envoy config generation. With a struct, we can just pass the
config options to the struct and test the behaviour.

Signed-off-by: Sotiris Nanopoulos <[email protected]>
@davinci26 davinci26 requested a review from a team as a code owner January 20, 2025 14:26
@davinci26 davinci26 requested review from skriss and sunjayBhatia and removed request for a team January 20, 2025 14:26
@sunjayBhatia sunjayBhatia requested review from a team, rajatvig and wilsonwu and removed request for a team January 20, 2025 14:27
@davinci26
Copy link
Contributor Author

(waiting for the CI to pass before I give people the go ahead to review)

Copy link

codecov bot commented Jan 20, 2025

Codecov Report

Attention: Patch coverage is 92.54658% with 12 lines in your changes missing coverage. Please review.

Project coverage is 81.07%. Comparing base (2b05fca) to head (b055e7a).
Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
cmd/contour/serve.go 0.00% 6 Missing ⚠️
cmd/contour/contour.go 0.00% 4 Missing ⚠️
internal/envoy/v3/bootstrap.go 85.71% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6871      +/-   ##
==========================================
+ Coverage   81.05%   81.07%   +0.02%     
==========================================
  Files         133      134       +1     
  Lines       20026    20087      +61     
==========================================
+ Hits        16232    16286      +54     
- Misses       3500     3507       +7     
  Partials      294      294              
Files with missing lines Coverage Δ
internal/envoy/v3/auth.go 100.00% <100.00%> (ø)
internal/envoy/v3/cluster.go 96.30% <100.00%> (-0.17%) ⬇️
internal/envoy/v3/config_gen.go 100.00% <100.00%> (ø)
internal/envoy/v3/endpoint.go 100.00% <100.00%> (ø)
internal/envoy/v3/listener.go 98.50% <100.00%> (+<0.01%) ⬆️
internal/envoy/v3/ratelimit.go 100.00% <100.00%> (ø)
internal/envoy/v3/regex.go 100.00% <100.00%> (ø)
internal/envoy/v3/route.go 81.00% <100.00%> (ø)
internal/envoy/v3/stats.go 100.00% <100.00%> (ø)
internal/envoy/v3/tracing.go 93.44% <100.00%> (ø)
... and 7 more

Signed-off-by: Sotiris Nanopoulos <[email protected]>
@davinci26
Copy link
Contributor Author

@sunjayBhatia this is ready for review. Does this need a release note?

@sunjayBhatia
Copy link
Member

@sunjayBhatia this is ready for review. Does this need a release note?

probably not! i'll add the label

@sunjayBhatia sunjayBhatia added the release-note/none-required Marks a PR as not requiring a release note. Should only be used for very small changes. label Jan 23, 2025
Copy link
Member

@sunjayBhatia sunjayBhatia left a comment

Choose a reason for hiding this comment

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

AFAICT looks good! tests are all passing+compiling which is a good hint

one other tiny nit would be to see if there are any other exported functions in internal/envoy/v3 that could be unexported to avoid any future code using them and not using the config generator (e.g. GrpcService)

will leave for others to catch anything i missed but 👍🏽 from me

internal/envoy/v3/config_gen.go Outdated Show resolved Hide resolved
Signed-off-by: Sotiris Nanopoulos <[email protected]>
Signed-off-by: Sotiris Nanopoulos <[email protected]>
…efault and old are the same

Signed-off-by: Sotiris Nanopoulos <[email protected]>
@davinci26
Copy link
Contributor Author

@skriss and @sunjayBhatia can I get another round of review 🙏 🙏 🙏 I am afraid that I will be fighting with merge conflicts with this one and this one is blocking to delta XDS which is something that would be fantastic for the project!

@sunjayBhatia
Copy link
Member

LGTM but should get another sanity check from another one of @projectcontour/maintainers, thanks @davinci26!

@skriss skriss merged commit c0baeb1 into projectcontour:main Jan 31, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/none-required Marks a PR as not requiring a release note. Should only be used for very small changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants