controllers

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionDeleteObject = "lissio/deleteObject"
)

Variables

This section is empty.

Functions

func CRDAPIVersions

func CRDAPIVersions(crd *unstructured.Unstructured) ([]schema.GroupVersion, error)

CRDAPIVersions returns the group versions that are contained within a CRD.

Types

type CRDPathGenFunc

type CRDPathGenFunc func(namespace, crdName, name string) (string, error)

CRDPathGenFunc is a function that generates a custom resource path.

type ClientRequestHandler

type ClientRequestHandler struct {
	RequestType string
	Handler     func(state State, payload action.Payload) error
}

ClientRequestHandler is a client request.

type ContainerEditor

type ContainerEditor struct {
	// contains filtered or unexported fields
}

ContainerEditor edits containers.

func NewContainerEditor

func NewContainerEditor(objectStore store.Store) *ContainerEditor

NewContainerEditor creates an instance of ContainerEditor.

func (*ContainerEditor) ActionName

func (e *ContainerEditor) ActionName() string

ActionName returns name of this action.

func (*ContainerEditor) Handle

func (e *ContainerEditor) Handle(ctx context.Context, alerter action.Alerter, payload action.Payload) error

Handle edits a container. Supported edits:

  • image

type ContentPathUpdateFunc

type ContentPathUpdateFunc func(contentPath string)

ContentPathUpdateFunc is a function that is called when content path is updated.

type DeploymentConfigurationEditor

type DeploymentConfigurationEditor struct {
	// contains filtered or unexported fields
}

DeploymentConfigurationEditor edits a deployment's configuration.

func NewDeploymentConfigurationEditor

func NewDeploymentConfigurationEditor(logger log.Logger, objectStore store.Store) *DeploymentConfigurationEditor

NewDeploymentConfigurationEditor edits a deployment.

func (*DeploymentConfigurationEditor) ActionName

func (e *DeploymentConfigurationEditor) ActionName() string

ActionName returns the action name for this editor.

func (*DeploymentConfigurationEditor) Handle

Handle edits a deployment. Supported edits:

  • replicas

type EntriesFunc

type EntriesFunc func(ctx context.Context, prefix, namespace string, objectStore store.Store, wantsClusterScoped bool) ([]navigation.Navigation, bool, error)

EntriesFunc is a function that can create navigation entries.

type Event

type Event struct {
	Type EventType   `json:"type"`
	Data interface{} `json:"data"`
	Err  error
}

Event is an event for the dash frontend.

type EventType

type EventType string
const (
	// EventTypeContent is a content event.
	EventTypeContent EventType = "content"

	// EventTypeNamespaces is a namespaces event.
	EventTypeNamespaces EventType = "namespaces"

	// EventTypeNavigation is a navigation event.
	EventTypeNavigation EventType = "navigation"

	// EventTypeObjectNotFound is an object not found event.
	EventTypeObjectNotFound EventType = "objectNotFound"

	// EventTypeCurrentNamespace is a current namespace event.
	EventTypeCurrentNamespace EventType = "currentNamespace"

	// EventTypeUnknown is an unknown event.
	EventTypeUnknown EventType = "unknown"

	// EventTypeNamespace is a namespace event.
	EventTypeNamespace EventType = "namespace"

	// EventTypeContext is a context event.
	EventTypeContext EventType = "context"

	// EventTypeKubeConfig is an event for updating kube contexts on the front end.
	EventTypeKubeConfig EventType = "kubeConfig"

	// EventTypeContentPath is a content path event.
	EventTypeContentPath EventType = "contentPath"

	// EventTypeFilters is a filters event.
	EventTypeFilters EventType = "filters"

	// EventTypeAlert is an alert event.
	EventTypeAlert EventType = "alert"
)

type Filter

type Filter struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Filter is used to filter queries for objects. Typically, the filter is an object's label.

func (*Filter) IsEqual

func (f *Filter) IsEqual(other Filter) bool

IsEqual returns true if the filter equals the other filter.

func (*Filter) String

func (f *Filter) String() string

String converts the filter to a string.

func (*Filter) ToQueryParam

func (f *Filter) ToQueryParam() string

ToQueryParam converts the filter to a query parameter.

type Generator

type Generator interface {
	// Event generates events using the returned channel.
	Event(ctx context.Context) (Event, error)

	// ScheduleDelay is how long to wait before scheduling this generator again.
	ScheduleDelay() time.Duration

	// Name is the generator name.
	Name() string
}

Generator generates events.

type NamespaceUpdateFunc

type NamespaceUpdateFunc func(namespace string)

NamespaceUpdateFunc is a function that is called when namespace is updated.

type NavigationEntries struct {
	Lookup       map[string]string
	EntriesFuncs map[string]EntriesFunc
	Order        []string
}

NavigationEntries help construct navigation entries.

