mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Rename dispatcher Run to Start to match naming conventions
This commit is contained in:
parent
0cb90973b0
commit
0dfbc85cd9
@ -49,8 +49,8 @@ type Source[H Hook] interface {
|
||||
// Dispatcher dispatches evaluates an admission request against the currently
|
||||
// active hooks returned by the source.
|
||||
type Dispatcher[H Hook] interface {
|
||||
// Run the dispatcher. This method should be called only once at startup.
|
||||
Run(ctx context.Context) error
|
||||
// Start the dispatcher. This method should be called only once at startup.
|
||||
Start(ctx context.Context) error
|
||||
|
||||
// Dispatch a request to the policies. Dispatcher may choose not to
|
||||
// call a hook, either because the rules of the hook does not match, or
|
||||
|
@ -186,7 +186,7 @@ func (c *Plugin[H]) ValidateInitialization() error {
|
||||
}
|
||||
}()
|
||||
|
||||
err := c.dispatcher.Run(pluginContext)
|
||||
err := c.dispatcher.Start(pluginContext)
|
||||
if err != nil && !errors.Is(err, context.Canceled) {
|
||||
utilruntime.HandleError(fmt.Errorf("policy dispatcher context unexpectedly closed: %w", err))
|
||||
}
|
||||
|
@ -95,12 +95,12 @@ func NewPolicyDispatcher[P runtime.Object, B runtime.Object, E Evaluator](
|
||||
}
|
||||
}
|
||||
|
||||
// Dispatch implements generic.Dispatcher. It loops through all active hooks
|
||||
// Start implements generic.Dispatcher Start. It loops through all active hooks
|
||||
// (policy x binding pairs) and selects those which are active for the current
|
||||
// request. It then resolves all params and creates an Invocation for each
|
||||
// matching policy-binding-param tuple. The delegate is then called with the
|
||||
// list of tuples.
|
||||
func (d *policyDispatcher[P, B, E]) Run(ctx context.Context) error {
|
||||
func (d *policyDispatcher[P, B, E]) Start(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"k8s.io/api/admissionregistration/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
@ -38,7 +39,7 @@ type fakeDispatcher struct{}
|
||||
func (fd *fakeDispatcher) Dispatch(context.Context, admission.Attributes, admission.ObjectInterfaces, []generic.PolicyHook[*FakePolicy, *FakeBinding, generic.Evaluator]) error {
|
||||
return nil
|
||||
}
|
||||
func (fd *fakeDispatcher) Run(context.Context) error {
|
||||
func (fd *fakeDispatcher) Start(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -63,9 +63,9 @@ type dispatcher struct {
|
||||
generic.Dispatcher[PolicyHook]
|
||||
}
|
||||
|
||||
func (d *dispatcher) Run(ctx context.Context) error {
|
||||
func (d *dispatcher) Start(ctx context.Context) error {
|
||||
go d.typeConverterManager.Run(ctx)
|
||||
return d.Dispatcher.Run(ctx)
|
||||
return d.Dispatcher.Start(ctx)
|
||||
}
|
||||
|
||||
func (d *dispatcher) dispatchInvocations(
|
||||
|
@ -64,7 +64,7 @@ type policyDecisionWithMetadata struct {
|
||||
Binding *admissionregistrationv1.ValidatingAdmissionPolicyBinding
|
||||
}
|
||||
|
||||
func (c *dispatcher) Run(ctx context.Context) error {
|
||||
func (c *dispatcher) Start(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user