Plugins: Support Admission validation hooks (#87718)
This commit is contained in:
@@ -70,6 +70,9 @@ type FakePluginClient struct {
|
||||
backend.CheckHealthHandlerFunc
|
||||
backend.QueryDataHandlerFunc
|
||||
backend.CallResourceHandlerFunc
|
||||
backend.MutateAdmissionFunc
|
||||
backend.ValidateAdmissionFunc
|
||||
backend.ConvertObjectFunc
|
||||
mutex sync.RWMutex
|
||||
|
||||
backendplugin.Plugin
|
||||
@@ -166,6 +169,30 @@ func (pc *FakePluginClient) RunStream(_ context.Context, _ *backend.RunStreamReq
|
||||
return plugins.ErrMethodNotImplemented
|
||||
}
|
||||
|
||||
func (pc *FakePluginClient) ValidateAdmission(ctx context.Context, req *backend.AdmissionRequest) (*backend.ValidationResponse, error) {
|
||||
if pc.ValidateAdmissionFunc != nil {
|
||||
return pc.ValidateAdmissionFunc(ctx, req)
|
||||
}
|
||||
|
||||
return nil, plugins.ErrMethodNotImplemented
|
||||
}
|
||||
|
||||
func (pc *FakePluginClient) MutateAdmission(ctx context.Context, req *backend.AdmissionRequest) (*backend.MutationResponse, error) {
|
||||
if pc.MutateAdmissionFunc != nil {
|
||||
return pc.MutateAdmissionFunc(ctx, req)
|
||||
}
|
||||
|
||||
return nil, plugins.ErrMethodNotImplemented
|
||||
}
|
||||
|
||||
func (pc *FakePluginClient) ConvertObject(ctx context.Context, req *backend.ConversionRequest) (*backend.ConversionResponse, error) {
|
||||
if pc.ConvertObjectFunc != nil {
|
||||
return pc.ConvertObjectFunc(ctx, req)
|
||||
}
|
||||
|
||||
return nil, plugins.ErrMethodNotImplemented
|
||||
}
|
||||
|
||||
type FakePluginRegistry struct {
|
||||
Store map[string]*plugins.Plugin
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user