octant

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionDeleteObject            = "action.octant.dev/deleteObject"
	ActionOverviewCordon          = "action.octant.dev/cordon"
	ActionOverviewUncordon        = "action.octant.dev/uncordon"
	ActionOverviewContainerEditor = "action.octant.dev/containerEditor"
	ActionOverviewCronjob         = "action.octant.dev/cronJob"
	ActionOverviewSuspendCronjob  = "action.octant.dev/suspendCronJob"
	ActionOverviewResumeCronjob   = "action.octant.dev/resumeCronJob"
	ActionOverviewServiceEditor   = "action.octant.dev/serviceEditor"
	ActionDeploymentConfiguration = "action.octant.dev/deploymentConfiguration"
	ActionUpdateObject            = "action.octant.dev/update"
	ActionApplyYaml               = "action.octant.dev/apply"
)
View Source
const (
	// WorkloadStatusColorOK is the color for ok workload status.
	WorkloadStatusColorOK = "#60b515"
	// WorkloadStatusColorWarning is the color for warning workload status.
	WorkloadStatusColorWarning = "#f57600"
	// WorkloadStatusColorError is the color for error workload status.
	WorkloadStatusColorError = "#e12200"
)

Variables

View Source
var (
	// PodMetricsResource is resource for pod metrics.
	PodMetricsResource = schema.GroupVersionResource{Group: "metrics.k8s.io", Version: "v1beta1", Resource: "pods"}
)

Functions

func CRDAPIVersions

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

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

func CombineResourceRequirements added in v0.10.0

func CombineResourceRequirements(a, b corev1.ResourceRequirements) corev1.ResourceRequirements

CombineResourceRequirements combines two resource requirements into a new resource requirement.

func CreateCard added in v0.10.0

func CreateCard(workload *Workload, namespace string) (*component.Card, bool, error)

func DeleteObjectConfirmation added in v0.13.0

func DeleteObjectConfirmation(object runtime.Object) (*component.Confirmation, error)

func DeleteObjectConfirmationButton added in v0.13.0

func DeleteObjectConfirmationButton(object runtime.Object) (component.ButtonOption, error)

func IsPodMetricsNotSupported added in v0.10.0

func IsPodMetricsNotSupported(err error) bool

IsPodMetricsNotSupported returns true if error is pod metrics not supported.

func ObjectUpdateFromPayload added in v0.13.0

func ObjectUpdateFromPayload(payload action.Payload) (*unstructured.Unstructured, error)

ObjectUpdateFromPayload loads an object from the payload. The object source in YAML format should exist in the `update` key.

func PodCPUStat added in v0.10.0

func PodCPUStat(workload *Workload) (*component.SingleStat, error)

PodCPUStat creates a single stat component for pod cpu. It will summarize all the pods in the workload.

func PodMemoryStat added in v0.10.0

func PodMemoryStat(workload *Workload) (*component.SingleStat, error)

PodMemoryStat creates a single stats component for pod memory. It will summarize all the pods in the workload.

Types

type ApplyYaml added in v0.14.0

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

ApplyYaml creates a yaml applier

func NewApplyYaml added in v0.14.0

func NewApplyYaml(logger log.Logger, objectStore store.Store) *ApplyYaml

NewApplyYaml creates an instance of ApplyYaml

func (*ApplyYaml) ActionName added in v0.14.0

func (p *ApplyYaml) ActionName() string

ActionName returns the name of this action

func (*ApplyYaml) Handle added in v0.14.0

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

Handle applies the requested yaml to the cluster

type CRDPathGenFunc

