Documentation ¶
Index ¶
- Constants
- Variables
- func ApplicationResourceTopology(c client.Client, name, ns string) ([]*types.AppliedResource, error)
- func ApplicationRunningNum(cfg *rest.Config) string
- func CLusterGatewayRatio(c client.Client, cfg *rest.Config) (string, string, string, string)
- func GOLangVersion() string
- func GetResourceObject(c client.Client, gvr *GVR) (runtime.Object, error)
- func K8SVersion(cfg *rest.Config) string
- func LoadApplication(c client.Client, name, ns string) (*v1beta1.Application, error)
- func LoadNamespaceDetail(ctx context.Context, c client.Client, namespace string) (*v1.Namespace, error)
- func PrintLogOfPod(ctx context.Context, config *rest.Config, ...) (chan string, error)
- func ToYaml(o runtime.Object) (string, error)
- func VelaCLIVersion() string
- func VelaCoreRatio(c client.Client, cfg *rest.Config) (string, string, string, string)
- func VelaCoreVersion() string
- type Application
- type ApplicationList
- type Cluster
- type ClusterList
- type Container
- type ContainerList
- type GVR
- type Hinter
- type Info
- type Initer
- type KeyAction
- type KeyActions
- type ManagedResource
- type ManagedResourceList
- type MenuHint
- type Namespace
- type NamespaceList
- type Pod
- type PodList
- type Primitive
- type Resource
- type ResourceList
- type Stack
- type View
- type ViewListener
Constants ¶
const ( // Unknown info Unknown = "UNKNOWN" // VelaSystemNS is the namespace of vela-system, which is the namespace of vela-core and vela-cluster-gateway VelaSystemNS = "vela-system" // VelaCoreAppName is the app name of vela-core VelaCoreAppName = "app.kubernetes.io/name=vela-core" // ClusterGatewayAppName is the app name of vela-core ClusterGatewayAppName = "app.kubernetes.io/name=vela-core-cluster-gateway" )
const ( // AllNamespace represent all namespaces AllNamespace = "all" // AllClusterNamespace represent all cluster namespace AllClusterNamespace = "all" // AllCluster represent all cluster AllCluster = "all" )
const (
// StackPop is the "pop" notify type
StackPop
)
Variables ¶
var ( // CtxKeyAppName request context key of application name CtxKeyAppName = "appName" // CtxKeyNamespace request context key of namespace name CtxKeyNamespace = "appNs" // CtxKeyCluster request context key of cluster name CtxKeyCluster = "cluster" // CtxKeyClusterNamespace request context key of cluster namespace name CtxKeyClusterNamespace = "cluster" // CtxKeyComponentName request context key of component name CtxKeyComponentName = "componentName" // CtxKeyGVR request context key of GVR CtxKeyGVR = "gvr" // CtxKeyPod request context key of pod CtxKeyPod = "pod" // CtxKeyContainer request context key of container CtxKeyContainer = "container" )
Functions ¶
func ApplicationResourceTopology ¶
func ApplicationResourceTopology(c client.Client, name, ns string) ([]*types.AppliedResource, error)
ApplicationResourceTopology return the applied resource of the app in tree form
func ApplicationRunningNum ¶
ApplicationRunningNum return the num of running application
func CLusterGatewayRatio ¶
CLusterGatewayRatio return the usage condition of vela-core cluster gateway pod
func GetResourceObject ¶
GetResourceObject get the resource object refer to the GVR data
func LoadApplication ¶
LoadApplication load the corresponding application according to name and namespace
func LoadNamespaceDetail ¶
func LoadNamespaceDetail(ctx context.Context, c client.Client, namespace string) (*v1.Namespace, error)
LoadNamespaceDetail query detail info of a namespace by name
func PrintLogOfPod ¶
func PrintLogOfPod(ctx context.Context, config *rest.Config, cluster, namespace, podName, containerName string) (chan string, error)
PrintLogOfPod print the log during 48h of aimed pod
func VelaCoreRatio ¶
VelaCoreRatio return the usage condition of vela-core pod
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application is the application resource object
type ApplicationList ¶
type ApplicationList []Application
ApplicationList is application resource list
func ListApplications ¶
ListApplications list all apps in all namespaces
func (ApplicationList) ToTableBody ¶
func (l ApplicationList) ToTableBody() [][]string
ToTableBody generate body of table in application view
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster is cluster resource struct
type ClusterList ¶
type ClusterList []Cluster
ClusterList is cluster resource list
func ListClusters ¶
ListClusters list clusters where application deploys resource
func (ClusterList) ToTableBody ¶
func (l ClusterList) ToTableBody() [][]string
ToTableBody generate body of table in cluster view
type Container ¶
type Container struct { CPU string Mem string CPUR string CPUL string MemR string MemL string // contains filtered or unexported fields }
Container represent the container resource instance
type ContainerList ¶
type ContainerList []Container
ContainerList is container list
func ListContainerOfPod ¶
func ListContainerOfPod(ctx context.Context, client client.Client, cfg *rest.Config) (ContainerList, error)
ListContainerOfPod get the container data of aimed pod
func (ContainerList) ToTableBody ¶
func (l ContainerList) ToTableBody() [][]string
ToTableBody generate body of table in pod view
type Hinter ¶
type Hinter interface { // Hint return key action menu hints of the component Hint() []MenuHint }
Hinter is an abstract of components which can provide menu hints to menu component
type Info ¶
type Info struct {
// contains filtered or unexported fields
}
Info is system info struct
func (*Info) CurrentContext ¶
CurrentContext return current context info
type Initer ¶
type Initer interface { // Start the component Start() // Stop the component Stop() // Init the component Init() }
Initer is an abstract of components whose need to init
type KeyAction ¶
type KeyAction struct { Description string Action func(*tcell.EventKey) *tcell.EventKey Visible bool }
KeyAction is key action struct
type KeyActions ¶
type KeyActions map[tcell.Key]KeyAction
KeyActions is a map from key to action
func (KeyActions) Add ¶
func (ka KeyActions) Add(actions KeyActions)
Add a key action to key action map
func (KeyActions) Delete ¶
func (ka KeyActions) Delete(kk []tcell.Key)
Delete aim key from key action map
func (KeyActions) Hint ¶
func (ka KeyActions) Hint() []MenuHint
Hint convert key action map to menu hints
func (KeyActions) Set ¶
func (ka KeyActions) Set(actions KeyActions)
Set a key action to key action map
type ManagedResource ¶
type ManagedResource struct {
// contains filtered or unexported fields
}
ManagedResource is managed resource of application
func LoadResourceDetail ¶
func LoadResourceDetail(resource query.Resource) ManagedResource
LoadResourceDetail return the aim resource detail info
type ManagedResourceList ¶
type ManagedResourceList []ManagedResource
ManagedResourceList is managed resource list
func ListManagedResource ¶
ListManagedResource return managed resources of application
func (*ManagedResourceList) FilterCluster ¶
func (l *ManagedResourceList) FilterCluster(clusterName string)
FilterCluster filter out objects that belong to the target cluster
func (*ManagedResourceList) FilterClusterNamespace ¶
func (l *ManagedResourceList) FilterClusterNamespace(clusterNS string)
FilterClusterNamespace filter out objects that belong to the target namespace
func (*ManagedResourceList) ToTableBody ¶
func (l *ManagedResourceList) ToTableBody() [][]string
ToTableBody generate header of table in managed resource view
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace is namespace struct
type NamespaceList ¶
type NamespaceList []Namespace
NamespaceList is namespace list
func ListClusterNamespaces ¶
ListClusterNamespaces return namespace of application's resource
func ListNamespaces ¶
ListNamespaces return all namespaces
func (NamespaceList) ToTableBody ¶
func (l NamespaceList) ToTableBody() [][]string
ToTableBody generate body of table in namespace view
type Pod ¶
type Pod struct { Name string Namespace string Cluster string Ready string Status string CPU string Mem string CPUR string CPUL string MemR string MemL string IP string NodeName string Age string }
Pod represent the k8s pod resource instance
type PodList ¶
type PodList []Pod
PodList is pod list
func (PodList) ToTableBody ¶
ToTableBody generate body of table in pod view
type ResourceList ¶
type ResourceList interface { // Header generate header of table in resource view Header() []string // Body generate body of table in resource view Body() [][]string }
ResourceList an abstract kinds of resource list which can convert it to data of view in the form of table
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack is a stack to store components and notify listeners of main view of app
func (*Stack) AddListener ¶
func (s *Stack) AddListener(listener ViewListener)
AddListener add a new resource listener
func (*Stack) IsLastView ¶
IsLastView check whether stack only have one view now
func (*Stack) RemoveListener ¶
func (s *Stack) RemoveListener(listener ViewListener)
RemoveListener remove the aim resource listener
type ViewListener ¶
type ViewListener interface { // StackPop pop old component and render component StackPop(old, new View) // StackPush push a new component StackPush(old, new View) }
ViewListener listen notify from the main view of app and render itself again