type Factory … type Plugins … func NewPlugins() *Plugins { … } var PluginEnabledFn … type PluginEnabledFunc … // Registered enumerates the names of all registered plugins. func (ps *Plugins) Registered() []string { … } // Register registers a plugin Factory by name. This // is expected to happen during app startup. func (ps *Plugins) Register(name string, plugin Factory) { … } // getPlugin creates an instance of the named plugin. It returns `false` if // the name is not known. The error is returned only when the named provider was // known but failed to initialize. The config parameter specifies the io.Reader // handler of the configuration file for the cloud provider, or nil for no configuration. func (ps *Plugins) getPlugin(name string, config io.Reader) (Interface, bool, error) { … } // splitStream reads the stream bytes and constructs two copies of it. func splitStream(config io.Reader) (io.Reader, io.Reader, error) { … } // NewFromPlugins returns an admission.Interface that will enforce admission control decisions of all // the given plugins. func (ps *Plugins) NewFromPlugins(pluginNames []string, configProvider ConfigProvider, pluginInitializer PluginInitializer, decorator Decorator) (Interface, error) { … } // InitPlugin creates an instance of the named interface. func (ps *Plugins) InitPlugin(name string, config io.Reader, pluginInitializer PluginInitializer) (Interface, error) { … } // ValidateInitialization will call the InitializationValidate function in each plugin if they implement // the InitializationValidator interface. func ValidateInitialization(plugin Interface) error { … } type PluginInitializers … func (pp PluginInitializers) Initialize(plugin Interface) { … }