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

fix: revisit AdmissionResponse of policy groups #909

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

flavio
Copy link
Member

@flavio flavio commented Sep 19, 2024

The API Server puts some limitations on the warnings:

  • they cannot exceed 256 characters
  • the size of all the warnings cannot exceed 4096 characters
  • they are returned as HTTP headers, hence not all characters are allowed

Because of these reasons, starting from now, we use the warning struct only to tell the user whether a member policy was evaluated or not. When it was evaluated we just tell the outcome (allow/reject).

The details of each policy evaluation are returned as part of the AdmissionResponse.status.details.causes.

Notes: the warning messages are always shown, regardless of the request being accepted or rejected.
The AdmissionResponse.status.details.causes are shown only when the request is rejected. kubectl shows them only when run with verbose major or equal to 4 (-v4).

Policy Server always shows the causes inside of its logs when running in debug mode.

The causes are always sent as part of the traces emitted by Policy Server.

@flavio flavio requested a review from a team as a code owner September 19, 2024 15:29
@flavio flavio self-assigned this Sep 19, 2024
@flavio flavio force-pushed the group-policy-revisit-admission-response branch from 5ea003d to 8319169 Compare September 19, 2024 15:34
Copy link

codecov bot commented Sep 19, 2024

Codecov Report

Attention: Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 63.11%. Comparing base (fd8b097) to head (445a710).

Files with missing lines Patch % Lines
src/evaluation/evaluation_environment.rs 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #909      +/-   ##
==========================================
- Coverage   63.47%   63.11%   -0.36%     
==========================================
  Files          17       17              
  Lines        1043     1052       +9     
==========================================
+ Hits          662      664       +2     
- Misses        381      388       +7     
Flag Coverage Δ
integration-tests 55.56% <86.66%> (-0.39%) ⬇️
unit-tests 38.28% <93.33%> (-0.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@flavio flavio force-pushed the group-policy-revisit-admission-response branch from 8319169 to 7324377 Compare September 19, 2024 16:22
@fabriziosestito
Copy link
Contributor

Overall LGTM, some integration tests are failing due to the updated AdmissioResponse

The API Server puts some limitations on the warnings:
- they cannot exceed 256 characters
- the size of all the warnings cannot exceed 4096 characters
- they are returned as HTTP headers, hence not all characters are allowed

Because of these reasons, starting from now, we use the warning struct only to
tell the user whether a member policy was evaluated or not. When it was
evaluated we just tell the outcome (allow/reject).

The details of each policy evaluation are returned as part of the
`AdmissionResponse.status.details.causes`.

Notes: the warning messages are always shown, regardless of the request
being accepted or rejected.
The `AdmissionResponse.status.details.causes` are shown only when the
request is rejected. `kubectl` shows them only when run with verbose
major or equal to 4 (`-v4`).

Policy Server always shows the `causes` inside of its logs when running
in `debug` mode.

The `causes` are always sent as part of the traces emitted by Policy
Server.

Signed-off-by: Flavio Castelli <[email protected]>
@flavio flavio force-pushed the group-policy-revisit-admission-response branch from 7324377 to 445a710 Compare September 20, 2024 07:04
@flavio
Copy link
Member Author

flavio commented Sep 20, 2024

everything should be green now, I'll merge the PR once everything passes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Pending review
Development

Successfully merging this pull request may close these issues.

2 participants