github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/pkg/cli/cluster/types.go (about)

     1  /*
     2  Copyright (C) 2022-2023 ApeCloud Co., Ltd
     3  
     4  This file is part of KubeBlocks project
     5  
     6  This program is free software: you can redistribute it and/or modify
     7  it under the terms of the GNU Affero General Public License as published by
     8  the Free Software Foundation, either version 3 of the License, or
     9  (at your option) any later version.
    10  
    11  This program is distributed in the hope that it will be useful
    12  but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  GNU Affero General Public License for more details.
    15  
    16  You should have received a copy of the GNU Affero General Public License
    17  along with this program.  If not, see <http://www.gnu.org/licenses/>.
    18  */
    19  
    20  package cluster
    21  
    22  import (
    23  	corev1 "k8s.io/api/core/v1"
    24  
    25  	appsv1alpha1 "github.com/1aal/kubeblocks/apis/apps/v1alpha1"
    26  	dpv1alpha1 "github.com/1aal/kubeblocks/apis/dataprotection/v1alpha1"
    27  )
    28  
    29  type ClusterObjects struct {
    30  	Cluster        *appsv1alpha1.Cluster
    31  	ClusterDef     *appsv1alpha1.ClusterDefinition
    32  	ClusterVersion *appsv1alpha1.ClusterVersion
    33  
    34  	Pods       *corev1.PodList
    35  	Services   *corev1.ServiceList
    36  	Secrets    *corev1.SecretList
    37  	PVCs       *corev1.PersistentVolumeClaimList
    38  	Nodes      []*corev1.Node
    39  	ConfigMaps *corev1.ConfigMapList
    40  	Events     *corev1.EventList
    41  
    42  	BackupPolicies  []dpv1alpha1.BackupPolicy
    43  	BackupSchedules []dpv1alpha1.BackupSchedule
    44  	Backups         []dpv1alpha1.Backup
    45  }
    46  
    47  type ClusterInfo struct {
    48  	Name              string `json:"name,omitempty"`
    49  	Namespace         string `json:"namespace,omitempty"`
    50  	ClusterVersion    string `json:"clusterVersion,omitempty"`
    51  	TerminationPolicy string `json:"terminationPolicy,omitempty"`
    52  	ClusterDefinition string `json:"clusterDefinition,omitempty"`
    53  	Status            string `json:"status,omitempty"`
    54  	InternalEP        string `json:"internalEP,omitempty"`
    55  	ExternalEP        string `json:"externalEP,omitempty"`
    56  	CreatedTime       string `json:"age,omitempty"`
    57  	Labels            string `json:"labels,omitempty"`
    58  }
    59  
    60  type ComponentInfo struct {
    61  	Name      string `json:"name,omitempty"`
    62  	NameSpace string `json:"nameSpace,omitempty"`
    63  	Type      string `json:"type,omitempty"`
    64  	Cluster   string `json:"cluster,omitempty"`
    65  	Status    string `json:"status,omitempty"`
    66  	Replicas  string `json:"replicas,omitempty"`
    67  	CPU       string `json:"cpu,omitempty"`
    68  	Memory    string `json:"memory,omitempty"`
    69  	Image     string `json:"image,omitempty"`
    70  	Storage   []StorageInfo
    71  }
    72  
    73  type StorageInfo struct {
    74  	Name         string
    75  	Size         string
    76  	StorageClass string
    77  	AccessMode   string
    78  }
    79  
    80  type InstanceInfo struct {
    81  	Name        string `json:"name,omitempty"`
    82  	Namespace   string `json:"namespace,omitempty"`
    83  	Cluster     string `json:"cluster,omitempty"`
    84  	Component   string `json:"component,omitempty"`
    85  	Status      string `json:"status,omitempty"`
    86  	Role        string `json:"role,omitempty"`
    87  	AccessMode  string `json:"accessMode,omitempty"`
    88  	AZ          string `json:"az,omitempty"`
    89  	Region      string `json:"region,omitempty"`
    90  	CPU         string `json:"cpu,omitempty"`
    91  	Memory      string `json:"memory,omitempty"`
    92  	Storage     []StorageInfo
    93  	Node        string `json:"node,omitempty"`
    94  	CreatedTime string `json:"age,omitempty"`
    95  }