type NavigationFactory struct {
	// contains filtered or unexported fields
}

NavigationFactory generates navigation entries.

func NewNavigationFactory

func NewNavigationFactory(namespace string, root string, objectStore store.Store, entries NavigationEntries) *NavigationFactory

NewNavigationFactory creates an instance of NewNavigationFactory.

func (nf *NavigationFactory) Generate(ctx context.Context, title string, iconName, iconSource string, wantsClusterScoped bool) (*navigation.Navigation, error)

Generate returns navigation entries.

func (nf *NavigationFactory) Root() string

Root returns the rootPath of the navigation tree.

type ObjectPath

type ObjectPath struct {
	// contains filtered or unexported fields
}

ObjectPath contains functions for generating paths for an object. Typically this is a helper which can be embedded in modules.

func NewObjectPath

func NewObjectPath(config ObjectPathConfig) (*ObjectPath, error)

NewObjectPath creates ObjectPath.

func (*ObjectPath) AddCRD

func (op *ObjectPath) AddCRD(ctx context.Context, crd *unstructured.Unstructured) error

AddCRD adds support for a CRD to the ObjectPath.

func (*ObjectPath) GroupVersionKindPath

func (op *ObjectPath) GroupVersionKindPath(namespace, apiVersion, kind, name string) (string, error)

GroupVersionKind returns a path for an object.

func (*ObjectPath) RemoveCRD

func (op *ObjectPath) RemoveCRD(ctx context.Context, crd *unstructured.Unstructured) error

RemoveCRD removes support for a CRD from the ObjectPath.

func (*ObjectPath) ResetCRDs

func (op *ObjectPath) ResetCRDs(ctx context.Context) error

ResetCRDs deletes all the CRD paths ObjectPath is tracking.

func (*ObjectPath) SupportedGroupVersionKind

func (op *ObjectPath) SupportedGroupVersionKind() []schema.GroupVersionKind

SupportedGroupVersionKind returns a slice of GVKs this object path can handle.

type ObjectPathConfig

type ObjectPathConfig struct {
	ModuleName     string
	SupportedGVKs  []schema.GroupVersionKind
	PathLookupFunc PathLookupFunc
	CRDPathGenFunc CRDPathGenFunc
}

ObjectPathConfig is configuration for ObjectPath.

func (*ObjectPathConfig) Validate

func (opc *ObjectPathConfig) Validate() error

Validate returns an error if the configuration is invalid.

type PathLookupFunc

type PathLookupFunc func(namespace, apiVersion, kind, name string) (string, error)

PathLookupFunc looks up paths for an object.

type ServiceConfigurationEditor

type ServiceConfigurationEditor struct {
	// contains filtered or unexported fields
}

ServiceConfigurationEditor edits editors.

func NewServiceConfigurationEditor

func NewServiceConfigurationEditor(objectStore store.Store) *ServiceConfigurationEditor

NewServiceConfigurationEditor creates an instance of ServiceConfigurationEditor.

func (*ServiceConfigurationEditor) ActionName

func (s *ServiceConfigurationEditor) ActionName() string

ActionName returns the name of this action.

func (*ServiceConfigurationEditor) Handle

func (s *ServiceConfigurationEditor) Handle(ctx context.Context, alerter action.Alerter, payload action.Payload) error

Handle edits a service: Supported edits:

  • selector

type State

type State interface {
	// SetContentPath sets the content path.
	SetContentPath(string)
	// GetContentPath returns the content path.
	GetContentPath() string
	// OnNamespaceUpdate registers a function to be called with the content path
	// is changed.
	OnContentPathUpdate(fn ContentPathUpdateFunc) UpdateCancelFunc
	// GetQueryParams returns the query params.
	GetQueryParams() map[string][]string
	// SetNamespace sets the namespace.
	SetNamespace(namespace string)
	// GetNamespace returns the namespace.
	GetNamespace() string
	// OnNamespaceUpdate returns a function to be called when the namespace
	// is changed.
	OnNamespaceUpdate(fun NamespaceUpdateFunc) UpdateCancelFunc
	// AddFilter adds a label to filtered.
	AddFilter(filter Filter)
	// RemoveFilter removes a filter.
	RemoveFilter(filter Filter)
	// GetFilters returns a slice of filters.
	GetFilters() []Filter
	// SetFilters replaces the current filters with a slice of filters.
	// The slice can be empty.
	SetFilters(filters []Filter)
	// SetContext sets the current context.
	SetContext(requestedContext string)
	// Dispatch dispatches a payload for an action.
	Dispatch(ctx context.Context, actionName string, payload action.Payload) error
	// SendAlert sends an alert.
	SendAlert(alert action.Alert)
}

State represents Lissio's view state.

type UpdateCancelFunc

type UpdateCancelFunc func()

UpdateCancelFunc cancels the update.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL