Documentation ¶
Index ¶
- Constants
- func AcceptedHosts() []string
- func CreateContentEvent(contentResponse component.ContentResponse, namespace, contentPath string, ...) oevent.Event
- func CreateNamespacesEvent(namespaces []string) oevent.Event
- func CreateNavigationEvent(sections []navigation.Navigation, defaultPath string) oevent.Event
- func FilterFromPayload(in action.Payload) (octant.Filter, bool)
- func FiltersFromQueryParams(in interface{}) ([]octant.Filter, error)
- func FiltersToLabelSet(filters []octant.Filter) *labels.Set
- func GenerateBreadcrumb(cm *ContentManager, contentPath string, state octant.State, m module.Module, ...) []component.TitleComponent
- func IsWindowsContainer(pod *corev1.Pod) bool
- func Listener() (net.Listener, error)
- func NamespacesGenerator(ctx context.Context, config NamespaceManagerConfig) ([]string, error)
- func NavigationFromPath(navs []navigation.Navigation, navPath string) ([]navigation.Navigation, LinkDefinition, LinkDefinition)
- func NavigationGenerator(ctx context.Context, state octant.State, config NavigationManagerConfig) ([]navigation.Navigation, error)
- func NewPodLogsStateManager(dashConfig config.Dash) *podLogsStateManager
- func ParseFilterQueryParam(in string) (octant.Filter, error)
- func RespondWithError(w http.ResponseWriter, code int, message string, logger log.Logger)
- func ShouldAllowHost(host string, acceptedHosts []string) bool
- type API
- type ActionRequestManager
- type Content
- type ContentGenerateFunc
- type ContentManager
- func (cm *ContentManager) Handlers() []octant.ClientRequestHandler
- func (cm *ContentManager) Loaded(state octant.State, payload action.Payload) error
- func (cm *ContentManager) SetContentPath(state octant.State, payload action.Payload) error
- func (cm *ContentManager) SetNamespace(state octant.State, payload action.Payload) error
- func (cm *ContentManager) SetQueryParams(state octant.State, payload action.Payload) error
- func (cm *ContentManager) Start(ctx context.Context, state octant.State, s api.OctantClient)
- type ContentManagerOption
- type ContextGenerateFunc
- type ContextManager
- type ContextManagerOption
- type FilterManager
- func (fm *FilterManager) AddFilter(state octant.State, payload action.Payload) error
- func (fm *FilterManager) ClearFilters(state octant.State, payload action.Payload) error
- func (fm *FilterManager) Handlers() []octant.ClientRequestHandler
- func (fm *FilterManager) RemoveFilter(state octant.State, payload action.Payload) error
- func (fm *FilterManager) Start(ctx context.Context, state octant.State, s api.OctantClient)
- type HelperGenerateFunc
- type HelperStateManager
- type HelperStateManagerOption
- type InterruptiblePoller
- type LinkDefinition
- type LoadingAPI
- type LoadingManager
- func (l *LoadingManager) CheckLoading(state octant.State, payload action.Payload) error
- func (l *LoadingManager) Handlers() []octant.ClientRequestHandler
- func (l *LoadingManager) Start(ctx context.Context, state octant.State, client api.OctantClient)
- func (l *LoadingManager) UploadKubeConfig(state octant.State, payload action.Payload) error
- func (l *LoadingManager) WatchConfig(path chan string, client api.OctantClient, fs afero.Fs)
- type NamespaceManagerConfig
- type NamespacesGenerateFunc
- type NamespacesManager
- type NamespacesManagerOption
- type NavigationGeneratorFunc
- type NavigationManager
- type NavigationManagerConfig
- type NavigationManagerOption
- type NotFoundError
- type Poller
- type PollerFunc
- type Service
- type SingleRunPoller
- type StateManager
Constants ¶
const ( // ListenerAddrKey is the environment variable for the Octant listener address. ListenerAddrKey = "listener-addr" AcceptedHostsKey = "accepted-hosts" // PathPrefix is a string for the api path prefix. PathPrefix = "/api/v1" )
const ( RequestPodLogsSubscribe = "action.octant.dev/podLogs/subscribe" RequestPodLogsUnsubscribe = "action.octant.dev/podLogs/unsubscribe" DefaultSinceSeconds = 300 )
const ( RequestAddFilter = "action.octant.dev/addFilter" RequestClearFilters = "action.octant.dev/clearFilters" RequestRemoveFilter = "action.octant.dev/removeFilter" )
const ( UploadKubeConfig = "action.octant.dev/uploadKubeConfig" CheckLoading = "action.octant.dev/loading" )
const ( RequestTerminalCommand = "action.octant.dev/sendTerminalCommand" RequestTerminalResize = "action.octant.dev/sendTerminalResize" RequestActiveTerminal = "action.octant.dev/setActiveTerminal" )
const (
RequestPerformAction = "action.octant.dev/performAction"
)
const (
RequestSetContentPath = "action.octant.dev/setContentPath"
)
Variables ¶
This section is empty.
Functions ¶
func AcceptedHosts ¶ added in v0.22.0
func AcceptedHosts() []string
func CreateContentEvent ¶
func CreateContentEvent(contentResponse component.ContentResponse, namespace, contentPath string, queryParams map[string][]string) oevent.Event
CreateContentEvent creates a content event.
func CreateNamespacesEvent ¶
CreateNamespacesEvent creates a namespaces event.
func CreateNavigationEvent ¶
func CreateNavigationEvent(sections []navigation.Navigation, defaultPath string) oevent.Event
CreateNavigationEvent creates a navigation event.
func FilterFromPayload ¶
FilterFromPayload creates a filter from a payload. Returns false if the payload is invalid.
func FiltersFromQueryParams ¶
FiltersFromQueryParams converts query params to filters. Can handle one or multiple query params.
func FiltersToLabelSet ¶
FiltersToLabelSet converts a slice of filters to a label set.
func GenerateBreadcrumb ¶ added in v0.17.0
func GenerateBreadcrumb(cm *ContentManager, contentPath string, state octant.State, m module.Module, options module.ContentOptions) []component.TitleComponent
Generate breadcrumb for specified path
func IsWindowsContainer ¶ added in v0.18.0
func Listener ¶ added in v0.17.0
Listener returns the default listener if OCTANT_LISTENER_ADDR is not set.
func NamespacesGenerator ¶
func NamespacesGenerator(ctx context.Context, config NamespaceManagerConfig) ([]string, error)
NamespacesGenerator generates a list of namespaces.
func NavigationFromPath ¶ added in v0.17.0
func NavigationFromPath(navs []navigation.Navigation, navPath string) ([]navigation.Navigation, LinkDefinition, LinkDefinition)
Returns all navigation elements for specified path
func NavigationGenerator ¶
func NavigationGenerator(ctx context.Context, state octant.State, config NavigationManagerConfig) ([]navigation.Navigation, error)
NavigationGenerator generates a navigation tree given a set of modules and a namespace.
func NewPodLogsStateManager ¶ added in v0.12.0
NewPodLogsStateManager returns a terminal state manager.
func ParseFilterQueryParam ¶
ParseFilterQueryParam parsers a single filter from a query param in the format `key:value`.
func RespondWithError ¶
RespondWithError responds with an error message.
func ShouldAllowHost ¶ added in v0.22.0
shouldAllowHost returns true if the incoming request.Host should be allowed to access the API otherwise false.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the API for the dashboard client
func New ¶
func New(ctx context.Context, prefix string, actionDispatcher api.ActionDispatcher, streamingConnectionManager *api.StreamingConnectionManager, dashConfig config.Dash) *API
New creates an instance of API.
func (*API) ForceUpdate ¶
type ActionRequestManager ¶
type ActionRequestManager struct {
// contains filtered or unexported fields
}
ActionRequestManager manages action requests. Action requests allow a generic interface for supporting dynamic requests from clients.
func NewActionRequestManager ¶
func NewActionRequestManager(dashConfig config.Dash) *ActionRequestManager
NewActionRequestManager creates an instance of ActionRequestManager.
func (*ActionRequestManager) Handlers ¶
func (a *ActionRequestManager) Handlers() []octant.ClientRequestHandler
Handlers returns the handlers this manager supports.
func (*ActionRequestManager) PerformAction ¶
PerformAction is a handler than runs an action.
func (ActionRequestManager) Start ¶
func (a ActionRequestManager) Start(_ context.Context, _ octant.State, _ api.OctantClient)
type Content ¶ added in v0.11.0
type Content struct { // Response is a content response. Response component.ContentResponse // Path is the path of the content. Path string }
Content is a content to be sent to clients.
type ContentGenerateFunc ¶
ContentGenerateFunc is a function that generates content. It returns `rerun=true` if the action should be immediately rerun.
type ContentManager ¶
type ContentManager struct {
// contains filtered or unexported fields
}
ContentManager manages content for websockets.
func NewContentManager ¶
func NewContentManager(moduleManager module.ManagerInterface, dashConfig config.Dash, logger log.Logger, options ...ContentManagerOption) *ContentManager
NewContentManager creates an instance of ContentManager.
func (*ContentManager) Handlers ¶
func (cm *ContentManager) Handlers() []octant.ClientRequestHandler
Handlers returns a slice of client request handlers.
func (*ContentManager) SetContentPath ¶
SetContentPath sets the current content path.
func (*ContentManager) SetNamespace ¶
SetNamespace sets the current namespace.
func (*ContentManager) SetQueryParams ¶
SetQueryParams sets the current query params.
func (*ContentManager) Start ¶
func (cm *ContentManager) Start(ctx context.Context, state octant.State, s api.OctantClient)
Start starts the manager.
type ContentManagerOption ¶
type ContentManagerOption func(manager *ContentManager)
ContentManagerOption is an option for configuring ContentManager.
func WithContentGenerator ¶
func WithContentGenerator(fn ContentGenerateFunc) ContentManagerOption
WithContentGenerator configures the content generate function.
func WithContentGeneratorPoller ¶
func WithContentGeneratorPoller(poller Poller) ContentManagerOption
WithContentGeneratorPoller configures the poller.
type ContextGenerateFunc ¶
ContextGenerateFunc is a function which generates a context event.
type ContextManager ¶
type ContextManager struct {
// contains filtered or unexported fields
}
ContextManager manages context.
func NewContextManager ¶
func NewContextManager(dashConfig config.Dash, options ...ContextManagerOption) *ContextManager
NewContextManager creates an instances of ContextManager.
func (*ContextManager) Handlers ¶
func (c *ContextManager) Handlers() []octant.ClientRequestHandler
Handlers returns a slice of handlers.
func (*ContextManager) SetContext ¶
SetContext sets the current context.
func (*ContextManager) Start ¶
func (c *ContextManager) Start(ctx context.Context, state octant.State, s api.OctantClient)
Start starts the manager.
type ContextManagerOption ¶
type ContextManagerOption func(manager *ContextManager)
ContextManagerOption is an option for configuring ContextManager.
func WithContextGenerator ¶
func WithContextGenerator(fn ContextGenerateFunc) ContextManagerOption
WithContextGenerator sets the context generator.
func WithContextGeneratorPoll ¶
func WithContextGeneratorPoll(poller Poller) ContextManagerOption
WithContextGeneratorPoll generates the poller.
type FilterManager ¶
type FilterManager struct {
// contains filtered or unexported fields
}
FilterManager manages filters.
func NewFilterManager ¶
func NewFilterManager() *FilterManager
NewFilterManager creates an instance of FilterManager.
func (*FilterManager) ClearFilters ¶
ClearFilters clears all filters.
func (*FilterManager) Handlers ¶
func (fm *FilterManager) Handlers() []octant.ClientRequestHandler
Handlers returns a slice of handlers.
func (*FilterManager) RemoveFilter ¶
RemoveFilters removes a filter.
func (*FilterManager) Start ¶
func (fm *FilterManager) Start(ctx context.Context, state octant.State, s api.OctantClient)
Start starts the manager. Current is a no-op.
type HelperGenerateFunc ¶ added in v0.13.0
HelperGenerateFunc is a function which generates a helper event
type HelperStateManager ¶ added in v0.13.0
type HelperStateManager struct {
// contains filtered or unexported fields
}
HelperStateManager manages buildInfo
func NewHelperStateManager ¶ added in v0.13.0
func NewHelperStateManager(dashConfig config.Dash, options ...HelperStateManagerOption) *HelperStateManager
NewHelperStateManager creates an instance of HelperStateManager
func (*HelperStateManager) Handlers ¶ added in v0.13.0
func (h *HelperStateManager) Handlers() []octant.ClientRequestHandler
Handlers returns a slice of handlers
func (*HelperStateManager) Start ¶ added in v0.13.0
func (h *HelperStateManager) Start(ctx context.Context, state octant.State, client api.OctantClient)
Start starts the manager
type HelperStateManagerOption ¶ added in v0.13.0
type HelperStateManagerOption func(manager *HelperStateManager)
HelperStateManagerOption is an option for configuration HelperManager
func WithHelperGenerator ¶ added in v0.13.0
func WithHelperGenerator(fn HelperGenerateFunc) HelperStateManagerOption
WithHelperGenerator sets the helper generator
func WithHelperGeneratorPoll ¶ added in v0.13.0
func WithHelperGeneratorPoll(poller Poller) HelperStateManagerOption
WithHelperGeneratorPoll generates the poller
type InterruptiblePoller ¶
type InterruptiblePoller struct {
// contains filtered or unexported fields
}
InterruptiblePoller is a poller than runs an action and allows for interrupts.
func NewInterruptiblePoller ¶
func NewInterruptiblePoller(name string) *InterruptiblePoller
NewInterruptiblePoller creates an instance of InterruptiblePoller.
func (*InterruptiblePoller) Run ¶
func (a *InterruptiblePoller) Run(ctx context.Context, ch <-chan struct{}, action PollerFunc, resetDuration time.Duration)
Run runs the poller.
type LinkDefinition ¶ added in v0.17.0
func CreateNavigationBreadcrumb ¶ added in v0.17.0
func CreateNavigationBreadcrumb(navs []navigation.Navigation, contentPath string) (LinkDefinition, []component.TitleComponent)
Create first part of breadcrumb from module navigation entries. Performs reverse path traversal and creates all related breadcrumbs.
type LoadingAPI ¶ added in v0.14.0
type LoadingAPI struct {
// contains filtered or unexported fields
}
LoadingAPI is an API for startup modules to run
func NewLoadingAPI ¶ added in v0.14.0
func NewLoadingAPI(ctx context.Context, prefix string, actionDispatcher api.ActionDispatcher, websocketClientManager *api.StreamingConnectionManager, logger log.Logger) *LoadingAPI
NewLoadingAPI creates an instance of LoadingAPI
func (*LoadingAPI) ForceUpdate ¶ added in v0.14.0
func (l *LoadingAPI) ForceUpdate() error
type LoadingManager ¶ added in v0.14.0
type LoadingManager struct {
// contains filtered or unexported fields
}
func NewLoadingManager ¶ added in v0.14.0
func NewLoadingManager() *LoadingManager
func (*LoadingManager) CheckLoading ¶ added in v0.14.0
func (*LoadingManager) Handlers ¶ added in v0.14.0
func (l *LoadingManager) Handlers() []octant.ClientRequestHandler
func (*LoadingManager) Start ¶ added in v0.14.0
func (l *LoadingManager) Start(ctx context.Context, state octant.State, client api.OctantClient)
func (*LoadingManager) UploadKubeConfig ¶ added in v0.14.0
func (*LoadingManager) WatchConfig ¶ added in v0.14.0
func (l *LoadingManager) WatchConfig(path chan string, client api.OctantClient, fs afero.Fs)
type NamespaceManagerConfig ¶
type NamespaceManagerConfig interface {
ClusterClient() cluster.ClientInterface
}
NamespaceManagerConfig is configuration for NamespacesManager.
type NamespacesGenerateFunc ¶
type NamespacesGenerateFunc func(ctx context.Context, config NamespaceManagerConfig) ([]string, error)
NamespacesGenerateFunc is a function that generates a list of namespaces.
type NamespacesManager ¶
type NamespacesManager struct {
// contains filtered or unexported fields
}
NamespacesManager manages namespaces.
func NewNamespacesManager ¶
func NewNamespacesManager(config NamespaceManagerConfig, options ...NamespacesManagerOption) *NamespacesManager
NewNamespacesManager creates an instance of NamespacesManager.
func (NamespacesManager) Handlers ¶
func (n NamespacesManager) Handlers() []octant.ClientRequestHandler
Handlers returns nil.
func (*NamespacesManager) Start ¶
func (n *NamespacesManager) Start(ctx context.Context, state octant.State, s api.OctantClient)
Start starts the manager. It periodically generates a list of namespaces.
type NamespacesManagerOption ¶
type NamespacesManagerOption func(n *NamespacesManager)
NamespacesManagerOption is an option for configuring NamespacesManager.
func WithNamespacesGenerator ¶
func WithNamespacesGenerator(fn NamespacesGenerateFunc) NamespacesManagerOption
WithNamespacesGenerator configures the namespaces generator function.
func WithNamespacesGeneratorPoller ¶
func WithNamespacesGeneratorPoller(poller Poller) NamespacesManagerOption
WithNamespacesGeneratorPoller configures the poller.
type NavigationGeneratorFunc ¶
type NavigationGeneratorFunc func(ctx context.Context, state octant.State, config NavigationManagerConfig) ([]navigation.Navigation, error)
NavigationGeneratorFunc is a function that generates a navigation tree.
type NavigationManager ¶
type NavigationManager struct {
// contains filtered or unexported fields
}
NavigationManager manages the navigation tree.
func NewNavigationManager ¶
func NewNavigationManager(config NavigationManagerConfig, options ...NavigationManagerOption) *NavigationManager
NewNavigationManager creates an instance of NavigationManager.
func (NavigationManager) Handlers ¶
func (n NavigationManager) Handlers() []octant.ClientRequestHandler
Handlers returns nil.
func (*NavigationManager) Start ¶
func (n *NavigationManager) Start(ctx context.Context, state octant.State, s api.OctantClient)
Start starts the manager. It periodically generates navigation updates.
type NavigationManagerConfig ¶
type NavigationManagerConfig interface {
}NavigationManagerConfig is configuration of NavigationManager.
type NavigationManagerOption ¶
type NavigationManagerOption func(n *NavigationManager)
NavigationManagerConfig is an option for configuration NavigationManager.
func WithNavigationGenerator ¶
func WithNavigationGenerator(fn NavigationGeneratorFunc) NavigationManagerOption
WithNavigationGenerator configures the navigation generator function.
func WithNavigationGeneratorPoller ¶
func WithNavigationGeneratorPoller(poller Poller) NavigationManagerOption
WithNavigationGeneratorPoller configures the poller.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError is a not found error.
func NewNotFoundError ¶
func NewNotFoundError(path string) *NotFoundError
NewNotFoundError creates an instance of NotFoundError
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error returns the error string.
func (*NotFoundError) NotFound ¶
func (e *NotFoundError) NotFound() bool
NotFound returns true to signify this is a not found error.
type Poller ¶
type Poller interface { // Run runs `action` and delays `resetDuration` before starting again. If a message // is sent to `ch`, it will cancel current work and restart `action`. Run(ctx context.Context, ch <-chan struct{}, action PollerFunc, resetDuration time.Duration) }
Poller is a poller. It runs an action.
type PollerFunc ¶
PollerFunc is a function run by the poller.
type SingleRunPoller ¶
type SingleRunPoller struct{}
SingleRunPoller is a a poller runs the supplied action once. It is useful for testing.
func NewSingleRunPoller ¶
func NewSingleRunPoller() *SingleRunPoller
NewSingleRunPoller creates an instance of SingleRunPoller.
func (SingleRunPoller) Run ¶
func (a SingleRunPoller) Run(ctx context.Context, _ <-chan struct{}, action PollerFunc, resetDuration time.Duration)
Run runs the poller.
type StateManager ¶
type StateManager = api.StateManager
func NewTerminalStateManager ¶ added in v0.10.0
func NewTerminalStateManager(dashConfig config.Dash) StateManager
NewTerminalStateManager returns a terminal state manager.