type CRDPathGenFunc func(namespace, crdName, version, 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 ClusterPodMetricsLoader added in v0.10.0

type ClusterPodMetricsLoader struct {
	PodMetricsCRUD PodMetricsCRUD
	// contains filtered or unexported fields
}

ClusterPodMetricsLoader loads metrics for a pod using a cluster client.

func NewClusterPodMetricsLoader added in v0.10.0

func NewClusterPodMetricsLoader(clusterClient cluster.ClientInterface, options ...ClusterPodMetricsLoaderOption) (*ClusterPodMetricsLoader, error)

NewClusterPodMetricsLoader creates an instance of ClusterPodMetricsLoader.

func (*ClusterPodMetricsLoader) Load added in v0.10.0

func (ml *ClusterPodMetricsLoader) Load(ctx context.Context, namespace, name string) (*unstructured.Unstructured, bool, error)

Load loads metrics for a pod given namespace and a name.

func (*ClusterPodMetricsLoader) SupportsMetrics added in v0.10.0

func (ml *ClusterPodMetricsLoader) SupportsMetrics(ctx context.Context) (bool, error)

type ClusterPodMetricsLoaderOption added in v0.10.0

type ClusterPodMetricsLoaderOption func(loader *ClusterPodMetricsLoader)

ClusterPodMetricsLoaderOption is an option for configuring ClusterPodMetricsLoader.

type ClusterWorkloadLoader added in v0.10.0

type ClusterWorkloadLoader struct {
	ObjectStatuser   func(context.Context, runtime.Object, store.Store, link.Interface) (objectstatus.ObjectStatus, error)
	ObjectStore      store.Store
	PodMetricsLoader PodMetricsLoader
}

ClusterWorkloadLoader loads workloads from a Kubernetes cluster.

func NewClusterWorkloadLoader added in v0.10.0

func NewClusterWorkloadLoader(objectStore store.Store, pml PodMetricsLoader, options ...ClusterWorkloadLoaderOption) (*ClusterWorkloadLoader, error)

NewWorkloadLoader creates an instance of ClusterWorkloadLoader.

func (*ClusterWorkloadLoader) Load added in v0.10.0

func (wl *ClusterWorkloadLoader) Load(ctx context.Context, namespace string, link link.Interface) ([]Workload, error)

Load loads workloads from a cluster.

type ClusterWorkloadLoaderOption added in v0.10.0

type ClusterWorkloadLoaderOption func(wl *ClusterWorkloadLoader)

ClusterWorkloadLoaderOption is option for configuring ClusterWorkloadLoader.

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 Cordon added in v0.11.0

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

Cordon cordons a node

func NewCordon added in v0.11.0

func NewCordon(objectStore store.Store, clusterClient cluster.ClientInterface) *Cordon

NewCordon creates an instance of Cordon

func (*Cordon) ActionName added in v0.11.0

func (c *Cordon) ActionName() string

ActionName returns the name of this action

func (*Cordon) Cordon added in v0.11.0

func (c *Cordon) Cordon(node *corev1.Node) error

Cordon marks a node as unschedulable

func (*Cordon) Handle added in v0.11.0

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

Handle executing cordon

type CronJobResume added in v0.14.0

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

CronJobResume resumes a cronjob

func NewCronJobResume added in v0.14.0

func NewCronJobResume(objectStore store.Store, clusterClient cluster.ClientInterface) *CronJobResume

func (*CronJobResume) ActionName added in v0.14.0

func (c *CronJobResume) ActionName() string

ActionName returns the action name

func (*CronJobResume) Handle added in v0.14.0

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

Handle resuming cronjob

type CronJobSuspend added in v0.14.0

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

CronJobSuspend pauses a cronjob

func NewCronJobSuspend added in v0.14.0

func NewCronJobSuspend(objectStore store.Store, clusterClient cluster.ClientInterface) *CronJobSuspend

func (*CronJobSuspend) ActionName added in v0.14.0

func (c *CronJobSuspend) ActionName() string

ActionName returns the action name

func (*CronJobSuspend) Handle added in v0.14.0

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

Handle suspending cronjob

type CronJobTrigger added in v0.11.0

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

CronJobTrigger manually triggers a cronjob

func NewCronJobTrigger added in v0.11.0

func NewCronJobTrigger(objectStore store.Store, clusterClient cluster.ClientInterface) *CronJobTrigger

NewCronJobTrigger creates an instance of CronJobTrigger

func (*CronJobTrigger) ActionName added in v0.11.0

func (c *CronJobTrigger) ActionName() string

ActionName returns the name of this action

func (*CronJobTrigger) Handle added in v0.11.0

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

Handle executing cronjob

func (*CronJobTrigger) Trigger added in v0.11.0

func (c *CronJobTrigger) Trigger(name string, cronJob *batchv1beta1.CronJob) error

Trigger manually creates a new job

type CustomResourceDefinitionPrinterColumn added in v0.10.0

type CustomResourceDefinitionPrinterColumn struct {
	Name        string
	Type        string
	Description string
	JSONPath    string
}

type CustomResourceDefinitionTool added in v0.17.0

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

CustomResourceDefinitionTool is a tool for extracting information from a CRD.

func NewCustomResourceDefinitionTool added in v0.17.0

func NewCustomResourceDefinitionTool(object *unstructured.Unstructured) (*CustomResourceDefinitionTool, error)

NewCustomResourceDefinitionTool creates an instance of CustomResourceDefinitionTool.

func (*CustomResourceDefinitionTool) GroupKind added in v0.17.0

func (crd *CustomResourceDefinitionTool) GroupKind() (schema.GroupKind, error)

GroupKind returns a group/kind for the CRD.

func (*CustomResourceDefinitionTool) Version added in v0.17.0

Version returns a version descriptor for a specified version.

func (*CustomResourceDefinitionTool) Versions added in v0.17.0

func (crd *CustomResourceDefinitionTool) Versions() ([]string, error)

Versions returns the defined versions in a CRD.

type CustomResourceDefinitionVersion added in v0.10.0

type CustomResourceDefinitionVersion struct {
	Version        string
	PrinterColumns []CustomResourceDefinitionPrinterColumn
}

type DashboardClientFactory added in v0.15.0

type DashboardClientFactory interface {
	// Create creates a dashboard clients in a goja value.
	Create(ctx context.Context, vm *goja.Runtime) goja.Value
}

DashboardClientFactory is an interface for a factory that creates dashboard clients.

type DashboardClientFunction added in v0.15.0

type DashboardClientFunction interface {
	// Name returns the name of the function.
	Name() string
	// Call generates a function that executes the function.
	Call(ctx context.Context, vm *goja.Runtime) func(c goja.FunctionCall) goja.Value
}

DashboardClientFunction is a function in the the dashboard client.

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 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.
	Events(ctx context.Context) ([]event.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 LinkGenerator added in v0.15.0

type LinkGenerator interface {
	// ObjectPath returns the path of a reference.
	ObjectPath(namespace, apiVersion, kind, name string) (string, error)
}

LinkGenerator is an interface containing object path items.

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
	IconMap      map[string]string
	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, module string, wantsClusterScoped bool) ([]navigation.Navigation, error)

Generate returns navigation entries.

func (nf *NavigationFactory) Root() string

Root returns the rootPath of the navigation tree.

type NoPodMetricsErr added in v0.10.0

type NoPodMetricsErr struct{}

NoPodMetricsErr is an error signifying a cluster does not have pod metrics support.

func (*NoPodMetricsErr) Error added in v0.10.0

func (e *NoPodMetricsErr) Error() string

func (*NoPodMetricsErr) NoPodMetricsSupport added in v0.10.0

func (e *NoPodMetricsErr) NoPodMetricsSupport() bool

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) GvkFromPath added in v0.17.0

