kubernetes: k8s.io/kubernetes/pkg/kubelet/pluginmanager/operationexecutor Index | Files

package operationexecutor

import "k8s.io/kubernetes/pkg/kubelet/pluginmanager/operationexecutor"

Package operationexecutor implements interfaces that enable execution of register and unregister operations with a goroutinemap so that more than one operation is never triggered on the same plugin.

Package operationexecutor implements interfaces that enable execution of register and unregister operations with a goroutinemap so that more than one operation is never triggered on the same plugin.

Index

Package Files

operation_executor.go operation_generator.go

type ActualStateOfWorldUpdater Uses

type ActualStateOfWorldUpdater interface {
    // AddPlugin add the given plugin in the cache if no existing plugin
    // in the cache has the same socket path.
    // An error will be returned if socketPath is empty.
    AddPlugin(pluginInfo cache.PluginInfo) error

    // RemovePlugin deletes the plugin with the given socket path from the actual
    // state of world.
    // If a plugin does not exist with the given socket path, this is a no-op.
    RemovePlugin(socketPath string)
}

ActualStateOfWorldUpdater defines a set of operations updating the actual state of the world cache after successful registration/deregistration.

type OperationExecutor Uses

type OperationExecutor interface {
    // RegisterPlugin registers the given plugin using the a handler in the plugin handler map.
    // It then updates the actual state of the world to reflect that.
    RegisterPlugin(socketPath string, timestamp time.Time, pluginHandlers map[string]cache.PluginHandler, actualStateOfWorld ActualStateOfWorldUpdater) error

    // UnregisterPlugin deregisters the given plugin using a handler in the given plugin handler map.
    // It then updates the actual state of the world to reflect that.
    UnregisterPlugin(socketPath string, pluginHandlers map[string]cache.PluginHandler, actualStateOfWorld ActualStateOfWorldUpdater) error
}

OperationExecutor defines a set of operations for registering and unregistering a plugin that are executed with a NewGoRoutineMap which prevents more than one operation from being triggered on the same socket path.

These operations should be idempotent (for example, RegisterPlugin should still succeed if the plugin is already registered, etc.). However, they depend on the plugin handlers (for each plugin type) to implement this behavior.

Once an operation completes successfully, the actualStateOfWorld is updated to indicate the plugin is registered/unregistered.

Once the operation is started, since it is executed asynchronously, errors are simply logged and the goroutine is terminated without updating actualStateOfWorld.

func NewOperationExecutor Uses

func NewOperationExecutor(
    operationGenerator OperationGenerator) OperationExecutor

NewOperationExecutor returns a new instance of OperationExecutor.

type OperationGenerator Uses

type OperationGenerator interface {
    // Generates the RegisterPlugin function needed to perform the registration of a plugin
    GenerateRegisterPluginFunc(
        socketPath string,
        timestamp time.Time,
        pluginHandlers map[string]cache.PluginHandler,
        actualStateOfWorldUpdater ActualStateOfWorldUpdater) func() error

    // Generates the UnregisterPlugin function needed to perform the unregistration of a plugin
    GenerateUnregisterPluginFunc(
        socketPath string,
        pluginHandlers map[string]cache.PluginHandler,
        actualStateOfWorldUpdater ActualStateOfWorldUpdater) func() error
}

OperationGenerator interface that extracts out the functions from operation_executor to make it dependency injectable

func NewOperationGenerator Uses

func NewOperationGenerator(recorder record.EventRecorder) OperationGenerator

NewOperationGenerator is returns instance of operationGenerator

Package operationexecutor imports 11 packages (graph) and is imported by 2 packages. Updated 2019-11-15. Refresh now. Tools for package owners.