Documentation ¶
Index ¶
- Constants
- func AddComponentRow(tbl *printer.TablePrinter, objs *ClusterObjects, opt *PrinterOptions)
- func AddEventRow(tbl *printer.TablePrinter, objs *ClusterObjects, opt *PrinterOptions)
- func AddInstanceRow(tbl *printer.TablePrinter, objs *ClusterObjects, opt *PrinterOptions)
- func AddLabelRow(tbl *printer.TablePrinter, objs *ClusterObjects, opt *PrinterOptions)
- func BuildStorageClass(storages []StorageInfo) string
- func BuildStorageSize(storages []StorageInfo) string
- func FindClusterComp(cluster *appsv1alpha1.Cluster, compDefName string) *appsv1alpha1.ClusterComponentSpec
- func GenerateName() string
- func GetClusterByName(dynamic dynamic.Interface, name string, namespace string) (*appsv1alpha1.Cluster, error)
- func GetClusterDefByName(dynamic dynamic.Interface, name string) (*appsv1alpha1.ClusterDefinition, error)
- func GetComponentEndpoints(svcList *corev1.ServiceList, c *appsv1alpha1.ClusterComponentSpec) ([]string, []string)
- func GetComponentServices(svcList *corev1.ServiceList, c *appsv1alpha1.ClusterComponentSpec) ([]*corev1.Service, []*corev1.Service)
- func GetConfigConstraintByName(dynamic dynamic.Interface, name string) (*appsv1alpha1.ConfigConstraint, error)
- func GetConfigMapByName(dynamic dynamic.Interface, namespace, name string) (*corev1.ConfigMap, error)
- func GetDefaultCompName(cd *appsv1alpha1.ClusterDefinition) (string, error)
- func GetExternalAddr(svc *corev1.Service) string
- func GetK8SClientObject(dynamic dynamic.Interface, obj client.Object, gvr schema.GroupVersionResource, ...) error
- func GetLatestVersion(dynamic dynamic.Interface, clusterDef string) (string, error)
- func GetPodClusterName(pod *corev1.Pod) string
- func GetPodComponentName(pod *corev1.Pod) string
- func GetPodWorkloadType(pod *corev1.Pod) string
- func GetVersionByClusterDef(dynamic dynamic.Interface, clusterDef string) (*appsv1alpha1.ClusterVersionList, error)
- type ClusterInfo
- type ClusterObjects
- type CompInfo
- type ComponentInfo
- type GetOptions
- type InstanceInfo
- type ObjectsGetter
- type PrintType
- type Printer
- type PrinterOptions
- type StorageInfo
Constants ¶
const (
ComponentNameEmpty = ""
)
const ConditionsError = "ConditionsError"
ConditionsError cluster will display this status on list cmd when the status of ApplyResources or ProvisioningStarted condition is not "True".
Variables ¶
This section is empty.
Functions ¶
func AddComponentRow ¶
func AddComponentRow(tbl *printer.TablePrinter, objs *ClusterObjects, opt *PrinterOptions)
func AddEventRow ¶
func AddEventRow(tbl *printer.TablePrinter, objs *ClusterObjects, opt *PrinterOptions)
func AddInstanceRow ¶
func AddInstanceRow(tbl *printer.TablePrinter, objs *ClusterObjects, opt *PrinterOptions)
func AddLabelRow ¶
func AddLabelRow(tbl *printer.TablePrinter, objs *ClusterObjects, opt *PrinterOptions)
func BuildStorageClass ¶
func BuildStorageClass(storages []StorageInfo) string
func BuildStorageSize ¶
func BuildStorageSize(storages []StorageInfo) string
func FindClusterComp ¶
func FindClusterComp(cluster *appsv1alpha1.Cluster, compDefName string) *appsv1alpha1.ClusterComponentSpec
FindClusterComp finds component in cluster object based on the component definition name
func GenerateName ¶
func GenerateName() string
func GetClusterByName ¶
func GetClusterDefByName ¶
func GetClusterDefByName(dynamic dynamic.Interface, name string) (*appsv1alpha1.ClusterDefinition, error)
func GetComponentEndpoints ¶
func GetComponentEndpoints(svcList *corev1.ServiceList, c *appsv1alpha1.ClusterComponentSpec) ([]string, []string)
GetComponentEndpoints gets component internal and external endpoints
func GetComponentServices ¶
func GetComponentServices(svcList *corev1.ServiceList, c *appsv1alpha1.ClusterComponentSpec) ([]*corev1.Service, []*corev1.Service)
GetComponentServices gets component services
func GetConfigConstraintByName ¶
func GetConfigConstraintByName(dynamic dynamic.Interface, name string) (*appsv1alpha1.ConfigConstraint, error)
func GetConfigMapByName ¶
func GetDefaultCompName ¶
func GetDefaultCompName(cd *appsv1alpha1.ClusterDefinition) (string, error)
func GetExternalAddr ¶
GetExternalAddr get external IP from service annotation
func GetK8SClientObject ¶
func GetK8SClientObject(dynamic dynamic.Interface, obj client.Object, gvr schema.GroupVersionResource, namespace, name string) error
GetK8SClientObject gets the client object of k8s, obj must be a struct pointer so that obj can be updated with the response.
func GetLatestVersion ¶
GetLatestVersion get the latest cluster versions that reference the cluster definition
func GetPodClusterName ¶
func GetPodComponentName ¶
func GetPodWorkloadType ¶
func GetVersionByClusterDef ¶
func GetVersionByClusterDef(dynamic dynamic.Interface, clusterDef string) (*appsv1alpha1.ClusterVersionList, error)
Types ¶
type ClusterInfo ¶
type ClusterInfo struct { Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty"` ClusterVersion string `json:"clusterVersion,omitempty"` TerminationPolicy string `json:"terminationPolicy,omitempty"` ClusterDefinition string `json:"clusterDefinition,omitempty"` Status string `json:"status,omitempty"` InternalEP string `json:"internalEP,omitempty"` ExternalEP string `json:"externalEP,omitempty"` CreatedTime string `json:"age,omitempty"` Labels string `json:"labels,omitempty"` }
type ClusterObjects ¶
type ClusterObjects struct { Cluster *appsv1alpha1.Cluster ClusterDef *appsv1alpha1.ClusterDefinition ClusterVersion *appsv1alpha1.ClusterVersion Pods *corev1.PodList Services *corev1.ServiceList Secrets *corev1.SecretList PVCs *corev1.PersistentVolumeClaimList Nodes []*corev1.Node ConfigMaps *corev1.ConfigMapList Events *corev1.EventList BackupPolicies []dpv1alpha1.BackupPolicy Backups []dpv1alpha1.Backup }
func FakeClusterObjs ¶
func FakeClusterObjs() *ClusterObjects
func NewClusterObjects ¶
func NewClusterObjects() *ClusterObjects
func (*ClusterObjects) GetClusterInfo ¶
func (o *ClusterObjects) GetClusterInfo() *ClusterInfo
func (*ClusterObjects) GetComponentInfo ¶
func (o *ClusterObjects) GetComponentInfo() []*ComponentInfo
func (*ClusterObjects) GetInstanceInfo ¶
func (o *ClusterObjects) GetInstanceInfo() []*InstanceInfo
type CompInfo ¶
type CompInfo struct { Component *appsv1alpha1.ClusterComponentSpec ComponentStatus *appsv1alpha1.ClusterComponentStatus ComponentDef *appsv1alpha1.ClusterComponentDefinition }
func FillCompInfoByName ¶
func (*CompInfo) InferPodName ¶
type ComponentInfo ¶
type ComponentInfo struct { Name string `json:"name,omitempty"` NameSpace string `json:"nameSpace,omitempty"` Type string `json:"type,omitempty"` Cluster string `json:"cluster,omitempty"` Status string `json:"status,omitempty"` Replicas string `json:"replicas,omitempty"` CPU string `json:"cpu,omitempty"` Memory string `json:"memory,omitempty"` Image string `json:"image,omitempty"` Storage []StorageInfo }
type GetOptions ¶
type InstanceInfo ¶
type InstanceInfo struct { Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty"` Cluster string `json:"cluster,omitempty"` Component string `json:"component,omitempty"` Status string `json:"status,omitempty"` Role string `json:"role,omitempty"` AccessMode string `json:"accessMode,omitempty"` AZ string `json:"az,omitempty"` Region string `json:"region,omitempty"` CPU string `json:"cpu,omitempty"` Memory string `json:"memory,omitempty"` Storage []StorageInfo Node string `json:"node,omitempty"` CreatedTime string `json:"age,omitempty"` }
func GetSimpleInstanceInfos ¶
func GetSimpleInstanceInfos(dynamic dynamic.Interface, name, namespace string) []*InstanceInfo
GetSimpleInstanceInfos return simple instance info that only contains instance name and role, the default instance should be the first element in the returned array.
func GetSimpleInstanceInfosForComponent ¶
func GetSimpleInstanceInfosForComponent(dynamic dynamic.Interface, name, componentName, namespace string) []*InstanceInfo
GetSimpleInstanceInfosForComponent return simple instance info that only contains instance name and role,
type ObjectsGetter ¶
type ObjectsGetter struct { Client clientset.Interface Dynamic dynamic.Interface Name string Namespace string GetOptions }
func (*ObjectsGetter) Get ¶
func (o *ObjectsGetter) Get() (*ClusterObjects, error)
Get all kubernetes objects belonging to the database cluster
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer prints cluster info
func NewPrinter ¶
func NewPrinter(out io.Writer, printType PrintType, opt *PrinterOptions) *Printer
func (*Printer) AddRow ¶
func (p *Printer) AddRow(objs *ClusterObjects)
func (*Printer) GetterOptions ¶
func (p *Printer) GetterOptions() GetOptions
type PrinterOptions ¶
type PrinterOptions struct {
ShowLabels bool
}