func (op *ObjectPath) GvkFromPath(contentPath, namespace string) (schema.GroupVersionKind, error)

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
	ReversePathLookupFunc ReversePathLookupFunc
}

ObjectPathConfig is configuration for ObjectPath.

func (*ObjectPathConfig) Validate

func (opc *ObjectPathConfig) Validate() error

Validate returns an error if the configuration is invalid.

type ObjectUpdaterDispatcher added in v0.13.0

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

ObjectUpdaterDispatcher is an action that updates an object.

func NewObjectUpdaterDispatcher added in v0.13.0

func NewObjectUpdaterDispatcher(objectStore store.Store, options ...ObjectUpdaterDispatcherOption) *ObjectUpdaterDispatcher

NewObjectUpdaterDispatcher creates an instance of ObjectUpdaterDispatcher.

func (ObjectUpdaterDispatcher) ActionName added in v0.13.0

func (o ObjectUpdaterDispatcher) ActionName() string

ActionName returns the action name this dispatcher responds to.

func (ObjectUpdaterDispatcher) Handle added in v0.13.0

func (o ObjectUpdaterDispatcher) Handle(ctx context.Context, alerter action.Alerter, payload action.Payload) error

Handle updates an object using a payload if possible.

type ObjectUpdaterDispatcherOption added in v0.13.0

type ObjectUpdaterDispatcherOption func(dispatcher *ObjectUpdaterDispatcher)

type PathLookupFunc

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

PathLookupFunc looks up paths for an object.

type PodMetricsCRUD added in v0.10.0

type PodMetricsCRUD interface {
	// Get returns pod metrics for a pod. If pod is not found, isFound will be false.
	Get(ctx context.Context, namespace, name string) (pod *unstructured.Unstructured, isFound bool, err error)
}

PodMetricsCRUD contains CRUD methods for accessing pod metrics.

type PodMetricsLoader added in v0.10.0

type PodMetricsLoader interface {
	// Load loads metrics for a pod given namespace and a name. It returns false if the
	// object is not found.
	Load(ctx context.Context, namespace, name string) (object *unstructured.Unstructured, isFound bool, err error)
	// SupportsMetrics returns true if the cluster has metrics support.
	SupportsMetrics(ctx context.Context) (bool, error)
}

PodMetricsLoader loads metrics for a pod.

type PodWithMetric added in v0.10.0

type PodWithMetric struct {
	Pod          *unstructured.Unstructured
	ResourceList corev1.ResourceList
}

PodWithMetric combines a pod and resource list into a single type.

type PortForward added in v0.10.0

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

PortForward creates a port forwarder

func NewPortForward added in v0.10.0

func NewPortForward(logger log.Logger, objectStore store.Store, portForwarder portforward.PortForwarder) *PortForward

NewPortForward creates an instance of PortForward

func (*PortForward) ActionName added in v0.10.0

