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: group xds security features for security policy #3019

Merged
merged 7 commits into from
Apr 12, 2024

Conversation

shawnh2
Copy link
Contributor

@shawnh2 shawnh2 commented Mar 26, 2024

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR fixes:

related: #2954, separated from #2926

Signed-off-by: shawnh2 <shawnhxh@outlook.com>
@shawnh2 shawnh2 requested a review from a team as a code owner March 26, 2024 04:12
@shawnh2 shawnh2 requested a review from zhaohuabing March 26, 2024 04:13
Copy link

codecov bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 51.09489% with 67 lines in your changes are missing coverage. Please review.

Project coverage is 64.41%. Comparing base (29946b0) to head (6c98fd2).
Report is 28 commits behind head on main.

❗ Current head 6c98fd2 differs from pull request most recent head e56efaf. Consider uploading reports for the commit e56efaf to get more accurate results

Files Patch % Lines
internal/ir/zz_generated.deepcopy.go 0.00% 38 Missing and 1 partial ⚠️
internal/ir/xds.go 21.87% 22 Missing and 3 partials ⚠️
internal/xds/translator/oidc.go 70.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3019      +/-   ##
==========================================
- Coverage   66.51%   64.41%   -2.10%     
==========================================
  Files         161      121      -40     
  Lines       22673    21428    -1245     
==========================================
- Hits        15080    13802    -1278     
- Misses       6720     6759      +39     
+ Partials      873      867       -6     

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

@shawnh2
Copy link
Contributor Author

shawnh2 commented Mar 26, 2024

/retest

1 similar comment
@shawnh2
Copy link
Contributor Author

shawnh2 commented Mar 26, 2024

/retest

internal/ir/xds.go Outdated Show resolved Hide resolved
internal/ir/xds.go Outdated Show resolved Hide resolved
Copy link
Member

@zhaohuabing zhaohuabing left a comment

Choose a reason for hiding this comment

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

Thanks for the refactoring. This looks good, just a few nits.

@shawnh2 shawnh2 requested review from zhaohuabing and arkodg March 27, 2024 13:19
@shawnh2
Copy link
Contributor Author

shawnh2 commented Mar 27, 2024

/retest

zhaohuabing
zhaohuabing previously approved these changes Mar 27, 2024
Copy link
Member

@zhaohuabing zhaohuabing left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

Signed-off-by: shawnh2 <shawnhxh@outlook.com>
@zirain
Copy link
Contributor

zirain commented Mar 28, 2024

/retest

@zhaohuabing
Copy link
Member

@shawnh2 Apologies for the delay on this PR. Can you fix the conflicts so we can move on?

shawnh2 added 2 commits April 10, 2024 18:00
Signed-off-by: shawnh2 <shawnhxh@outlook.com>
Signed-off-by: shawnh2 <shawnhxh@outlook.com>
@shawnh2
Copy link
Contributor Author

shawnh2 commented Apr 10, 2024

@shawnh2 Apologies for the delay on this PR. Can you fix the conflicts so we can move on?

Resolved, thanks for reviewing this.

@shawnh2
Copy link
Contributor Author

shawnh2 commented Apr 10, 2024

/retest

@shawnh2 shawnh2 requested review from a team April 10, 2024 10:32
@shawnh2
Copy link
Contributor Author

shawnh2 commented Apr 10, 2024

TestE2E/GatewayInfraResourceTest/create_gateway seems a liitle unstable.

@shawnh2
Copy link
Contributor Author

shawnh2 commented Apr 10, 2024

/retest

Copy link
Member

@zhaohuabing zhaohuabing left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

return true
}

return s.CORS == nil &&
Copy link
Contributor

Choose a reason for hiding this comment

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

will we ever hit this case ? where s != nil, but all sub fields are nil ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we may very unlikely to hit the case that all fields are nil, but we may hit the case that only some (if any) of the fields are set, indicates s is not Empty, return false. This is exactly what we used for this method, as you can see in translateSecurityPolicyForGateway method.

I took the @zhaohuabing's suggestion, make this method called Empty, instead of Any (or other name), so it will be very comprehensible for anyone who read it.

Copy link
Contributor

Choose a reason for hiding this comment

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

non blocking comment - I personally feel this is not needed, and s != nil is enough w/o the need for a Empty func

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will try this out, if it's working w/o Empty method, I will refactor this in the follow-up PR along with the refactor of BTP.

@arkodg
Copy link
Contributor

arkodg commented Apr 12, 2024

this looks good @shawnh2 ! sorry for the delay in reviewing it
have one minor/curious comment reg Empty() , else LGTM !

@arkodg arkodg merged commit 231b3b4 into envoyproxy:main Apr 12, 2024
16 of 17 checks passed
@shawnh2 shawnh2 deleted the xds-sp-group branch April 12, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants