创建、生效配置并部署组件 - CreateComponentWithConfiguration
功能介绍
创建、生效配置并部署组件。
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。
授权信息
账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权,具体权限要求请参见权限和授权项。
- 如果使用身份策略授权,当前API调用无需身份策略权限。
URI
POST /v1/{project_id}/cae/applications/{application_id}/component-with-configurations
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
project_id | 是 | String | 项目ID,获取项目ID请参见获取项目ID。 |
application_id | 是 | String | 应用ID。 |
请求参数
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
X-Auth-Token | 是 | String | 用户Token。
|
X-Enterprise-Project-ID | 否 | String | 企业项目ID。
说明: 关于企业项目ID的获取及企业项目特性的详细信息,请参见《企业管理服务用户指南》。 |
X-Environment-ID | 是 | String | 环境ID。
|
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
api_version | 是 | String | API版本,固定值“v1”,该值不可修改。 |
kind | 是 | String | API类型,固定值“Component”,该值不可修改。 |
metadata | 否 | metadata object | 请求数据。 |
spec | 否 | spec object | 组件规格信息。 |
configurations | 否 | Array of ConfigurationItem objects | 配置项列表。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
name | 是 | String | 组件名称。 |
annotations | 是 | Map<String,String> | 创建组件请求体附加参数,当前只支持version参数,此参数必填。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
runtime | 是 | String | 语言/运行时。 |
replica | 是 | Integer | 实例个数。 |
build | 否 | Build object | 构建信息。 |
source | 是 | Source object | 源信息。 |
resource_limit | 是 | ResourceLimit object | 实例规格。 |
image_url | 否 | String | 镜像地址。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
archive | 是 | Archive object | 构建产物纳管。 |
parameters | 是 | Map<String,String> | 构建附加参数。
|
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
code | 否 | Repo object | 源码仓库信息。 |
type | 是 | String | 参数解释: 源类型。 约束限制: 更新组件时,源类型需要与创建组件时的源类型保持一致。 取值范围:
默认取值: 不涉及。 |
sub_type | 否 | String | 源子类型。
|
url | 是 | String | url地址。
|
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
type | 是 | String | 参数解释: 组件配置类型。 约束限制: 不涉及。 取值范围:
默认取值: 不涉及。 |
data | 是 | ConfigurationData object | 组件配置数据。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
spec | 否 | ConfigurationRequestDataSpec object | 组件配置数据规格详情。 |
metadata | 否 | ConfigurationDataMetadata object | 组件配置元数据。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
rds_id | 否 | String | RDS数据库实例ID。 ConfigurationItem.type为"rds"时,配置此参数。 |
rds_db_name | 否 | String | RDS数据库名称。 ConfigurationItem.type为"rds"时,配置此参数。 |
rds_address | 否 | String | RDS数据库地址。 ConfigurationItem.type为"rds"时,配置此参数。 |
rds_username | 否 | String | RDS数据库用户名称。 ConfigurationItem.type为"rds"时,配置此参数。 |
rds_password | 否 | String | RDS数据库密码。 ConfigurationItem.type为"rds"时,配置此参数。 |
rds_port | 否 | String | RDS数据库端口。 ConfigurationItem.type为"rds"时,配置此参数。 |
config_center_addr | 否 | String | CSE配置中心地址。 ConfigurationItem.type为"cse"时,配置此参数。 |
service_center_addr | 否 | String | CSE服务注册发现地址。 ConfigurationItem.type为"cse"时,配置此参数。 |
cse_id | 否 | String | CSE引擎ID。 ConfigurationItem.type为"cse"时,配置此参数。 |
envs | 否 | Map<String,String> | 手动添加环境变量配置。 常用环境变量如下:
|
ip | 否 | String | 弹性公网IP,响应体参数,未配置域名时返回此参数。 |
items | 否 | Array of AccessConfigurationDataItems objects | 访问方式配置列表。 ConfigurationItem.type为"access"时,配置此参数。 |
switch | 否 | String | 伸缩策略配置开关。 ConfigurationItem.type为"scaling"时,配置此参数。 |
scale_strategy | 否 | String | 参数解释: 伸缩策略配置策略类型。 约束限制: ConfigurationItem.type为"scaling"时,配置此参数。 取值范围:
|
max_replica_count | 否 | Integer | 伸缩策略配置最大伸缩个数。 ConfigurationItem.type为"scaling"时,配置此参数。 |
min_replica_count | 否 | Integer | 伸缩策略配置最小伸缩个数。 ConfigurationItem.type为"scaling"时,配置此参数。 |
advanced | 否 | 伸缩策略高级配置。 ConfigurationItem.type为"scaling"时,配置此参数。 | |
triggers | 否 | Array of ScaleConfigurationDataTrigger objects | 伸缩策略配置触发器列表。 ConfigurationItem.type为"scaling"时,配置此参数。 |
volumes | 否 | Array of VolumeConfigurationDataVolume objects | 云存储配置列表。 ConfigurationItem.type为"volume"时,配置此参数。 |
livenessProbe | 否 | 组件健康检查配置的存活探针配置。 ConfigurationItem.type为"healthCheck"时,配置此参数。 | |
startupProbe | 否 | 组件健康检查配置的启动探针配置。 ConfigurationItem.type为"healthCheck"时,配置此参数。 | |
readinessProbe | 否 | 组件健康检查配置的就绪探针配置。 ConfigurationItem.type为"healthCheck"时,配置此参数。 | |
postStart | 否 | postStart object | 生命周期管理组件配置启动后处理。 ConfigurationItem.type为"lifecycle"时,配置此参数。 |
preStop | 否 | preStop object | 生命周期管理组件配置停止前处理。 ConfigurationItem.type为"lifecycle"时,配置此参数。 |
log_paths | 否 | Array of strings | 自定义本地磁盘日志路径数组。 ConfigurationItem.type为"log"时,配置此参数。 |
cloud_storage_log_paths | 否 | Array of CloudStorageLogPathInfo objects | 自定义云存储日志路径数组。 ConfigurationItem.type为"log"时,配置此参数。 |
multiline | 否 | multiline object | 多行日志模式 |
instrumentation | 否 | String | 参数解释: 探针注入方式。 约束限制: ConfigurationItem.type为"apm2"时,配置此参数。 取值范围:
|
path | 否 | String | 自定义监控指标配置采集路径。 ConfigurationItem.type为"customMetric"时,配置此参数。 |
port | 否 | Integer | 自定义监控指标配置采集端口。 ConfigurationItem.type为"customMetric"时,配置此参数。 |
metrics | 否 | Array of strings | 自定义监控指标配置指标名称。 ConfigurationItem.type为"customMetric"时,配置此参数。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
operator | 否 | String | 配置模式。
|
uid | 否 | String | 访问方式的uid。 |
metadata | 否 | AccessConfigurationMetadata object | 访问方式配置元数据。 |
type | 否 | String | 参数解释: 访问方式类型。 取值范围:
默认取值: 不涉及。 |
sub_type | 否 | String | 访问方式子类型。 |
ingress_config_id | 否 | String | 访问关联域名后缀ID,多个域名后缀逗号隔开。 |
domain_names | 否 | Array of strings | 内网访问方式域名。 |
access_control | 否 | AccessControl object | 访问控制配置,允许配置黑名单、白名单。 |
ports | 否 | Array of AccessConfigurationPort objects | 访问方式配置端口、协议、证书、URL路径等信息列表。 |
elb_id | 否 | String | 用户选择的elb的ID。 |
public_ip | 否 | String | 响应体参数,用户选择的elb的公网ip。 |
private_ip | 否 | String | 响应体参数,用户选择的elb的私网ip。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
annotations | 否 | Map<String,String> | 附加参数。 举例:负载均衡分配策略使用加权轮询算法,不启用健康检查。配置如下:
|
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
black | 否 | Array of strings | 黑名单数组。
|
white | 否 | Array of strings | 白名单数组。
|
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
operator | 否 | String | 配置模式。
|
uid | 否 | String | 端口配置的uid。 |
target_port | 否 | Integer | 监听端口。 |
port | 否 | Integer | 访问端口。 |
protocol | 否 | String | 协议,负载均衡支持TCP,负载均衡与路由配置支持HTTP、HTTPS。 |
default_certificate | 否 | String | 默认证书,访问方式配置为转发策略且协议为HTTPS时配置,未配置域名证书对时使用默认证书。 |
certificate | 否 | String | 证书。 |
policy | 否 | String | 安全策略。 |
paths | 否 | Array of AccessConfigurationHttpPath objects | 匹配路径和域名信息。 |
elb_id | 否 | String | 用户选择的elb的ID。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
hostname | 否 | String | 域名/不填,不填时表示使用IP。 |
path | 否 | String | URL路径。 |
url_match_mode | 否 | String | URL路径匹配模式,支持前缀匹配、正则匹配、精准匹配。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
scaledown_stabilization_seconds | 否 | Integer | 缩容冷却时间窗。 |
scaledown_rate | 否 | Integer | 缩容步长。 |
scaleup_stabilization_seconds | 否 | Integer | 扩容冷却时间窗。 |
scaleup_rate | 否 | Integer | 扩容步长。 |
disable_scaledown | 否 | Boolean | 是否禁用自动缩容。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
type | 否 | String | 参数解释: 指标类型。 取值范围:
|
metadata | 否 | ScalingTriggerMeta object | trigger元数据。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
type | 否 | String | 数据类型,当前只支持利用率,默认值为Utilization。 ScaleConfigurationDataTrigger.type为"cpu、memory"时,配置此参数。 |
value | 否 | String | 触发指标的阈值。 ScaleConfigurationDataTrigger.type为"cpu、memory"时,配置此参数。 |
period_type | 否 | String | 参数解释: 生效周期。 ScaleConfigurationDataTrigger.type为"cron"时,配置此参数。 取值范围:
默认取值: 不涉及。 |
schedulers | 否 | Array of CronTriggerScheduler objects | 每个周期内触发的时间点和实例数。 ScaleConfigurationDataTrigger.type为"cron"时,配置此参数。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
volume_id | 否 | String | 云存储ID。 |
resource_name | 否 | String | 云存储名称。 |
resource_type | 否 | String | 参数解释: 云存储类型。 取值范围:
|
resource_sub_type | 否 | String | 参数解释: 云存储子类型。 取值范围:
|
umask | 否 | String | 设置目录或文件缺省权限,默认值0027,sfs3.0类型的云存储不支持配置此参数。 |
mount_info | 否 | Array of VolumeConfigurationMountInfo objects | 云存储配置挂载信息。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
path | 否 | String | 容器挂载路径。 |
sub_path | 否 | String | 子路径。 |
access_mode | 否 | String | 读写权限。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
periodSeconds | 否 | Integer | 检测周期,单位为s。 |
initialDelaySeconds | 否 | Integer | 延迟时间,单位为s。 |
timeoutSeconds | 否 | Integer | 超时时间,单位为s。 |
successThreshold | 否 | Integer | 成功阈值。 |
failureThreshold | 否 | Integer | 最大失败次数。 |
httpGet | 否 | 健康检查配置中HTTP请求检查信息。 | |
tcpSocket | 否 | 健康检查配置中TCP端口检查信息。 | |
exec | 否 | HealthCheckConfigurationExec object | 健康检查配置中执行命令检查。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
periodSeconds | 否 | Integer | 检测周期,单位为s。 |
initialDelaySeconds | 否 | Integer | 延迟时间,单位为s。 |
timeoutSeconds | 否 | Integer | 超时时间,单位为s。 |
successThreshold | 否 | Integer | 成功阈值。 |
failureThreshold | 否 | Integer | 最大失败次数。 |
httpGet | 否 | 健康检查配置中HTTP请求检查信息。 | |
tcpSocket | 否 | 健康检查配置中TCP端口检查信息。 | |
exec | 否 | HealthCheckConfigurationExec object | 健康检查配置中执行命令检查。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
periodSeconds | 否 | Integer | 检测周期,单位为s。 |
initialDelaySeconds | 否 | Integer | 延迟时间,单位为s。 |
timeoutSeconds | 否 | Integer | 超时时间,单位为s。 |
successThreshold | 否 | Integer | 成功阈值。 |
failureThreshold | 否 | Integer | 最大失败次数。 |
httpGet | 否 | 健康检查配置中HTTP请求检查信息。 | |
tcpSocket | 否 | 健康检查配置中TCP端口检查信息。 | |
exec | 否 | HealthCheckConfigurationExec object | 健康检查配置中执行命令检查。 |
响应参数
状态码:200
参数 | 参数类型 | 描述 |
|---|---|---|
api_version | String | API版本,固定值“v1”,该值不可修改。 |
kind | String | API类型,固定值“Component”,该值不可修改。 |
metadata | MetadataResponse object | 响应数据。 |
spec | CreateComponentSpec object | 组件规格。 |
configurations | Array of ConfigurationItem objects | 配置项列表。 |
status | status object |
参数 | 参数类型 | 描述 |
|---|---|---|
id | String | 组件ID。 |
name | String | 组件名称。 |
annotations | Map<String,String> | 组件附加属性。
|
created_at | String | 创建时间。 |
updated_at | String | 更新时间。 |
参数 | 参数类型 | 描述 |
|---|---|---|
runtime | String | 语言/运行时。 |
env_id | String | 环境ID。 |
replica | Integer | 实例个数。 |
source | Source object | 源信息。 |
build | Build object | 构建信息。 |
resource_limit | ResourceLimit object | 实例规格。 |
available_replica | Integer | 可用实例个数。 |
status | String | 组件状态。
|
参数 | 参数类型 | 描述 |
|---|---|---|
code | Repo object | 源码仓库信息。 |
type | String | 参数解释: 源类型。 约束限制: 更新组件时,源类型需要与创建组件时的源类型保持一致。 取值范围:
默认取值: 不涉及。 |
sub_type | String | 源子类型。
|
url | String | url地址。
|
参数 | 参数类型 | 描述 |
|---|---|---|
archive | Archive object | 构建产物纳管。 |
parameters | Map<String,String> | 构建附加参数。
|
参数 | 参数类型 | 描述 |
|---|---|---|
type | String | 参数解释: 组件配置类型。 约束限制: 不涉及。 取值范围:
默认取值: 不涉及。 |
data | ConfigurationData object | 组件配置数据。 |
参数 | 参数类型 | 描述 |
|---|---|---|
spec | ConfigurationRequestDataSpec object | 组件配置数据规格详情。 |
metadata | ConfigurationDataMetadata object | 组件配置元数据。 |
参数 | 参数类型 | 描述 |
|---|---|---|
rds_id | String | RDS数据库实例ID。 ConfigurationItem.type为"rds"时,配置此参数。 |
rds_db_name | String | RDS数据库名称。 ConfigurationItem.type为"rds"时,配置此参数。 |
rds_address | String | RDS数据库地址。 ConfigurationItem.type为"rds"时,配置此参数。 |
rds_username | String | RDS数据库用户名称。 ConfigurationItem.type为"rds"时,配置此参数。 |
rds_password | String | RDS数据库密码。 ConfigurationItem.type为"rds"时,配置此参数。 |
rds_port | String | RDS数据库端口。 ConfigurationItem.type为"rds"时,配置此参数。 |
config_center_addr | String | CSE配置中心地址。 ConfigurationItem.type为"cse"时,配置此参数。 |
service_center_addr | String | CSE服务注册发现地址。 ConfigurationItem.type为"cse"时,配置此参数。 |
cse_id | String | CSE引擎ID。 ConfigurationItem.type为"cse"时,配置此参数。 |
envs | Map<String,String> | 手动添加环境变量配置。 常用环境变量如下:
|
ip | String | 弹性公网IP,响应体参数,未配置域名时返回此参数。 |
items | Array of AccessConfigurationDataItems objects | 访问方式配置列表。 ConfigurationItem.type为"access"时,配置此参数。 |
switch | String | 伸缩策略配置开关。 ConfigurationItem.type为"scaling"时,配置此参数。 |
scale_strategy | String | 参数解释: 伸缩策略配置策略类型。 约束限制: ConfigurationItem.type为"scaling"时,配置此参数。 取值范围:
|
max_replica_count | Integer | 伸缩策略配置最大伸缩个数。 ConfigurationItem.type为"scaling"时,配置此参数。 |
min_replica_count | Integer | 伸缩策略配置最小伸缩个数。 ConfigurationItem.type为"scaling"时,配置此参数。 |
advanced | 伸缩策略高级配置。 ConfigurationItem.type为"scaling"时,配置此参数。 | |
triggers | Array of ScaleConfigurationDataTrigger objects | 伸缩策略配置触发器列表。 ConfigurationItem.type为"scaling"时,配置此参数。 |
volumes | Array of VolumeConfigurationDataVolume objects | 云存储配置列表。 ConfigurationItem.type为"volume"时,配置此参数。 |
livenessProbe | 组件健康检查配置的存活探针配置。 ConfigurationItem.type为"healthCheck"时,配置此参数。 | |
startupProbe | 组件健康检查配置的启动探针配置。 ConfigurationItem.type为"healthCheck"时,配置此参数。 | |
readinessProbe | 组件健康检查配置的就绪探针配置。 ConfigurationItem.type为"healthCheck"时,配置此参数。 | |
postStart | postStart object | 生命周期管理组件配置启动后处理。 ConfigurationItem.type为"lifecycle"时,配置此参数。 |
preStop | preStop object | 生命周期管理组件配置停止前处理。 ConfigurationItem.type为"lifecycle"时,配置此参数。 |
log_paths | Array of strings | 自定义本地磁盘日志路径数组。 ConfigurationItem.type为"log"时,配置此参数。 |
cloud_storage_log_paths | Array of CloudStorageLogPathInfo objects | 自定义云存储日志路径数组。 ConfigurationItem.type为"log"时,配置此参数。 |
multiline | multiline object | 多行日志模式 |
instrumentation | String | 参数解释: 探针注入方式。 约束限制: ConfigurationItem.type为"apm2"时,配置此参数。 取值范围:
|
path | String | 自定义监控指标配置采集路径。 ConfigurationItem.type为"customMetric"时,配置此参数。 |
port | Integer | 自定义监控指标配置采集端口。 ConfigurationItem.type为"customMetric"时,配置此参数。 |
metrics | Array of strings | 自定义监控指标配置指标名称。 ConfigurationItem.type为"customMetric"时,配置此参数。 |
参数 | 参数类型 | 描述 |
|---|---|---|
operator | String | 配置模式。
|
uid | String | 访问方式的uid。 |
metadata | AccessConfigurationMetadata object | 访问方式配置元数据。 |
type | String | 参数解释: 访问方式类型。 取值范围:
默认取值: 不涉及。 |
sub_type | String | 访问方式子类型。 |
ingress_config_id | String | 访问关联域名后缀ID,多个域名后缀逗号隔开。 |
domain_names | Array of strings | 内网访问方式域名。 |
access_control | AccessControl object | 访问控制配置,允许配置黑名单、白名单。 |
ports | Array of AccessConfigurationPort objects | 访问方式配置端口、协议、证书、URL路径等信息列表。 |
elb_id | String | 用户选择的elb的ID。 |
public_ip | String | 响应体参数,用户选择的elb的公网ip。 |
private_ip | String | 响应体参数,用户选择的elb的私网ip。 |
参数 | 参数类型 | 描述 |
|---|---|---|
annotations | Map<String,String> | 附加参数。 举例:负载均衡分配策略使用加权轮询算法,不启用健康检查。配置如下:
|
参数 | 参数类型 | 描述 |
|---|---|---|
black | Array of strings | 黑名单数组。
|
white | Array of strings | 白名单数组。
|
参数 | 参数类型 | 描述 |
|---|---|---|
operator | String | 配置模式。
|
uid | String | 端口配置的uid。 |
target_port | Integer | 监听端口。 |
port | Integer | 访问端口。 |
protocol | String | 协议,负载均衡支持TCP,负载均衡与路由配置支持HTTP、HTTPS。 |
default_certificate | String | 默认证书,访问方式配置为转发策略且协议为HTTPS时配置,未配置域名证书对时使用默认证书。 |
certificate | String | 证书。 |
policy | String | 安全策略。 |
paths | Array of AccessConfigurationHttpPath objects | 匹配路径和域名信息。 |
elb_id | String | 用户选择的elb的ID。 |
参数 | 参数类型 | 描述 |
|---|---|---|
hostname | String | 域名/不填,不填时表示使用IP。 |
path | String | URL路径。 |
url_match_mode | String | URL路径匹配模式,支持前缀匹配、正则匹配、精准匹配。 |
参数 | 参数类型 | 描述 |
|---|---|---|
scaledown_stabilization_seconds | Integer | 缩容冷却时间窗。 |
scaledown_rate | Integer | 缩容步长。 |
scaleup_stabilization_seconds | Integer | 扩容冷却时间窗。 |
scaleup_rate | Integer | 扩容步长。 |
disable_scaledown | Boolean | 是否禁用自动缩容。 |
参数 | 参数类型 | 描述 |
|---|---|---|
type | String | 参数解释: 指标类型。 取值范围:
|
metadata | ScalingTriggerMeta object | trigger元数据。 |
参数 | 参数类型 | 描述 |
|---|---|---|
type | String | 数据类型,当前只支持利用率,默认值为Utilization。 ScaleConfigurationDataTrigger.type为"cpu、memory"时,配置此参数。 |
value | String | 触发指标的阈值。 ScaleConfigurationDataTrigger.type为"cpu、memory"时,配置此参数。 |
period_type | String | 参数解释: 生效周期。 ScaleConfigurationDataTrigger.type为"cron"时,配置此参数。 取值范围:
默认取值: 不涉及。 |
schedulers | Array of CronTriggerScheduler objects | 每个周期内触发的时间点和实例数。 ScaleConfigurationDataTrigger.type为"cron"时,配置此参数。 |
参数 | 参数类型 | 描述 |
|---|---|---|
volume_id | String | 云存储ID。 |
resource_name | String | 云存储名称。 |
resource_type | String | 参数解释: 云存储类型。 取值范围:
|
resource_sub_type | String | 参数解释: 云存储子类型。 取值范围:
|
umask | String | 设置目录或文件缺省权限,默认值0027,sfs3.0类型的云存储不支持配置此参数。 |
mount_info | Array of VolumeConfigurationMountInfo objects | 云存储配置挂载信息。 |
参数 | 参数类型 | 描述 |
|---|---|---|
periodSeconds | Integer | 检测周期,单位为s。 |
initialDelaySeconds | Integer | 延迟时间,单位为s。 |
timeoutSeconds | Integer | 超时时间,单位为s。 |
successThreshold | Integer | 成功阈值。 |
failureThreshold | Integer | 最大失败次数。 |
httpGet | 健康检查配置中HTTP请求检查信息。 | |
tcpSocket | 健康检查配置中TCP端口检查信息。 | |
exec | HealthCheckConfigurationExec object | 健康检查配置中执行命令检查。 |
参数 | 参数类型 | 描述 |
|---|---|---|
periodSeconds | Integer | 检测周期,单位为s。 |
initialDelaySeconds | Integer | 延迟时间,单位为s。 |
timeoutSeconds | Integer | 超时时间,单位为s。 |
successThreshold | Integer | 成功阈值。 |
failureThreshold | Integer | 最大失败次数。 |
httpGet | 健康检查配置中HTTP请求检查信息。 | |
tcpSocket | 健康检查配置中TCP端口检查信息。 | |
exec | HealthCheckConfigurationExec object | 健康检查配置中执行命令检查。 |
参数 | 参数类型 | 描述 |
|---|---|---|
periodSeconds | Integer | 检测周期,单位为s。 |
initialDelaySeconds | Integer | 延迟时间,单位为s。 |
timeoutSeconds | Integer | 超时时间,单位为s。 |
successThreshold | Integer | 成功阈值。 |
failureThreshold | Integer | 最大失败次数。 |
httpGet | 健康检查配置中HTTP请求检查信息。 | |
tcpSocket | 健康检查配置中TCP端口检查信息。 | |
exec | HealthCheckConfigurationExec object | 健康检查配置中执行命令检查。 |
参数 | 参数类型 | 描述 |
|---|---|---|
mode | String | 参数解释: 多行日志的分行模式。 取值范围:
|
value | String | mode为time:value如yyyy-MM-dd hh:mm:sspm.SSS ZZZZ;mode为regular:value则为正则表达式 |
请求示例
使用源码仓库创建组件,组件名称“test-code”,版本“1.0.0”,选择GitLab源码仓库,运行时为Java8,并配置访问方式负载均衡。
POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/component-with-configurations { "api_version" : "v1", "kind" : "Component", "metadata" : { "name" : "test-code", "annotations" : { "version" : "1.0.0" } }, "spec" : { "runtime" : "Java8", "build" : { "archive" : { "artifact_namespace" : "xxx" }, "parameters" : { "base_image" : "openjdk:8u181-jdk-alpine", "dockerfile_path" : "./Dockerfile" } }, "source" : { "type" : "code", "sub_type" : "GitLab", "url" : "https://xxx:8090/xxx/cae-frontend.git", "code" : { "branch" : "master", "auth_name" : "gitlab-xxx", "namespace" : "em1n" } }, "resource_limit" : { "cpu_limit" : "500m", "memory_limit" : "1Gi" }, "replica" : 1 }, "configurations" : [ { "type" : "access", "data" : { "spec" : { "items" : [ { "type" : "LoadBalancer", "elb_id" : "defaultElbID", "ports" : [ { "target_port" : 80, "port" : 80, "protocol" : "TCP" } ] } ] } } } ] }使用镜像创建组件,组件名称“test-image”,版本“1.0.0”,选择nginx镜像,运行时为Docker,并配置访问方式负载均衡。
POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/component-with-configurations { "api_version" : "v1", "kind" : "Component", "metadata" : { "name" : "test-image", "annotations" : { "version" : "1.0.0" } }, "spec" : { "runtime" : "Docker", "source" : { "type" : "image", "url" : "nginx:stable-alpine-perl" }, "resource_limit" : { "cpu_limit" : "500m", "memory_limit" : "1Gi" }, "replica" : 1 }, "configurations" : [ { "type" : "access", "data" : { "spec" : { "items" : [ { "type" : "LoadBalancer", "elb_id" : "defaultElbID", "ports" : [ { "target_port" : 80, "port" : 80, "protocol" : "TCP" } ] } ] } } } ] }使用软件包创建组件,组件名称“test-jar”,版本“1.0.0”,在OBS对象存储中选择名称为“forecast-1.0.0.jar”的软件包,运行时为Java8,并配置访问方式负载均衡。
POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/component-with-configurations { "api_version" : "v1", "kind" : "Component", "metadata" : { "name" : "test-jar", "annotations" : { "version" : "1.0.0" } }, "spec" : { "runtime" : "Java8", "build" : { "archive" : { "artifact_namespace" : "xxx" }, "parameters" : { "base_image" : "openjdk:8u181-jdk-alpine", "dockerfile_content" : "FROM java:8 \\nADD forecast-1.0.0.jar \\nEXPOSE 8080 \\nENTRYPOINT [\"java\",\"-jar\",\"forecast-1.0.0.jar\"]" } }, "source" : { "type" : "softwarePackage", "sub_type" : "BinObs", "url" : "https://xxx.obs.region.xxx.huawei.com/xxx/forecast-1.0.0.jar" }, "resource_limit" : { "cpu_limit" : "500m", "memory_limit" : "1Gi" }, "replica" : 1 }, "configurations" : [ { "type" : "access", "data" : { "spec" : { "items" : [ { "type" : "LoadBalancer", "elb_id" : "defaultElbID", "ports" : [ { "target_port" : 80, "port" : 80, "protocol" : "TCP" } ] } ] } } } ] }
响应示例
状态码:200
请求成功。
{
"api_version": "v1",
"kind": "Component",
"metadata": {
"id": "cac09548-047f-46c4-abbd-a6a652305565",
"name": "test-code",
"annotations": {
"log_group_id": "5b13213a-84f8-4b72-8ca5-530e15cc1402",
"log_stream_id": "6ddf6c71-4767-46db-98a2-fe5fb301b366",
"version": "1.0.0"
},
"created_at": "2023-02-13T02:38:22.689607114Z",
"updated_at": "2023-02-13T02:38:22.689607114Z"
},
"spec": {
"runtime": "Java8",
"env_id": "9819b3f5-dd08-44ff-ba88-eb38e435594c",
"replica": 1,
"source": {
"type": "code",
"sub_type": "GitLab",
"url": "http://xxx@cpe.gitlab.com:8090/xxx/cae-backend.git",
"code": {
"branch": "master",
"auth_name": "gitlab-xxx",
"namespace": "em1n"
}
},
"build": {
"archive": {
"artifact_namespace": "xxx"
},
"parameters": {
"base_image": "openjdk:8u181-jdk-alpine"
"dockerfile_path": "./Dockerfile"
}
},
"resource_limit": {
"cpu_limit": "500m",
"memory_limit": "1Gi"
},
"available_replica": 0,
"status": "created"
},
"configurations": [
{
"type": "volume",
"data": {
"spec": {
"volumes": [
{
"volume_id": "84f2e74c-c684-4933-bcf6-b6c230386049",
"resource_name": "test-cae",
"resource_type": "obs",
"resource_sub_type": "object_bucket",
"umask": "0027",
"mount_info": [
{
"path": "/tmp/test",
"sub_path": "",
"access_mode": "ReadWriteMany",
"create_time": "2024-06-07T03:06:46.094Z"
}
]
}
]
}
},
"operation_id": "c2120961-df90-4a77-8195-357ad21505b2",
"operated_at": "2024-06-11T07:44:22.856241Z",
"is_activated": false
},
{
"type": "access",
"data": {
"metadata": {
"annotations": {
"deployBackend": "k8s"
},
"created_at": "0001-01-01T00:00:00Z",
"updated_at": "0001-01-01T00:00:00Z"
},
"spec": {
"ip": "",
"elb_private_ip": "",
"items": [
{
"uid": "4ad7dba0-50d4-420a-9a91-be2de4eb41df",
"type": "LoadBalancer",
"metadata": {
"annotations": {
"kubernetes.io/elb.health-check-flag": "on",
"kubernetes.io/elb.health-check-option": "{\"protocol\":\"TCP\",\"delay\":\"5\",\"timeout\":\"10\",\"max_retries\":\"3\"}"
},
"created_at": "0001-01-01T00:00:00Z",
"updated_at": "0001-01-01T00:00:00Z"
},
"elb_id": "defaultElbID",
"access_control": null,
"public_ip": "100.93.14.168",
"private_ip": "",
"ports": [
{
"ip": "",
"name": "",
"target_port": 80,
"port": 80,
"protocol": "TCP",
"default_certificate": ""
}
],
"default_certificate": ""
}
]
},
"ref": {
"id": "ac24d721-f1e0-47da-ab9c-bad1d3b874ea"
}
},
"operation_id": "c2120961-df90-4a77-8195-357ad21505b2",
"operated_at": "2024-06-11T07:44:21.969021Z",
"is_activated": false
}
],
status:{
"job_id":"xxx"
}
} 状态码
状态码 | 描述 |
|---|---|
200 | 请求成功。 |
错误码
请参见错误码。

