Documentation ¶
Index ¶
- Variables
- func AvailablePlugins(config Config) ([]string, error)
- func Serve(service Service)
- type ActionRegistrar
- type Broker
- type Capabilities
- type Client
- type ClientFactory
- type Config
- type DefaultClientFactory
- type DefaultRunner
- type DefaultStore
- func (s *DefaultStore) ClientNames() []string
- func (s *DefaultStore) Clients() map[string]Client
- func (s *DefaultStore) GetCommand(name string) (string, error)
- func (s *DefaultStore) GetMetadata(name string) (*Metadata, error)
- func (s *DefaultStore) GetService(name string) (Service, error)
- func (s *DefaultStore) Store(name string, client Client, metadata *Metadata, cmd string) error
- type GRPCClient
- func (c *GRPCClient) Content(ctx context.Context, contentPath string) (component.ContentResponse, error)
- func (c *GRPCClient) HandleAction(ctx context.Context, actionName string, payload action.Payload) error
- func (c *GRPCClient) Navigation(ctx context.Context) (navigation.Navigation, error)
- func (c *GRPCClient) ObjectStatus(ctx context.Context, object runtime.Object) (ObjectStatusResponse, error)
- func (c *GRPCClient) Print(ctx context.Context, object runtime.Object) (PrintResponse, error)
- func (c *GRPCClient) PrintTab(ctx context.Context, object runtime.Object) (TabResponse, error)
- func (c *GRPCClient) Register(ctx context.Context, dashboardAPIAddress string) (Metadata, error)
- type GRPCServer
- func (s *GRPCServer) Content(ctx context.Context, req *dashboard.ContentRequest) (*dashboard.ContentResponse, error)
- func (s *GRPCServer) HandleAction(ctx context.Context, handleActionRequest *dashboard.HandleActionRequest) (*dashboard.HandleActionResponse, error)
- func (s *GRPCServer) Navigation(ctx context.Context, req *dashboard.NavigationRequest) (*dashboard.NavigationResponse, error)
- func (s *GRPCServer) ObjectStatus(ctx context.Context, objectRequest *dashboard.ObjectRequest) (*dashboard.ObjectStatusResponse, error)
- func (s *GRPCServer) Print(ctx context.Context, objectRequest *dashboard.ObjectRequest) (*dashboard.PrintResponse, error)
- func (s *GRPCServer) PrintTab(ctx context.Context, objectRequest *dashboard.ObjectRequest) (*dashboard.PrintTabResponse, error)
- func (s *GRPCServer) Register(ctx context.Context, registerRequest *dashboard.RegisterRequest) (*dashboard.RegisterResponse, error)
- func (s *GRPCServer) WatchAdd(context.Context, *dashboard.WatchRequest) (*dashboard.Empty, error)
- func (s *GRPCServer) WatchDelete(context.Context, *dashboard.WatchRequest) (*dashboard.Empty, error)
- func (s *GRPCServer) WatchUpdate(context.Context, *dashboard.WatchRequest) (*dashboard.Empty, error)
- type Manager
- func (m *Manager) Load(cmd string) error
- func (m *Manager) ObjectStatus(ctx context.Context, object runtime.Object) (*ObjectStatusResponse, error)
- func (m *Manager) Print(ctx context.Context, object runtime.Object) (*PrintResponse, error)
- func (m *Manager) SetStore(store ManagerStore)
- func (m *Manager) Start(ctx context.Context) error
- func (m *Manager) Stop(ctx context.Context)
- func (m *Manager) Store() ManagerStore
- func (m *Manager) Tabs(ctx context.Context, object runtime.Object) ([]component.Tab, error)
- type ManagerInterface
- type ManagerOption
- type ManagerStore
- type Metadata
- type ModuleProxy
- func (ModuleProxy) AddCRD(ctx context.Context, crd *unstructured.Unstructured) error
- func (m *ModuleProxy) ClientRequestHandlers() []octant.ClientRequestHandler
- func (m *ModuleProxy) Content(ctx context.Context, contentPath string, opts module.ContentOptions) (component.ContentResponse, error)
- func (m *ModuleProxy) ContentPath() string
- func (ModuleProxy) Generators() []octant.Generator
- func (ModuleProxy) GroupVersionKindPath(namespace, apiVersion, kind, name string) (string, error)
- func (m *ModuleProxy) Name() string
- func (m *ModuleProxy) Navigation(ctx context.Context, namespace, root string) ([]navigation.Navigation, error)
- func (ModuleProxy) RemoveCRD(ctx context.Context, crd *unstructured.Unstructured) error
- func (ModuleProxy) ResetCRDs(ctx context.Context) error
- func (ModuleProxy) SetContext(ctx context.Context, contextName string) error
- func (ModuleProxy) SetNamespace(namespace string) error
- func (ModuleProxy) Start() error
- func (ModuleProxy) Stop()
- func (ModuleProxy) SupportedGroupVersionKind() []schema.GroupVersionKind
- type ModuleRegistrar
- type ModuleService
- type ObjectStatusResponse
- type PrintResponse
- type Runners
- type Service
- type ServicePlugin
- type TabResponse
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultConfig is the default plugin manager configuration. DefaultConfig = &defaultConfig{os: runtime.GOOS} )
var ( // Handshake is the handshake configuration for plugins. Will // be used the dashboard and the plugin. Handshake = plugin.HandshakeConfig{ ProtocolVersion: 1, MagicCookieKey: "DASHBOARD_PLUGIN", MagicCookieValue: "dashboard", } )
var (
// PluginName is the name of the dashboard plugin.
Name = "plugin"
)
Functions ¶
func AvailablePlugins ¶
AvailablePlugins returns a list of available plugins.
Types ¶
type ActionRegistrar ¶
type ActionRegistrar interface { // Register registers an action. Register(actionPath string, actionFunc action.DispatcherFunc) error }
ActionRegistrar is an action registrar.
type Broker ¶
type Broker interface { NextId() uint32 AcceptAndServe(id uint32, s func([]grpc.ServerOption) *grpc.Server) }
Broker is a Plugin Broker.
type Capabilities ¶
type Capabilities struct { // SupportsPrinterConfig are the GVKs the plugin will print configuration for. SupportsPrinterConfig []schema.GroupVersionKind `json:",omitempty"` // SupportsPrinterStatus are the GVKs the plugin will print status for. SupportsPrinterStatus []schema.GroupVersionKind `json:",omitempty"` // SupportsPrinterItems are the GVKs the plugin will print additional items for. SupportsPrinterItems []schema.GroupVersionKind `json:",omitempty"` // SupportsObjectStatus are the GVKs the plugin will generate object status for. SupportsObjectStatus []schema.GroupVersionKind `json:",omitempty"` // SupportsTab are the GVKs the plugin will create an additional tab for. SupportsTab []schema.GroupVersionKind `json:",omitempty"` // IsModule is true this plugin is a module. IsModule bool `json:",omitempty"` // ActionNames is a list of action names this plugin handles ActionNames []string `json:",omitempty"` }
Capabilities are plugin capabilities.
func (Capabilities) HasPrinterSupport ¶
func (c Capabilities) HasPrinterSupport(gvk schema.GroupVersionKind) bool
HasPrinterSupport returns true if this plugin supports the supplied GVK.
func (Capabilities) HasTabSupport ¶
func (c Capabilities) HasTabSupport(gvk schema.GroupVersionKind) bool
HasTabSupport returns true if this plugins supports creating a tab for the supplied GVK.
type Client ¶
type Client interface { Client() (plugin.ClientProtocol, error) Kill() }
Client is an interface that describes a plugin client.
type ClientFactory ¶
type ClientFactory interface { // Init initializes a client. Init(ctx context.Context, cmd string) Client }
ClientFactory is a factory for creating clients.
type Config ¶
type Config interface { // PluginDirs returns the location of the plugin directories. PluginDirs(string) ([]string, error) // Home returns the user's home directory. Home() string // Fs is the afero filesystem Fs() afero.Fs // OS is the opertating system OS() string }
Config is configuration for the plugin manager.
type DefaultClientFactory ¶
type DefaultClientFactory struct{}
DefaultClientFactory is the default client factory
func NewDefaultClientFactory ¶
func NewDefaultClientFactory() *DefaultClientFactory
NewDefaultClientFactory creates an instance of DefaultClientFactory.
type DefaultRunner ¶
type DefaultRunner struct {
RunFunc func(ctx context.Context, name string, gvk schema.GroupVersionKind, object runtime.Object) error
}
DefaultRunner runs a function against all plugins
func ObjectStatusRunner ¶
func ObjectStatusRunner(store ManagerStore, ch chan<- ObjectStatusResponse) DefaultRunner
ObjectStatusRunner is a runner for object status.
func PrintRunner ¶
func PrintRunner(store ManagerStore, ch chan<- PrintResponse) DefaultRunner
PrintRunner is a runner for printing.
func TabRunner ¶
func TabRunner(store ManagerStore, ch chan<- component.Tab) DefaultRunner
TabRunner is a runner for tabs.
type DefaultStore ¶
type DefaultStore struct {
// contains filtered or unexported fields
}
DefaultStore is the default implement of ManagerStore.
func NewDefaultStore ¶
func NewDefaultStore() *DefaultStore
NewDefaultStore creates an instance of DefaultStore.
func (*DefaultStore) ClientNames ¶
func (s *DefaultStore) ClientNames() []string
ClientNames returns the client names in the store.
func (*DefaultStore) Clients ¶
func (s *DefaultStore) Clients() map[string]Client
Clients returns all the clients in the store.
func (*DefaultStore) GetCommand ¶
func (s *DefaultStore) GetCommand(name string) (string, error)
GetCommand gets the command for a plugin.
func (*DefaultStore) GetMetadata ¶
func (s *DefaultStore) GetMetadata(name string) (*Metadata, error)
GetMetadata gets the metadata for a plugin.
func (*DefaultStore) GetService ¶
func (s *DefaultStore) GetService(name string) (Service, error)
GetService gets the service for a plugin.
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
GRPCClient is the dashboard GRPC client.
func NewGRPCClient ¶
func NewGRPCClient(broker Broker, client dashboard.PluginClient) *GRPCClient
NewGRPCClient creates an instance of GRPCClient.
func (*GRPCClient) Content ¶
func (c *GRPCClient) Content(ctx context.Context, contentPath string) (component.ContentResponse, error)
Content returns content from a plugin.
func (*GRPCClient) HandleAction ¶
func (c *GRPCClient) HandleAction(ctx context.Context, actionName string, payload action.Payload) error
HandleAction runs an action on a plugin.
func (*GRPCClient) Navigation ¶
func (c *GRPCClient) Navigation(ctx context.Context) (navigation.Navigation, error)
Navigation returns navigation entries from a plugin.
func (*GRPCClient) ObjectStatus ¶
func (c *GRPCClient) ObjectStatus(ctx context.Context, object runtime.Object) (ObjectStatusResponse, error)
ObjectStatus gets an object status
func (*GRPCClient) Print ¶
func (c *GRPCClient) Print(ctx context.Context, object runtime.Object) (PrintResponse, error)
Print prints an object.
func (*GRPCClient) PrintTab ¶
func (c *GRPCClient) PrintTab(ctx context.Context, object runtime.Object) (TabResponse, error)
PrintTab creates a tab for an object.
type GRPCServer ¶
type GRPCServer struct { Impl Service // contains filtered or unexported fields }
GRPCServer is the grpc server the dashboard will use to communicate with the the plugin.
func (*GRPCServer) Content ¶
func (s *GRPCServer) Content(ctx context.Context, req *dashboard.ContentRequest) (*dashboard.ContentResponse, error)
Content returns content from a plugin.
func (*GRPCServer) HandleAction ¶
func (s *GRPCServer) HandleAction(ctx context.Context, handleActionRequest *dashboard.HandleActionRequest) (*dashboard.HandleActionResponse, error)
HandleAction runs an action in a plugin.
func (*GRPCServer) Navigation ¶
func (s *GRPCServer) Navigation(ctx context.Context, req *dashboard.NavigationRequest) (*dashboard.NavigationResponse, error)
Navigation returns navigation entries from a plugin.
func (*GRPCServer) ObjectStatus ¶
func (s *GRPCServer) ObjectStatus(ctx context.Context, objectRequest *dashboard.ObjectRequest) (*dashboard.ObjectStatusResponse, error)
ObjectStatus generates status for an object.
func (*GRPCServer) Print ¶
func (s *GRPCServer) Print(ctx context.Context, objectRequest *dashboard.ObjectRequest) (*dashboard.PrintResponse, error)
Print prints an object.
func (*GRPCServer) PrintTab ¶
func (s *GRPCServer) PrintTab(ctx context.Context, objectRequest *dashboard.ObjectRequest) (*dashboard.PrintTabResponse, error)
PrintTab prints a tab for an object.
func (*GRPCServer) Register ¶
func (s *GRPCServer) Register(ctx context.Context, registerRequest *dashboard.RegisterRequest) (*dashboard.RegisterResponse, error)
Register register a plugin.
func (*GRPCServer) WatchAdd ¶
func (s *GRPCServer) WatchAdd(context.Context, *dashboard.WatchRequest) (*dashboard.Empty, error)
WatchAdd is called when a watched GVK has a new object added.
func (*GRPCServer) WatchDelete ¶
func (s *GRPCServer) WatchDelete(context.Context, *dashboard.WatchRequest) (*dashboard.Empty, error)
WatchDelete is called when a watched GVK has an object deleted.
func (*GRPCServer) WatchUpdate ¶
func (s *GRPCServer) WatchUpdate(context.Context, *dashboard.WatchRequest) (*dashboard.Empty, error)
WatchUpdate is called when a watched GVK has an object updated.
type Manager ¶
type Manager struct { PortForwarder portforward.PortForwarder API api.API ClientFactory ClientFactory ModuleRegistrar ModuleRegistrar ActionRegistrar ActionRegistrar Runners Runners // contains filtered or unexported fields }
Manager manages plugins
func NewManager ¶
func NewManager(apiService api.API, moduleRegistrar ModuleRegistrar, actionRegistrar ActionRegistrar, options ...ManagerOption) *Manager
NewManager creates an instance of Manager.
func (*Manager) ObjectStatus ¶
func (m *Manager) ObjectStatus(ctx context.Context, object runtime.Object) (*ObjectStatusResponse, error)
ObjectStatus updates the object status of an object configured from a plugin
func (*Manager) Print ¶
Print prints an object with plugins which are configured to print the objects's GVK.
func (*Manager) SetStore ¶
func (m *Manager) SetStore(store ManagerStore)
SetStore sets the store for the manager.
func (*Manager) Store ¶
func (m *Manager) Store() ManagerStore
Store returns the store for the manager.
type ManagerInterface ¶
type ManagerInterface interface { // Print prints an object. Print(ctx context.Context, object runtime.Object) (*PrintResponse, error) // Tabs retrieves tabs for an object. Tabs(ctx context.Context, object runtime.Object) ([]component.Tab, error) // Store returns the manager's storage. Store() ManagerStore // ObjectStatus returns the object status ObjectStatus(ctx context.Context, object runtime.Object) (*ObjectStatusResponse, error) }
ManagerInterface is an interface which represent a plugin manager.
type ManagerOption ¶
type ManagerOption func(*Manager)
ManagerOption is an option for configuring Manager.
type ManagerStore ¶
type ManagerStore interface { Store(name string, client Client, metadata *Metadata, cmd string) error GetMetadata(name string) (*Metadata, error) GetService(name string) (Service, error) GetCommand(name string) (string, error) Clients() map[string]Client ClientNames() []string }
ManagerStore is the data store for Manager.
type Metadata ¶
type Metadata struct { Name string Description string Capabilities Capabilities }
Metadata is plugin metadata.
type ModuleProxy ¶
type ModuleProxy struct { Metadata *Metadata PluginName string Service ModuleService }
ModuleProxy is a proxy that satisfies Octant module requirements. It allows plugins to behave as if they are internal modules.
func NewModuleProxy ¶
func NewModuleProxy(pluginName string, metadata *Metadata, service ModuleService) (*ModuleProxy, error)
NewModuleProxy creates a ModuleProxy instance.
func (ModuleProxy) AddCRD ¶
func (ModuleProxy) AddCRD(ctx context.Context, crd *unstructured.Unstructured) error
AddCRD is a no-op
func (*ModuleProxy) ClientRequestHandlers ¶
func (m *ModuleProxy) ClientRequestHandlers() []octant.ClientRequestHandler
func (*ModuleProxy) Content ¶
func (m *ModuleProxy) Content(ctx context.Context, contentPath string, opts module.ContentOptions) (component.ContentResponse, error)
Content returns content from the plugin. Plugins are expected to handle paths appropriately.
func (*ModuleProxy) ContentPath ¶
func (m *ModuleProxy) ContentPath() string
func (ModuleProxy) Generators ¶
func (ModuleProxy) Generators() []octant.Generator
Generators is a no-op
func (ModuleProxy) GroupVersionKindPath ¶
func (ModuleProxy) GroupVersionKindPath(namespace, apiVersion, kind, name string) (string, error)
GroupVersionKindPath is currently a no-op. In the future this will allow plugins to handle paths for GVKs.
func (*ModuleProxy) Name ¶
func (m *ModuleProxy) Name() string
Name returns the module's name. It is the same as the plugin's metadata name.
func (*ModuleProxy) Navigation ¶
func (m *ModuleProxy) Navigation(ctx context.Context, namespace, root string) ([]navigation.Navigation, error)
Navigation returns navigation from the plugin.
func (ModuleProxy) RemoveCRD ¶
func (ModuleProxy) RemoveCRD(ctx context.Context, crd *unstructured.Unstructured) error
RemoveCRD is a no-op
func (ModuleProxy) ResetCRDs ¶
func (ModuleProxy) ResetCRDs(ctx context.Context) error
ResetCRDs is a no-op
func (ModuleProxy) SetContext ¶
func (ModuleProxy) SetContext(ctx context.Context, contextName string) error
SetContext is a no-op
func (ModuleProxy) SetNamespace ¶
func (ModuleProxy) SetNamespace(namespace string) error
SetNamespace is a no-op
func (ModuleProxy) SupportedGroupVersionKind ¶
func (ModuleProxy) SupportedGroupVersionKind() []schema.GroupVersionKind
SupportedGroupVersionKind is currently a no-op. In the future this will allow plugins to handle paths for GVKs.
type ModuleRegistrar ¶
type ModuleRegistrar interface { // Register registers a module. Register(mod module.Module) error }
ModuleRegistrar is a module registrar.
type ModuleService ¶
type ModuleService interface { Service Content(ctx context.Context, contentPath string) (component.ContentResponse, error) }
ModuleService is the interface that is exposed as a plugin as a module. The plugin is required to implement this interface.
type ObjectStatusResponse ¶
type ObjectStatusResponse struct { // ObjectStatus is status of an object. ObjectStatus component.PodSummary }
ObjectStatusResponse is an object status response from plugin.
type PrintResponse ¶
type PrintResponse struct { // Config is additional summary sections for configuration. Config []component.SummarySection // Status is additional summary sections for status. Status []component.SummarySection // Items are additional view components. Items []component.FlexLayoutItem }
PrintResponse is a printer response from the plugin. The dashboard will use this to the add the plugin's output to a summary view.
type Runners ¶
type Runners interface { // Print returns a runner for printing. The caller should close // the channel when they are done with it. Print(ManagerStore) (DefaultRunner, chan PrintResponse) // Tab returns a runner for tabs. The caller should close // the channel when they are done with it. Tab(ManagerStore) (DefaultRunner, chan component.Tab) // ObjectStatus returns a runner for object status. The caller should // close the channel when they are done with it. ObjectStatus(ManagerStore) (DefaultRunner, chan ObjectStatusResponse) }
Runners is an interface that manager can call to get runners for a particular action.
type Service ¶
type Service interface { Register(ctx context.Context, dashboardAPIAddress string) (Metadata, error) Print(ctx context.Context, object runtime.Object) (PrintResponse, error) PrintTab(ctx context.Context, object runtime.Object) (TabResponse, error) ObjectStatus(ctx context.Context, object runtime.Object) (ObjectStatusResponse, error) HandleAction(ctx context.Context, actionName string, payload action.Payload) error }
Service is the interface that is exposed as a plugin. The plugin is required to implement this interface.
type ServicePlugin ¶
type ServicePlugin struct { plugin.NetRPCUnsupportedPlugin Impl Service }
ServicePlugin is the GRPC plugin for Service.
func (*ServicePlugin) GRPCClient ¶
func (p *ServicePlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
GRPCClient is the plugin's GRPC client.
func (*ServicePlugin) GRPCServer ¶
func (p *ServicePlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
GRPCServer is the plugin's GRPC server.
type TabResponse ¶
TabResponse is a tab printer response from the plugin. The dashboard will use this to create an additional tab for an object.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
fake
Package fake is a generated GoMock package.
|
Package fake is a generated GoMock package. |
Package fake is a generated GoMock package.
|
Package fake is a generated GoMock package. |
fake
Package fake is a generated GoMock package.
|
Package fake is a generated GoMock package. |