Documentation ¶
Index ¶
- func ExtractDeploymentRevision(annotations map[string]string) (int, error)
- type ClusterInst
- type ClusterInstances
- func (c *ClusterInstances) AllClusters() map[string]*ClusterInst
- func (c *ClusterInstances) DefaultCluster() *ClusterInst
- func (c *ClusterInstances) GetClusterById(id string) *ClusterInst
- func (c *ClusterInstances) RegisterByConfig(config *rest.Config) (*Kubectl, error)
- func (c *ClusterInstances) RegisterByConfigWithID(config *rest.Config, id string) (*Kubectl, error)
- func (c *ClusterInstances) RegisterByPath(path string) (*Kubectl, error)
- func (c *ClusterInstances) RegisterByPathWithID(path string, id string) (*Kubectl, error)
- func (c *ClusterInstances) RegisterInCluster() (*Kubectl, error)
- func (c *ClusterInstances) RemoveClusterById(id string)
- func (c *ClusterInstances) SetRegisterCallbackFunc(callback func(cluster *ClusterInst) func())
- func (c *ClusterInstances) Show()
- type Condition
- type ContainerInfo
- type Env
- type FileInfo
- type Filter
- type Kubectl
- func (k *Kubectl) AllNamespace() *Kubectl
- func (k *Kubectl) Applier() *applier
- func (k *Kubectl) CRD(group string, version string, kind string) *Kubectl
- func (k *Kubectl) Callback() *callbacks
- func (k *Kubectl) Client() *kubernetes.Clientset
- func (k *Kubectl) ClusterCache() *ristretto.Cache[string, any]
- func (k *Kubectl) Command(command string, args ...string) *Kubectldeprecated
- func (k *Kubectl) ContainerName(c string) *Kubectl
- func (k *Kubectl) Create(dest interface{}) *Kubectl
- func (k *Kubectl) Ctl() *ctl
- func (k *Kubectl) Delete() *Kubectl
- func (k *Kubectl) Describe(dest interface{}) *Kubectl
- func (k *Kubectl) DynamicClient() *dynamic.DynamicClient
- func (k *Kubectl) Execute(dest interface{}) *Kubectl
- func (k *Kubectl) FillTotalCount(total *int64) *Kubectl
- func (k *Kubectl) ForceDelete() *Kubectl
- func (k *Kubectl) From(tableName string) *Kubectl
- func (k *Kubectl) GVK(group string, version string, kind string) *Kubectl
- func (k *Kubectl) Get(dest interface{}) *Kubectl
- func (k *Kubectl) GetLogs(requestPtr interface{}, opt *v1.PodLogOptions) *Kubectldeprecated
- func (k *Kubectl) Limit(limit int) *Kubectl
- func (k *Kubectl) List(dest interface{}, opt ...metav1.ListOptions) *Kubectl
- func (k *Kubectl) Name(name string) *Kubectl
- func (k *Kubectl) Namespace(namespaces ...string) *Kubectl
- func (k *Kubectl) Offset(offset int) *Kubectl
- func (k *Kubectl) Order(order string) *Kubectl
- func (k *Kubectl) Patch(dest interface{}, pt types.PatchType, data string) *Kubectl
- func (k *Kubectl) Poder() *poddeprecated
- func (k *Kubectl) RemoveManagedFields() *Kubectl
- func (k *Kubectl) Resource(obj runtime.Object) *Kubectl
- func (k *Kubectl) RestConfig() *rest.Config
- func (k *Kubectl) Skip(skip int) *Kubectl
- func (k *Kubectl) Sql(sql string, values ...interface{}) *Kubectl
- func (k *Kubectl) Status() *status
- func (k *Kubectl) Stdin(reader io.Reader) *Kubectldeprecated
- func (k *Kubectl) Tools() *tools
- func (k *Kubectl) Update(dest interface{}) *Kubectl
- func (k *Kubectl) Watch(dest interface{}, opt ...metav1.ListOptions) *Kubectl
- func (k *Kubectl) Where(condition string, values ...interface{}) *Kubectl
- func (k *Kubectl) WithCache(ttl time.Duration) *Kubectl
- func (k *Kubectl) WithContext(ctx context.Context) *Kubectl
- func (k *Kubectl) WithFieldSelector(fieldSelector string) *Kubectl
- func (k *Kubectl) WithLabelSelector(labelSelector string) *Kubectl
- type PodMount
- type ResourceUsageFraction
- type ResourceUsageResult
- type ResourceUsageRow
- type RolloutHistory
- type SelectedNode
- type Statement
- func (s *Statement) ParseFromRuntimeObj(obj runtime.Object) *Statement
- func (s *Statement) ParseGVKFromRuntimeObj(obj runtime.Object) *Statement
- func (s *Statement) ParseGVKs(gvks []schema.GroupVersionKind, versions ...string) *Statement
- func (s *Statement) ParseNsNameFromRuntimeObj(obj runtime.Object) *Statement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClusterInst ¶ added in v0.1.29
type ClusterInst struct { ID string // 集群ID Kubectl *Kubectl // kom Client *kubernetes.Clientset // kubernetes 客户端 Config *rest.Config // rest config DynamicClient *dynamic.DynamicClient // 动态客户端 Cache *ristretto.Cache[string, any] // contains filtered or unexported fields }
ClusterInst 单一集群实例
type ClusterInstances ¶ added in v0.0.10
type ClusterInstances struct {
// contains filtered or unexported fields
}
ClusterInstances 集群实例管理器
func (*ClusterInstances) AllClusters ¶ added in v0.0.10
func (c *ClusterInstances) AllClusters() map[string]*ClusterInst
AllClusters 返回所有集群实例
func (*ClusterInstances) DefaultCluster ¶ added in v0.0.10
func (c *ClusterInstances) DefaultCluster() *ClusterInst
DefaultCluster 返回一个默认的 ClusterInst 实例。 当 clusters 列表为空时,返回 nil。 首先尝试返回 ID 为 "InCluster" 的实例,如果不存在, 则尝试返回 ID 为 "default" 的实例。 如果上述两个实例都不存在,则返回 clusters 列表中的任意一个实例。
func (*ClusterInstances) GetClusterById ¶ added in v0.0.10
func (c *ClusterInstances) GetClusterById(id string) *ClusterInst
GetClusterById 根据集群ID获取集群实例
func (*ClusterInstances) RegisterByConfig ¶ added in v0.0.10
func (c *ClusterInstances) RegisterByConfig(config *rest.Config) (*Kubectl, error)
RegisterByConfig 注册集群
func (*ClusterInstances) RegisterByConfigWithID ¶ added in v0.0.10
RegisterByConfigWithID 注册集群
func (*ClusterInstances) RegisterByPath ¶ added in v0.0.10
func (c *ClusterInstances) RegisterByPath(path string) (*Kubectl, error)
RegisterByPath 通过kubeconfig文件路径注册集群
func (*ClusterInstances) RegisterByPathWithID ¶ added in v0.0.10
func (c *ClusterInstances) RegisterByPathWithID(path string, id string) (*Kubectl, error)
RegisterByPathWithID 通过kubeconfig文件路径注册集群
func (*ClusterInstances) RegisterInCluster ¶ added in v0.0.10
func (c *ClusterInstances) RegisterInCluster() (*Kubectl, error)
RegisterInCluster 注册InCluster集群
func (*ClusterInstances) RemoveClusterById ¶ added in v0.1.5
func (c *ClusterInstances) RemoveClusterById(id string)
RemoveClusterById 删除集群
func (*ClusterInstances) SetRegisterCallbackFunc ¶ added in v0.0.10
func (c *ClusterInstances) SetRegisterCallbackFunc(callback func(cluster *ClusterInst) func())
SetRegisterCallbackFunc 设置回调注册函数
type ContainerInfo ¶ added in v0.1.51
type Env ¶ added in v0.1.33
type Env struct { ContainerName string `json:"containerName,omitempty"` EnvName string `json:"envName,omitempty"` EnvValue string `json:"envValue,omitempty"` }
Env 每行三个值,容器名称、ENV名称、ENV值
type FileInfo ¶ added in v0.0.21
type FileInfo struct { Name string `json:"name"` Type string `json:"type"` // file or directory Permissions string `json:"permissions"` Owner string `json:"owner"` Group string `json:"group"` Size int64 `json:"size"` ModTime string `json:"modTime"` Path string `json:"path"` // 存储路径 IsDir bool `json:"isDir"` // 指示是否 }
FileInfo 文件节点结构
type Filter ¶ added in v0.1.0
type Filter struct { Columns []string `json:"columns,omitempty"` Conditions []Condition `json:"condition,omitempty"` // xx=? Order string `json:"order,omitempty"` Limit int `json:"limit,omitempty"` Offset int `json:"offset,omitempty"` Sql string `json:"sql,omitempty"` // 原始sql Parsed bool `json:"parsed,omitempty"` // 是否解析过 From string `json:"from,omitempty"` // From TableName }
type Kubectl ¶ added in v0.0.10
type Kubectl struct { ID string // cluster id Statement *Statement // statement Error error // 存放ERROR信息 // contains filtered or unexported fields }
func (*Kubectl) AllNamespace ¶ added in v0.0.30
func (*Kubectl) Client ¶ added in v0.0.10
func (k *Kubectl) Client() *kubernetes.Clientset
func (*Kubectl) ClusterCache ¶ added in v0.1.18
func (*Kubectl) ContainerName ¶ added in v0.0.15
ContainerName Deprecated: use Ctl().Pod().ContainerName() instead.
func (*Kubectl) DynamicClient ¶ added in v0.0.10
func (k *Kubectl) DynamicClient() *dynamic.DynamicClient
func (*Kubectl) Execute ¶ added in v0.0.15
Execute 请确保dest 是一个指向字节切片的指针。定义var s []byte 使用&s Deprecated: use Ctl().Pod().Command().Execute() instead.
func (*Kubectl) FillTotalCount ¶ added in v0.1.22
func (*Kubectl) ForceDelete ¶ added in v0.1.44
func (*Kubectl) GetLogs
deprecated
added in
v0.0.15
func (k *Kubectl) GetLogs(requestPtr interface{}, opt *v1.PodLogOptions) *Kubectl
Deprecated: use Ctl().Pod().GetLogs() instead.
func (*Kubectl) List ¶ added in v0.0.10
func (k *Kubectl) List(dest interface{}, opt ...metav1.ListOptions) *Kubectl
func (*Kubectl) RemoveManagedFields ¶ added in v0.0.32
func (*Kubectl) RestConfig ¶ added in v0.0.10
func (*Kubectl) Sql ¶ added in v0.1.0
Sql TODO Insert Update Delete
已支持Select 解析sql为函数调用,实现支持原生sql语句
select * from pod where pod.name='?', 'abc'
func (*Kubectl) Watch ¶ added in v0.0.22
func (k *Kubectl) Watch(dest interface{}, opt ...metav1.ListOptions) *Kubectl
func (*Kubectl) WithContext ¶ added in v0.0.10
func (*Kubectl) WithFieldSelector ¶ added in v0.0.24
func (*Kubectl) WithLabelSelector ¶ added in v0.0.24
type PodMount ¶ added in v0.1.35
type PodMount struct { Name string `json:"name",omitempty` MountPath string `json:"mountPath",omitempty` SubPath string `json:"subPath",omitempty` Mode *int32 `json:"mode",omitempty` ReadOnly bool `json:"readOnly",omitempty` }
PodMount 是Pod的挂载信息 挂载的类型有:configMap、secret
type ResourceUsageFraction ¶ added in v0.1.9
type ResourceUsageFraction struct { RequestFraction float64 `json:"requestFraction"` // 请求使用占比(百分比)占总可分配值的比例 LimitFraction float64 `json:"limitFraction"` // 限制使用占比(百分比)占总可分配值的比例 }
ResourceUsageFraction 定义单种资源的使用占比
type ResourceUsageResult ¶ added in v0.1.9
type ResourceUsageResult struct { Requests map[corev1.ResourceName]resource.Quantity `json:"requests"` // 请求用量 Limits map[corev1.ResourceName]resource.Quantity `json:"limits"` // 限制用量 Allocatable map[corev1.ResourceName]resource.Quantity `json:"allocatable"` // 节点可分配的实时值 UsageFractions map[corev1.ResourceName]ResourceUsageFraction `json:"usageFractions"` // 使用占比 }
ResourceUsageResult 定义资源使用情况的结构体 存放Pod、Node 的资源使用情况
type ResourceUsageRow ¶ added in v0.1.11
type ResourceUsageRow struct { ResourceType string `json:"resourceType"` Total string `json:"total"` Request string `json:"request"` RequestFraction string `json:"requestFraction"` Limit string `json:"limit"` LimitFraction string `json:"limitFraction"` }
ResourceUsageRow 临时结构体,用于存储每一行数据
type RolloutHistory ¶ added in v0.0.31
type RolloutHistory struct { Kind string `json:"kind,omitempty"` Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty"` Revision string `json:"revision,omitempty"` CreationTimestamp metav1.Time `json:"creationTimestamp"` GVK schema.GroupVersionKind `json:"gvk,omitempty"` ExtraInfo map[string]string `json:"extraInfo,omitempty"` Containers []ContainerInfo `json:"containers,omitempty"` }
type SelectedNode ¶ added in v0.1.37
type Statement ¶
type Statement struct { *Kubectl `json:"Kubectl,omitempty"` // 基础配置 RowsAffected int64 `json:"rowsAffected,omitempty"` // 返回受影响的行数 TotalCount *int64 `json:"totalCount,omitempty"` // 返回查询总数,分页使用。只在List查询列表方法中生效。 AllNamespace bool `json:"allNamespace,omitempty"` // 所有名空间 Namespace string `json:"namespace,omitempty"` // 资源所属命名空间 NamespaceList []string `json:"namespace_list,omitempty"` // 多个命名空间,查询列表专用,只有查询列表时会出现跨命名空间查询的情况。在使用时,如果是所有命名空间,就不用NamespaceList Name string `json:"name,omitempty"` // 资源名称 GVR schema.GroupVersionResource `json:"GVR"` // 资源类型 GVK schema.GroupVersionKind `json:"GVK"` // 资源类型 Namespaced bool `json:"namespaced,omitempty"` // 是否是命名空间资源 ListOptions []metav1.ListOptions `json:"listOptions,omitempty"` // 列表查询参数,作为可变参数使用,默认只取第一个,也只使用一个 Context context.Context `json:"-"` // 上下文 Dest interface{} `json:"dest,omitempty"` // 返回结果存放对象,一般为结构体指针 PatchType types.PatchType `json:"patchType,omitempty"` // PATCH类型 PatchData string `json:"patchData,omitempty"` // PATCH数据 RemoveManagedFields bool `json:"removeManagedFields,omitempty"` // 是否移除管理字段 ContainerName string `json:"containerName,omitempty"` // 容器名称,执行获取容器内日志等操作使用 Command string `json:"command,omitempty"` // 容器内执行命令,包括ls、cat以及用户输入的命令 Args []string `json:"args,omitempty"` // 容器内执行命令参数 PodLogOptions *v1.PodLogOptions `json:"-" ` // 获取容器日志使用 Stdin io.Reader `json:"-" ` // 设置输入 Filter Filter `json:"filter,omitempty"` StdoutCallback func(data []byte) error `json:"-"` StderrCallback func(data []byte) error `json:"-"` CacheTTL time.Duration `json:"cacheTTL,omitempty"` // 设置缓存时间 ForceDelete bool `json:"forceDelete,omitempty"` // 强制删除标志 // contains filtered or unexported fields }
func (*Statement) ParseFromRuntimeObj ¶
func (*Statement) ParseGVKFromRuntimeObj ¶
Source Files ¶
- applier.go
- callback.go
- cluster.go
- ctl.go
- ctl_annotate.go
- ctl_cronjob.go
- ctl_deploy.go
- ctl_ds.go
- ctl_label.go
- ctl_node.go
- ctl_pod.go
- ctl_pod_file.go
- ctl_pod_link.go
- ctl_pod_usage.go
- ctl_rc.go
- ctl_rollout.go
- ctl_rs.go
- ctl_scale.go
- ctl_sts.go
- dynamic.go
- kubectl.go
- sql.go
- sql_builder.go
- sql_parse.go
- statement.go
- status.go
- struct.go
- tools.go