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

Provide access to the admission.Request in validating & defaulting webhooks #1949

Closed
sbueringer opened this issue Jul 5, 2022 · 2 comments · Fixed by #1950
Closed

Provide access to the admission.Request in validating & defaulting webhooks #1949

sbueringer opened this issue Jul 5, 2022 · 2 comments · Fixed by #1950

Comments

@sbueringer
Copy link
Member

sbueringer commented Jul 5, 2022

As a developer writing defaulting and validating webhooks I would like to have access to the admission.Request without having to write an entire admission.Handler.

Our specific use case in Cluster API is that we want to validate an object on update depending on if the admission request is a dryrun.

Other use cases:

  • Leverage request.UserInfo to block requests

Possible solution:

  • Expose admission.Request in the context.Context passed into the Default/Validate funcs in the CustomDefaulter/CustomValidator (and a corresponding util func to read it from there)
    • Idea is to avoid changing the Validator/CustomValidator Defaulter/CustomValidator again / introducing new ones
@vincepri
Copy link
Member

vincepri commented Jul 5, 2022

+1 to pass and adding utilities for the context in CustomDefaulter/Validator to access this information

@sbueringer
Copy link
Member Author

Potential implementation in #1950

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 a pull request may close this issue.

2 participants