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: Generic admission webhook #2644

Closed
lbernick opened this issue Nov 22, 2022 · 8 comments
Closed

Feature: Generic admission webhook #2644

lbernick opened this issue Nov 22, 2022 · 8 comments
Labels
area/API kind/feature lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@lbernick
Copy link

/area API
/kind feature

We use the defaulting and validating admission webhook helpers downstream in Tekton and they are super useful. It would be nice to have a function for a generic admission webhook that takes care of certificates and reconciliation, but exposes the function func (ac *reconciler) Admit(ctx context.Context, request *admissionv1.AdmissionRequest) (resp *admissionv1.AdmissionResponse).

I'm trying to patch a CRD on creation, and have currently implemented this as a callback passed to defaulting.NewAdmissionController, but I realized the CRD namespace is not necessarily available in the unstructured object created from AdmissionRequest.Object and AdmissionRequest.OldObject, so I'm hoping to get this info from AdmissionRequest.Namespace.

I also want to avoid calling SetDefaults.

If this feature is of interest I can give implementing it a try.

@github-actions
Copy link
Contributor

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 21, 2023
@dprotaso
Copy link
Member

Related: #2656

I think having access the the AdmissionRequest on the context would help

@github-actions github-actions bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 23, 2023
@github-actions
Copy link
Contributor

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 25, 2023
@lbernick
Copy link
Author

/remove-lifecycle stale

@knative-prow knative-prow bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 25, 2023
@github-actions
Copy link
Contributor

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 24, 2023
@lbernick
Copy link
Author

/remove-lifecycle stale

Another use case for this is to capture UserInfo for the identity that submitted the AdmissionRequest, as described in tektoncd/pipeline#7068

@knative-prow knative-prow bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 25, 2023
@wlynch
Copy link
Contributor

wlynch commented Aug 31, 2023

@lbernick UserInfo should be available via apis.GetUserInfo! 😎

Copy link
Contributor

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/API kind/feature lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

3 participants