func (p *PortForward) ActionName() string

ActionName returns the name of this action

func (*PortForward) Handle added in v0.10.0

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

Handle starts a port forward

type PortForwardDelete added in v0.10.0

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

PortForwardDelete stops a port forwarder

func NewPortForwardDelete added in v0.10.0

func NewPortForwardDelete(logger log.Logger, objectStore store.Store, portForwarder portforward.PortForwarder) *PortForwardDelete

NewPortForwardDelete creates an instance of PortForwardDelete

func (*PortForwardDelete) ActionName added in v0.10.0

func (p *PortForwardDelete) ActionName() string

ActionName returns the name of this action

func (*PortForwardDelete) Handle added in v0.10.0

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

Handle stops a port forward

type ReversePathLookupFunc added in v0.17.0

type ReversePathLookupFunc func(path, namespace string) (schema.GroupVersionKind, error)

ReversePathLookupFunc 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)
	// ClientID returns the websocket client ID.
	GetClientID() string
}

State represents Octant's view state.

type Storage added in v0.15.0

type Storage interface {
	// ObjectStore returns the object store.
	ObjectStore() store.Store
}

Storage is an interface containing storage items.

type Uncordon added in v0.11.0

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

Uncordon uncordons a node

func NewUncordon added in v0.11.0

func NewUncordon(objectStore store.Store, clusterClient cluster.ClientInterface) *Uncordon

NewUncordon creates an instances of uncordon

func (*Uncordon) ActionName added in v0.11.0

func (u *Uncordon) ActionName() string

ActionName returns the name of this action

func (*Uncordon) Handle added in v0.11.0

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

Handle executing uncordon

func (*Uncordon) Uncordon added in v0.11.0

func (u *Uncordon) Uncordon(node *corev1.Node) error

Uncordon marks a node as schedulable

type UpdateCancelFunc

type UpdateCancelFunc func()

UpdateCancelFunc cancels the update.

type Workload added in v0.10.0

type Workload struct {
	// IconName is the name of the icon for this workload.
	IconName string
	// Name is the name of the workload
	Name string
	// Owner is the ancestor that ultimately own the workload.
	Owner *unstructured.Unstructured

	SegmentCounter map[component.NodeStatus][]PodWithMetric
	// contains filtered or unexported fields
}

Workload is a workload.

func NewWorkload added in v0.10.0

func NewWorkload(name, iconName string) *Workload

NewWorkload creates a workload.

func (*Workload) AddPodStatus added in v0.10.0

func (w *Workload) AddPodStatus(status component.NodeStatus, object *unstructured.Unstructured, resourceList corev1.ResourceList)

AddStatus adds a pod status to the workload.

func (*Workload) DonutChart added in v0.10.0

func (w *Workload) DonutChart(size component.DonutChartSize) (*component.DonutChart, error)

func (*Workload) PodMetricsEnabled added in v0.10.0

func (w *Workload) PodMetricsEnabled() bool

func (*Workload) Pods added in v0.10.0

func (*Workload) PodsWithMetrics added in v0.10.0

func (w *Workload) PodsWithMetrics() []PodWithMetric

PodsWithMetrics returns a slice of PodWithMetric.

func (*Workload) SetPodMetricsDisabled added in v0.10.0

func (w *Workload) SetPodMetricsDisabled()

type WorkloadCardCollector added in v0.10.0

type WorkloadCardCollector struct {
	WorkloadLoader WorkloadLoaderInterface
}

WorkloadCardCollector creates cards for workloads in a namespace.

func NewWorkloadCardCollector added in v0.10.0

func NewWorkloadCardCollector(loader WorkloadLoaderInterface) (*WorkloadCardCollector, error)

NewWorkloadCardCollector creates an instance of WorkloadCardCollector.

func (*WorkloadCardCollector) Collect added in v0.10.0

func (wc *WorkloadCardCollector) Collect(ctx context.Context, namespace string, link link.Interface) ([]*component.Card, bool, error)

Collect collects cards.

type WorkloadLoaderInterface added in v0.10.0

type WorkloadLoaderInterface interface {
	// Load loads workloads from a namespace.
	Load(ctx context.Context, namespace string, link link.Interface) ([]Workload, error)
}

WorkloadLoaderInterface loads workloads from a namespace.

type WorkloadSummary added in v0.10.0

type WorkloadSummary struct {
	Summary        component.Component
	Memory         component.Component
	CPU            component.Component
	MetricsEnabled bool
}

func CreateWorkloadSummary added in v0.10.0

func CreateWorkloadSummary(workload *Workload, summarySize component.DonutChartSize) (WorkloadSummary, error)

Directories

Path Synopsis
Package fake is a generated GoMock package.
Package fake is a generated GoMock package.

Jump to

Keyboard shortcuts

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