edited by liggitt

The admission plugin implementation uses an static scheme (set by .SetScheme method of the Plugin). While this works for standard types, it does not work for CRDs and resulted in bugs such as #73752. This change remove the static schema, and added an ObjectInterfaces which implemented by RequestScope and passed to .Admit and .Validate calls.

This comment has been minimized.

One nit on the helper filename, and the comment about not making patcher use the admission interface to collect object methods (leaving as is or declaring its own interface would be ok… I'd probably leave as is for this PR)

This comment has been minimized.

@mbohlool@liggitt adding this as a parameter to all admission controller would widely change all the admissions' interface. how about injecting a dynamic scheme getter func from the initializers instead a fixed scheme? sth like func GetScheme(gvk), if the gvk's not registered in the legacy scheme(which is, the requesting resource is not standard), it returns the extension scheme.

This comment has been minimized.

how about injecting a dynamic scheme getter func from the initializers instead a fixed scheme? sth like func GetScheme(gvk), if the gvk's not registered in the legacy scheme(which is, the requesting resource is not standard), it returns the extension scheme.

That seems more complex and error-prone. The choice is not between the legacy scheme and the extensions scheme, but between the legacy scheme and a per-resource converter/typer/defaulter for each custom resource. The object interfaces for the object being handled are in the rest handler, and fit much more naturally as a parameter to admit/validate.

Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.