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

Feature Request: allow operators to provide custom rejection message #879

Open
viccuad opened this issue Sep 11, 2024 · 0 comments
Open

Comments

@viccuad
Copy link
Member

viccuad commented Sep 11, 2024

Cluster operators may want to provide a more specific rejection message than
those provided by the policy author.

The rejection message from the cluster operator should have more priority than
the ones from the policy author, as some policies may need recompilation for
their messages to change.

Acceptance criteria

  • Add a new spec.message to (Cluster)AdmissionPolicies, optional, that expects a string.
    If provided, this new field will specify the message used when the policy
    performs a rejection. This substitutes the original rejection message provided
    by the policy (usually hardcoded). The original rejection message will be
    available as part of the Warnings inside of the AdmissionResponse object.

Considerations

Both Rego and CEL already support custom rejection messages via deny[msg] { msg }
(example),
and validations[ {expression, messageExpression}]
(example). Yet Rego policies need recompilation.
Both of these messages will be part of the Warnings if the new spec.message is used.

PolicyGroups already have spec.message, and the per-member messages already are part of the Warnings.

For PolicyReports no changes are needed. The error message will end in the
PolicyReportResult spec.Description, as usual rejection messages do. We need to
schedule work to include the messages in Warnings into PolicyReportResults
nevertheless.

In the future, we could add a new spec.messageExpression, optional, that expects a CEL expression.

@viccuad viccuad added this to the 1.17 milestone Sep 11, 2024
@flavio flavio modified the milestones: 1.17, 1.18 Sep 20, 2024
@flavio flavio modified the milestones: 1.18, 1.19 Oct 22, 2024
@flavio flavio removed this from the 1.19 milestone Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants