client

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PodClient

type PodClient struct {
	core.JDCloudClient
}

func NewPodClient

func NewPodClient(credential *core.Credential) *PodClient

func (*PodClient) AssociateElasticIp

func (c *PodClient) AssociateElasticIp(request *pod.AssociateElasticIpRequest) (*pod.AssociateElasticIpResponse, error)
pod 绑定弹性公网 IP,绑定的是主网卡、主内网IP对应的弹性IP. <br>

一个 pod 只能绑定一个弹性公网 IP(主网卡),若主网卡已存在弹性公网IP,会返回错误。<br> 如果是黑名单中的用户,会返回错误。

func (*PodClient) Attach

func (c *PodClient) Attach(request *pod.AttachRequest) (*pod.AttachResponse, error)

查询单个容器日志

func (*PodClient) CheckPodName

func (c *PodClient) CheckPodName(request *pod.CheckPodNameRequest) (*pod.CheckPodNameResponse, error)

podName 是否符合命名规范,以及查询指定 podName 区域内是否已经存在。

func (*PodClient) CreatePods

func (c *PodClient) CreatePods(request *pod.CreatePodsRequest) (*pod.CreatePodsResponse, error)
  • 创建pod需要通过实名认证

- hostname规范

  • 支持两种方式:以标签方式书写或以完整主机名方式书写
  • 标签规范
  • 0-9,a-z(不分大小写)和-(减号),其他的都是无效的字符串
  • 不能以减号开始,也不能以减号结尾
  • 最小1个字符,最大63个字符
  • 完整的主机名由一系列标签与点连接组成
  • 标签与标签之间使用“.”(点)进行连接
  • 不能以“.”(点)开始,也不能以“.”(点)结尾
  • 整个主机名(包括标签以及分隔点“.”)最多有63个ASCII字符
  • 正则:`^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])(.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]))*$`

- 网络配置

  • 指定主网卡配置信息
  • 必须指定subnetId
  • 可以指定elasticIp规格来约束创建的弹性IP,带宽取值范围[1-100]Mbps,步进1Mbps
  • 可以指定网卡的主IP(primaryIpAddress)和辅助IP(secondaryIpAddresses),此时maxCount只能为1
  • 可以设置网卡的自动删除autoDelete属性,指明是否删除实例时自动删除网卡
  • 安全组securityGroup需与子网Subnet在同一个私有网络VPC内
  • 一个 pod 创建时必须指定一个安全组,至多指定5个安全组
  • 主网卡deviceIndex设置为1

- 存储

  • volume分为root volume和data volume,root volume的挂载目录是/,data volume的挂载目录可以随意指定
  • volume的底层存储介质当前只支持cloud类别,也就是云硬盘
  • root volume
  • root volume只能是cloud类别
  • 云硬盘类型可以选择ssd、premium-hdd
  • 磁盘大小
  • ssd:范围[10,100]GB,步长为10G
  • premium-hdd:范围[10,100]GB,步长为10G
  • 自动删除
  • 默认自动删除
  • 可以选择已存在的云硬盘
  • data volume
  • data volume当前只能选择cloud类别
  • 云硬盘类型可以选择ssd、premium-hdd
  • 磁盘大小
  • ssd:范围[20,1000]GB,步长为10G
  • premium-hdd:范围[20,3000]GB,步长为10G
  • 自动删除
  • 默认自动删除
  • 可以选择已存在的云硬盘
  • 可以从快照创建磁盘

- pod 容器日志

  • default:默认在本地分配10MB的存储空间,自动rotate

- 其他

  • 创建完成后,pod 状态为running
  • maxCount为最大努力,不保证一定能达到maxCount

func (*PodClient) CreateSecret

func (c *PodClient) CreateSecret(request *pod.CreateSecretRequest) (*pod.CreateSecretResponse, error)

创建一个 secret,用于存放镜像仓库机密相关信息。

func (*PodClient) DecribeContainer

func (c *PodClient) DecribeContainer(request *pod.DecribeContainerRequest) (*pod.DecribeContainerResponse, error)

获取 pod 中某个容器的详情

