SaharaClient CLI 作为 OpenstackClient 插件¶
https://blueprints.launchpad.net/python-saharaclient/+spec/cli-as-openstackclient-plugin
本规范建议将 SaharaClient CLI 创建为 OpenstackClient 插件。
问题描述¶
目前 SaharaClient CLI 存在很多问题,并且没有达到预期的吸引力。它应该被重构或从头开始重建。
提议的变更¶
新的 SaharaClient CLI 将基于 OpenstackClient,它将不同项目 API 的命令集整合到一个统一的命令结构的外壳中。
OpenStackClient 为多个服务提供一流的支持。其他服务(包括数据处理服务)可以创建一个 OpenStackClient 插件。
建议的对象
插件
镜像
数据源
作业模板
作业
作业二进制文件
节点组模板
集群模板
cluster
建议的命令
所有命令都将具有前缀 dataprocessing。方括号 [] 中的参数是可选的,小于号和大于号 <> 中的参数是位置参数。
关于插件
plugin list [--long]
plugin show <plugin>
plugin configs get <plugin> <version> [--file <filepath>] # default name of
# the file is <plugin>
插件的详细描述包含太多信息,无法在屏幕上显示。它将被保存到文件中。如果提供了文件,数据将不会被重写。
对于 plugin list 的列:name, versions。对于 plugin list --long 的列:name, versions, title, description。对于 plugin show 的行:name, versions, title, description。
关于镜像
image list [--tags <tag(s)>] [--long]
image show <image>
image register <image> <username> [--description <description>]
image unregister <image(s)>
image tags set <image> <tag(s)>
image tags add <image> <tag(s)>
image tags remove <image> <tag(s)>
tags set 将用提供的标签替换当前的镜像标签。tags remove 将支持将 all 传递给 tags 参数以删除所有标签。
对于 image list 的列:name, id, username, tags。对于 image list --long 的列:name, id, username, tags, status, description。对于 plugin show 的行:name, id, username, tags, status, description。
关于数据源
data source create <name> <type> <url> [--password <password>]
[--username <user>] [--description <description>]
data source list [--type <type>] [--long]
data source show <datasource>
data source delete <datasource(s)>
data source update <datasource> [--name <name>] [--type <type>]
[--url <url>] [--password <password>] [--username <user>]
[--description <description>]
对于 data source list 的列:name, id, type。对于 data source list --long 的列:name, id, type, url, description。对于 data source show 的行:name, id, type, url, description。
在创建节点组模板、集群模板和集群时,新的 CLI 行为将与 Horizon 中的行为大致相同,但此外还将允许从 json 创建它们。它不允许将某些参数标记为成功创建所需的参数,但可以在帮助字符串中完成。
关于作业二进制文件:作业二进制文件和作业二进制文件内部将合并
job binary create <name> [--data <filepath>] [--description <description>]
[--url <url>] [--username <username>] [--password <password>]
job binary list [--name <name-regex>]
job binary show <job-binary>
job binary update <job-binary> [--description <description>] [--url <url>]
[--username <username>] [--password <password>]
job binary delete <job-binary(ies)>
job binary download <job-binary> [--file <filepath>]
对于 job binary list 的列:name, id。对于 job binary list --long 的列:name, id, url, description。对于 job binary show 的行:name, id, url, description。
关于节点组模板
node group template create [--name <name>] [--plugin <plugin>]
[--version <version>] [--flavor <flavor>] [--autoconfigs]
[--node-processes <node-processes>] [--floating-ip-pool <pool>]
[--proxy-gateway] [--configs <filepath>] [--json <filepath>]
# and other arguments except of "image-id"
node group template list [--plugin <plugin>] [--version <version>]
[--name <name-regex>] [--long]
node group template show <node-group-template>
node group template configs get <node-group-template> [--file <filepath>]
# default name of the file is <node-group-template>
node group template update <node-group-template> ... [--json <filepath>]
# and other arguments the same as in create command
node group template delete <node-group-template(s)>
对于 node group template list 的列:name, id, plugin, version。对于 node group template list --long 的列:name, id, plugin, version, node-processes, description。对于 node group template show 的行:name, id, plugin, version, node-processes, availability zone, flavor, is default, is proxy gateway, security groups 或 auto security group,如果节点组模板包含卷,则会出现以下行:volumes per node, volumes local to instance, volumes mount prefix, volumes type, volumes availability zone, volumes size, description。
关于集群模板
cluster template create [--name <name>] [--description <description>]
[--node-groups <ng1:1,ng2:2>] [--anti-affinity <node-processes>]
[--autoconfigs] [--configs <filepath>] [--json <filepath>]
cluster template list [--plugin <plugin>] [--version <version>]
[--name <name-regex>] [--long]
cluster template configs get <cluster-template> [--file <filepath>]
# default name of the file is <cluster-template>
cluster template show <cluster-template>
cluster template update <cluster-template> ... [--json <filepath>]
# and other arguments the same as in create command
cluster template delete <cluster-template(s)>
插件及其版本将从节点组模板中获取。
对于 cluster template list 的列:name, id, plugin, version。对于 cluster template list --long 的列:name, id, plugin, version, node groups (格式为 name:count), description。对于 cluster template show 的行:name, id, plugin, version, node groups, anti affinity, description。
关于集群
cluster create [--name <name>] [--cluster-template <cluster-template>]
[--description <description>][--user-keypair <keypair>]
[--image <image>] [--management-network <network>] [--json <filepath>]
[--wait]
cluster scale [] [--wait]
cluster list [--plugin <plugin>] [--version <version>]
[--name <name-regex>] [--long]
cluster show <cluster>
cluster delete <cluster(s)> [--wait]
如果设置了 [--wait] 属性,CLI 将等待命令完成。插件及其版本将从集群模板中获取。
对于 cluster list 的列:name, id, status。对于 cluster list --long 的列:name, id, url, description。对于 cluster show 的行:name, id, anti affinity, image id, plugin, version, is transient, status, status_description, user keypair id, description。
关于作业模板(作业)
job template create [--name <name>] [--type <type>]
[--main-binary(ies) <mains>] [--libs <libs>] [--description <descr>]
[--interface <filepath>] [--json <filepath>]
job template list [--type <type>] [--name <name-regex>] [--long]
job template show <job-template>
job template delete <job-template>
job template configs get <type> [--file <file>] # default file name <type>
job types list [--plugin <plugin>] [--version <version>] [--type <type>]
[--hints] [--file <filepath>] # default file name depends on provided
# args
job types list 和 job template configs get 的输出将被保存到文件中,就像 plugin configs get 一样。
对于 job template list 的列:name, id, type。对于 job template list --long 的列:name, id, type, libs(ids), mains(ids), description。对于 job template show 的行:name, id, type, libs(ids), mains(ids), description。
关于作业(作业执行)
job execute [--job-template <job-template>] [--cluster <cluster>]
[--input <data-source>] [--output <data-source>] [--args <arg(s)>]
[--params <name1:value1,name2:value2>]
[--configs <name1:value1,name2:value2>]
[--interface <filepath>] [--json <filepath>] [--wait]
job list [--long]
job show <job>
job delete <job(s)> [--wait]
对于 job list 的列:id, cluster id, job id, status。对于 job list --long 的列:id, cluster id, job id, status, start time, end time。对于 job show 的行:id, cluster id, job id, status, start time, end time, input id, output id
如果设置了 [--wait] 属性,CLI 将等待命令完成。
此外,还有许多由 OpenstackClient 提供的参数,具体取决于所选命令插件。例如,plugin list 命令的帮助输出
(openstack) help dataprocessing plugin list
usage: dataprocessing plugin list [-h] [-f {csv,html,json,table,value,
yaml}]
[-c COLUMN] [--max-width <integer>]
[--quote {all,minimal,none,nonnumeric}]
[--long]
Lists plugins
optional arguments:
-h, --help show this help message and exit
--long List additional fields in output
output formatters:
output formatter options
-f {csv,html,json,table,value,yaml}, --format {csv,html,json,table,value,
yaml}
the output format, defaults to table
-c COLUMN, --column COLUMN
specify the column(s) to include, can be repeated
table formatter:
--max-width <integer>
Maximum display width, 0 to disable
CSV Formatter:
--quote {all,minimal,none,nonnumeric}
when to include quotes, defaults to nonnumeric
替代方案¶
当前的 CLI 代码可以重构。
数据模型影响¶
无
REST API 影响¶
无
其他最终用户影响¶
无
部署者影响¶
无
开发者影响¶
无
Sahara-image-elements impact¶
无
Sahara-dashboard / Horizon 影响¶
无
实现¶
负责人¶
- 主要负责人
apavlov-n
工作项¶
为 SaharaClient 创建 OpenstackClient 插件
为“建议的更改”部分中描述的每个对象实现命令
使用相应的更改更新文档
旧的 CLI 将在一段时间后被弃用并删除
依赖项¶
无
测试¶
每个命令都将提供单元测试。
文档影响¶
将编写关于新 CLI 用法的文档。