feat(delivery): support multi-instance scheduling on a single host
- Per-host instance limit (DELIVERY_HOST_INSTANCE_LIMIT, default 4) - Optional target_host to pin a host from the candidate pool - Regenerate swagger docs
This commit is contained in:
+61
-118
@@ -152,7 +152,7 @@ const docTemplate = `{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "返回所有已启用的部署目标(如 k8s 集群、主机池)",
|
||||
"description": "从 AWX 动态返回可用 Job Template 及其 Inventory hosts",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -160,6 +160,14 @@ const docTemplate = `{
|
||||
"delivery"
|
||||
],
|
||||
"summary": "获取可用部署目标",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "组件过滤,例如 mysql",
|
||||
"name": "component",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "items: 部署目标数组",
|
||||
@@ -176,64 +184,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "管理员创建新的部署目标(目前仅支持 k8s 类型)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"delivery"
|
||||
],
|
||||
"summary": "创建部署目标",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "目标配置",
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.targetPayload"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "目标已创建",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/model.DeploymentTarget"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "未授权",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "名称冲突",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/auth/api/v1/delivery/tasks": {
|
||||
@@ -254,6 +204,7 @@ const docTemplate = `{
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "业务线 ID 过滤",
|
||||
"name": "business_line_id",
|
||||
"in": "query"
|
||||
@@ -689,65 +640,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.targetPayload": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"awx_inventory_id",
|
||||
"awx_template_id",
|
||||
"name",
|
||||
"target_type"
|
||||
],
|
||||
"properties": {
|
||||
"awx_inventory_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"awx_template_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "object",
|
||||
"additionalProperties": {}
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"target_type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"model.DeploymentTarget": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"awx_inventory_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"awx_template_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"target_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"model.ResourceQuota": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -816,18 +708,55 @@ const docTemplate = `{
|
||||
"target_id"
|
||||
],
|
||||
"properties": {
|
||||
"binlog_expire_logs_seconds": {
|
||||
"type": "integer"
|
||||
},
|
||||
"business_line_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"character_set": {
|
||||
"type": "string"
|
||||
},
|
||||
"collation": {
|
||||
"type": "string"
|
||||
},
|
||||
"cpu_milli": {
|
||||
"type": "integer"
|
||||
},
|
||||
"data_disk": {
|
||||
"type": "string"
|
||||
},
|
||||
"innodb_flush_log_at_trx_commit": {
|
||||
"type": "integer"
|
||||
},
|
||||
"innodb_io_capacity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"innodb_redo_log_capacity": {
|
||||
"type": "string"
|
||||
},
|
||||
"instance_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"long_query_time": {
|
||||
"type": "number"
|
||||
},
|
||||
"lower_case_table_names": {
|
||||
"type": "integer"
|
||||
},
|
||||
"max_binlog_size": {
|
||||
"type": "string"
|
||||
},
|
||||
"max_connections": {
|
||||
"description": "高级参数(选填,零值视为未设置)",
|
||||
"type": "string"
|
||||
},
|
||||
"memory_mi": {
|
||||
"type": "integer"
|
||||
},
|
||||
"mysql_port": {
|
||||
"type": "integer"
|
||||
},
|
||||
"mysql_version": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -837,8 +766,22 @@ const docTemplate = `{
|
||||
"storage_gi": {
|
||||
"type": "integer"
|
||||
},
|
||||
"sync_binlog": {
|
||||
"type": "integer"
|
||||
},
|
||||
"target_host": {
|
||||
"description": "调度控制(选填):点名候选池内主机跳过自动选机,端口/配额/实机守卫照常执行",
|
||||
"type": "string"
|
||||
},
|
||||
"target_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"timezone": {
|
||||
"description": "数据库配置(选填,缺省由 playbook 基线兜底)",
|
||||
"type": "string"
|
||||
},
|
||||
"topology": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+61
-118
@@ -145,7 +145,7 @@
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "返回所有已启用的部署目标(如 k8s 集群、主机池)",
|
||||
"description": "从 AWX 动态返回可用 Job Template 及其 Inventory hosts",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -153,6 +153,14 @@
|
||||
"delivery"
|
||||
],
|
||||
"summary": "获取可用部署目标",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "组件过滤,例如 mysql",
|
||||
"name": "component",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "items: 部署目标数组",
|
||||
@@ -169,64 +177,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "管理员创建新的部署目标(目前仅支持 k8s 类型)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"delivery"
|
||||
],
|
||||
"summary": "创建部署目标",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "目标配置",
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.targetPayload"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "目标已创建",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/model.DeploymentTarget"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "未授权",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "名称冲突",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/auth/api/v1/delivery/tasks": {
|
||||
@@ -247,6 +197,7 @@
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "业务线 ID 过滤",
|
||||
"name": "business_line_id",
|
||||
"in": "query"
|
||||
@@ -682,65 +633,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.targetPayload": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"awx_inventory_id",
|
||||
"awx_template_id",
|
||||
"name",
|
||||
"target_type"
|
||||
],
|
||||
"properties": {
|
||||
"awx_inventory_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"awx_template_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "object",
|
||||
"additionalProperties": {}
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"target_type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"model.DeploymentTarget": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"awx_inventory_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"awx_template_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"target_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"model.ResourceQuota": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -809,18 +701,55 @@
|
||||
"target_id"
|
||||
],
|
||||
"properties": {
|
||||
"binlog_expire_logs_seconds": {
|
||||
"type": "integer"
|
||||
},
|
||||
"business_line_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"character_set": {
|
||||
"type": "string"
|
||||
},
|
||||
"collation": {
|
||||
"type": "string"
|
||||
},
|
||||
"cpu_milli": {
|
||||
"type": "integer"
|
||||
},
|
||||
"data_disk": {
|
||||
"type": "string"
|
||||
},
|
||||
"innodb_flush_log_at_trx_commit": {
|
||||
"type": "integer"
|
||||
},
|
||||
"innodb_io_capacity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"innodb_redo_log_capacity": {
|
||||
"type": "string"
|
||||
},
|
||||
"instance_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"long_query_time": {
|
||||
"type": "number"
|
||||
},
|
||||
"lower_case_table_names": {
|
||||
"type": "integer"
|
||||
},
|
||||
"max_binlog_size": {
|
||||
"type": "string"
|
||||
},
|
||||
"max_connections": {
|
||||
"description": "高级参数(选填,零值视为未设置)",
|
||||
"type": "string"
|
||||
},
|
||||
"memory_mi": {
|
||||
"type": "integer"
|
||||
},
|
||||
"mysql_port": {
|
||||
"type": "integer"
|
||||
},
|
||||
"mysql_version": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -830,8 +759,22 @@
|
||||
"storage_gi": {
|
||||
"type": "integer"
|
||||
},
|
||||
"sync_binlog": {
|
||||
"type": "integer"
|
||||
},
|
||||
"target_host": {
|
||||
"description": "调度控制(选填):点名候选池内主机跳过自动选机,端口/配额/实机守卫照常执行",
|
||||
"type": "string"
|
||||
},
|
||||
"target_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"timezone": {
|
||||
"description": "数据库配置(选填,缺省由 playbook 基线兜底)",
|
||||
"type": "string"
|
||||
},
|
||||
"topology": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+42
-79
@@ -22,46 +22,6 @@ definitions:
|
||||
- storage_gi
|
||||
- target_id
|
||||
type: object
|
||||
handler.targetPayload:
|
||||
properties:
|
||||
awx_inventory_id:
|
||||
type: integer
|
||||
awx_template_id:
|
||||
type: integer
|
||||
metadata:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
name:
|
||||
type: string
|
||||
target_type:
|
||||
type: string
|
||||
required:
|
||||
- awx_inventory_id
|
||||
- awx_template_id
|
||||
- name
|
||||
- target_type
|
||||
type: object
|
||||
model.DeploymentTarget:
|
||||
properties:
|
||||
awx_inventory_id:
|
||||
type: integer
|
||||
awx_template_id:
|
||||
type: integer
|
||||
created_at:
|
||||
type: string
|
||||
enabled:
|
||||
type: boolean
|
||||
id:
|
||||
type: integer
|
||||
metadata:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
target_type:
|
||||
type: string
|
||||
updated_at:
|
||||
type: string
|
||||
type: object
|
||||
model.ResourceQuota:
|
||||
properties:
|
||||
business_line_id:
|
||||
@@ -101,22 +61,57 @@ definitions:
|
||||
type: object
|
||||
service.MySQLDeliveryInput:
|
||||
properties:
|
||||
binlog_expire_logs_seconds:
|
||||
type: integer
|
||||
business_line_id:
|
||||
type: integer
|
||||
character_set:
|
||||
type: string
|
||||
collation:
|
||||
type: string
|
||||
cpu_milli:
|
||||
type: integer
|
||||
data_disk:
|
||||
type: string
|
||||
innodb_flush_log_at_trx_commit:
|
||||
type: integer
|
||||
innodb_io_capacity:
|
||||
type: integer
|
||||
innodb_redo_log_capacity:
|
||||
type: string
|
||||
instance_name:
|
||||
type: string
|
||||
long_query_time:
|
||||
type: number
|
||||
lower_case_table_names:
|
||||
type: integer
|
||||
max_binlog_size:
|
||||
type: string
|
||||
max_connections:
|
||||
description: 高级参数(选填,零值视为未设置)
|
||||
type: string
|
||||
memory_mi:
|
||||
type: integer
|
||||
mysql_port:
|
||||
type: integer
|
||||
mysql_version:
|
||||
type: string
|
||||
namespace:
|
||||
type: string
|
||||
storage_gi:
|
||||
type: integer
|
||||
sync_binlog:
|
||||
type: integer
|
||||
target_host:
|
||||
description: 调度控制(选填):点名候选池内主机跳过自动选机,端口/配额/实机守卫照常执行
|
||||
type: string
|
||||
target_id:
|
||||
type: integer
|
||||
timezone:
|
||||
description: 数据库配置(选填,缺省由 playbook 基线兜底)
|
||||
type: string
|
||||
topology:
|
||||
type: string
|
||||
required:
|
||||
- business_line_id
|
||||
- cpu_milli
|
||||
@@ -220,7 +215,12 @@ paths:
|
||||
- delivery
|
||||
/auth/api/v1/delivery/targets:
|
||||
get:
|
||||
description: 返回所有已启用的部署目标(如 k8s 集群、主机池)
|
||||
description: 从 AWX 动态返回可用 Job Template 及其 Inventory hosts
|
||||
parameters:
|
||||
- description: 组件过滤,例如 mysql
|
||||
in: query
|
||||
name: component
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -239,49 +239,12 @@ paths:
|
||||
summary: 获取可用部署目标
|
||||
tags:
|
||||
- delivery
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 管理员创建新的部署目标(目前仅支持 k8s 类型)
|
||||
parameters:
|
||||
- description: 目标配置
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/handler.targetPayload'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: 目标已创建
|
||||
schema:
|
||||
$ref: '#/definitions/model.DeploymentTarget'
|
||||
"400":
|
||||
description: 参数错误
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"401":
|
||||
description: 未授权
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"409":
|
||||
description: 名称冲突
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 创建部署目标
|
||||
tags:
|
||||
- delivery
|
||||
/auth/api/v1/delivery/tasks:
|
||||
get:
|
||||
description: 返回当前用户可见的交付任务列表(管理员可见全部)
|
||||
parameters:
|
||||
- description: 业务线 ID 过滤
|
||||
format: int64
|
||||
in: query
|
||||
name: business_line_id
|
||||
type: integer
|
||||
|
||||
Reference in New Issue
Block a user