func (*PodClient) DeletePod

func (c *PodClient) DeletePod(request *pod.DeletePodRequest) (*pod.DeletePodResponse, error)
pod 状态必须为 stopped、running 或 error状态。 <br>

按量付费的实例,如不主动删除将一直运行,不再使用的实例,可通过本接口主动停用。<br> 只能支持主动删除按量计费类型的实例。包年包月过期的 pod 也可以删除,其它的情况还请发工单系统。计费状态异常的容器无法删除。

func (*PodClient) DeleteSecret

func (c *PodClient) DeleteSecret(request *pod.DeleteSecretRequest) (*pod.DeleteSecretResponse, error)

删除单个 secret

func (*PodClient) DescribePod

func (c *PodClient) DescribePod(request *pod.DescribePodRequest) (*pod.DescribePodResponse, error)

查询一个 pod 的详细信息

func (*PodClient) DescribePods

func (c *PodClient) DescribePods(request *pod.DescribePodsRequest) (*pod.DescribePodsResponse, error)
批量查询 pod 的详细信息<br>

此接口支持分页查询,默认每页20条。

func (*PodClient) DescribeQuota

func (c *PodClient) DescribeQuota(request *pod.DescribeQuotaRequest) (*pod.DescribeQuotaResponse, error)

查询资源的配额,支持:原生容器 pod 和 secret.

func (*PodClient) DescribeSecret

func (c *PodClient) DescribeSecret(request *pod.DescribeSecretRequest) (*pod.DescribeSecretResponse, error)

查询单个 secret 详情

func (*PodClient) DescribeSecrets

func (c *PodClient) DescribeSecrets(request *pod.DescribeSecretsRequest) (*pod.DescribeSecretsResponse, error)
查询 secret 列表。<br>

此接口支持分页查询,默认每页20条。

func (*PodClient) DisassociateElasticIp

func (c *PodClient) DisassociateElasticIp(request *pod.DisassociateElasticIpRequest) (*pod.DisassociateElasticIpResponse, error)

pod 解绑公网 IP,解绑的是主网卡、主内网 IP 对应的弹性 IP.

func (*PodClient) ExecCreate

func (c *PodClient) ExecCreate(request *pod.ExecCreateRequest) (*pod.ExecCreateResponse, error)

创建 exec

func (*PodClient) ExecGetExitCode

func (c *PodClient) ExecGetExitCode(request *pod.ExecGetExitCodeRequest) (*pod.ExecGetExitCodeResponse, error)

获取exec退出码

func (*PodClient) ExecStart

func (c *PodClient) ExecStart(request *pod.ExecStartRequest) (*pod.ExecStartResponse, error)

执行exec,此接口需要升级Http协议到WebSocket

func (*PodClient) GetContainerLogs

func (c *PodClient) GetContainerLogs(request *pod.GetContainerLogsRequest) (*pod.GetContainerLogsResponse, error)

查询单个容器日志

func (*PodClient) ModifyPodAttribute

func (c *PodClient) ModifyPodAttribute(request *pod.ModifyPodAttributeRequest) (*pod.ModifyPodAttributeResponse, error)

修改 pod 的 名称 和 描述。

func (*PodClient) ResizeTTY

func (c *PodClient) ResizeTTY(request *pod.ResizeTTYRequest) (*pod.ResizeTTYResponse, error)

设置TTY大小

func (*PodClient) SetConfig

func (c *PodClient) SetConfig(config *core.Config)

func (*PodClient) SetLogger

func (c *PodClient) SetLogger(logger core.Logger)

func (*PodClient) StartPod

func (c *PodClient) StartPod(request *pod.StartPodRequest) (*pod.StartPodResponse, error)
启动处于关闭状态的单个 pod ,处在任务执行中的 pod 无法启动。<br>

pod 实例或其绑定的云盘已欠费时,容器将无法正常启动。<br>

func (*PodClient) StopPod

func (c *PodClient) StopPod(request *pod.StopPodRequest) (*pod.StopPodResponse, error)

停止处于运行状态的单个实例,处于任务执行中的 pod 无法启动。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL