Documentation ¶
Overview ¶
Package k8sclient get k8s client
Index ¶
- Constants
- Variables
- func DeleteBcsLogConfig(ctx context.Context, clusterID, namespace, name string) error
- func GetBCSConf() *config.BCSConf
- func GetBcsLogConfig(ctx context.Context, clusterID, namespace, name string) (*logv1.BcsLogConfig, error)
- func GetClusterNetClientByClusterId(clusterId string) (*clusternet.Clientset, error)
- func GetClusterNodeList(ctx context.Context, clusterId string, excludeMasterRole bool) ([]v1.Node, error)
- func GetDynamicClientByClusterId(clusterId string) (dynamic.Interface, error)
- func GetK8SClientByClusterId(clusterId string) (*kubernetes.Clientset, error)
- func GetK8SVersion(ctx context.Context, clusterId string) (*version.Version, error)
- func GetKubebkbcsClientByClusterID(clusterID string) (*bcsclientset.Clientset, error)
- func GetManagedClusterList(ctx context.Context, clusterID string) ([]string, error)
- func GetMasterNodeList(ctx context.Context, clusterID string) ([]string, []string, error)
- func GetNamespaces(ctx context.Context, clusterID string) ([]string, error)
- func GetNodeByName(ctx context.Context, clusterId, name string) ([]string, error)
- func GetNodeCRVersionByName(ctx context.Context, clusterId, name string) (string, error)
- func GetNodeInfo(ctx context.Context, clusterId, nodeName string) (*v1.Node, error)
- func GetNodeList(ctx context.Context, clusterID string, excludeMasterRole, filter bool) ([]string, []string, error)
- func GetPodEntryValue(ctx context.Context, clusterID, namespace, podname, key string) (string, error)
- func GetPodLogByte(ctx context.Context, clusterId, namespace, podname string, opt *LogQuery) ([]byte, error)
- func GetPodLogStream(ctx context.Context, clusterId, namespace, podname string, opt *LogQuery) (<-chan *Log, error)
- func K8SLessThan(ctx context.Context, clusterId, ver string) bool
- func ListBcsLogConfig(ctx context.Context, clusterID string) ([]logv1.BcsLogConfig, error)
- type Container
- type Item
- type Log
- type LogQuery
- type LogWithPreviousLink
- type Metadata
- type Set
- type Workload
Constants ¶
const ( // Containers ... Containers = "Containers" // InitContainers ... InitContainers = "InitContainers" )
Variables ¶
var ( // 最多返回 10W 条日志 MAX_TAIL_LINES = int64(100 * 1000) MAX_LIMIT_BYTES = 30 * 1024 * 1024 // 最多 30M 数据 // 默认返回 100 条日志 DEFAULT_TAIL_LINES = int64(100) )
需要取指针, 不能用常量
Functions ¶
func DeleteBcsLogConfig ¶
DeleteBcsLogConfig delete bcslogconfigs
func GetBcsLogConfig ¶
func GetBcsLogConfig(ctx context.Context, clusterID, namespace, name string) (*logv1.BcsLogConfig, error)
GetBcsLogConfig get bcslogconfigs
func GetClusterNetClientByClusterId ¶
func GetClusterNetClientByClusterId(clusterId string) (*clusternet.Clientset, error)
GetClusterNetClientByClusterId 通过集群 ID 获取 clusternet client 对象
func GetClusterNodeList ¶
func GetClusterNodeList(ctx context.Context, clusterId string, excludeMasterRole bool) ([]v1.Node, error)
GetClusterNodeList 获取集群中节点列表
func GetDynamicClientByClusterId ¶
GetDynamicClientByClusterId 通过集群 ID 获取 k8s dynamic client 对象
func GetK8SClientByClusterId ¶
func GetK8SClientByClusterId(clusterId string) (*kubernetes.Clientset, error)
GetK8SClientByClusterId 通过集群 ID 获取 k8s client 对象
func GetK8SVersion ¶
GetK8SVersion 获取 k8s 版本
func GetKubebkbcsClientByClusterID ¶
func GetKubebkbcsClientByClusterID(clusterID string) (*bcsclientset.Clientset, error)
GetKubebkbcsClientByClusterID 通过集群 ID 获取 kube bcs 对象
func GetManagedClusterList ¶
GetManagedClusterList 获取联邦集群子集群列表
func GetMasterNodeList ¶
GetMasterNodeList 获取集群节点列表
func GetNamespaces ¶
GetNamespaces 获取集群的namespace列表
func GetNodeByName ¶
GetNodeByName 获取集群节点信息
func GetNodeCRVersionByName ¶
GetNodeCRVersionByName 通过节点名称获取容器运行时版本
func GetNodeInfo ¶
GetNodeInfo 获取节点信息 返回相应的节点对象
func GetNodeList ¶
func GetNodeList(ctx context.Context, clusterID string, excludeMasterRole, filter bool) ([]string, []string, error)
GetNodeList 获取集群节点列表
func GetPodEntryValue ¶
func GetPodEntryValue(ctx context.Context, clusterID, namespace, podname, key string) (string, error)
GetPodEntryValue :
func GetPodLogByte ¶
func GetPodLogByte(ctx context.Context, clusterId, namespace, podname string, opt *LogQuery) ([]byte, error)
GetPodLogByte 获取日志
func GetPodLogStream ¶
func GetPodLogStream(ctx context.Context, clusterId, namespace, podname string, opt *LogQuery) (<-chan *Log, error)
GetPodLogStream 获取日志流
func K8SLessThan ¶
K8SLessThan 对比版本, 如果异常, 按向下兼容
func ListBcsLogConfig ¶
ListBcsLogConfig list bcslogconfigs
Types ¶
type LogQuery ¶
type LogQuery struct { ContainerName string `form:"container_name" binding:"required"` // 必填参数 Previous bool `form:"previous"` StartedAt string `form:"started_at"` FinishedAt string `form:"finished_at"` TailLines int64 `form:"-"` LimitBytes int64 `form:"-"` // contains filtered or unexported fields }
LogQuery 日志查询参数, 精简后的 v1.PodLogOptions
type LogWithPreviousLink ¶
type LogWithPreviousLink struct { Logs []*Log `json:"logs"` Previous string `json:"previous"` // 向上翻页链接 }
LogWithPreviousLink :
func GetPodLog ¶
func GetPodLog(ctx context.Context, clusterId, namespace, podname string, opt *LogQuery) (*LogWithPreviousLink, error)
GetPodLog 获取格式的日志列表
func (*LogWithPreviousLink) MakePreviousLink ¶
func (l *LogWithPreviousLink) MakePreviousLink(projectId, clusterId, namespace, podname string, opt *LogQuery) error
MakePreviousLink 计算向上翻页链接
type Metadata ¶
type Metadata struct { Name string `json:"name"` Labels Set `json:"labels"` Annotations Set `json:"annotations"` }
Metadata :
type Set ¶
Set is a map of label:value. It implements Labels. https://github.com/kubernetes/apimachinery/blob/master/pkg/labels/labels.go