Skip to content

Commit

Permalink
fix: 安装通道list接口数据结构规范 (closed TencentBlueKing#2430)
Browse files Browse the repository at this point in the history
  • Loading branch information
Huayeaaa authored and wyyalt committed Sep 12, 2024
1 parent 80716e1 commit 5030f1e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 2 deletions.
4 changes: 3 additions & 1 deletion apps/node_man/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ class TimeUnit:
# 自动选择接入点ID
DEFAULT_AP_ID = int(os.environ.get("DEFAULT_AP_ID", -1))
# 自动选择安装通道ID
DEFAULT_INSTALL_CHANNEL_ID = int(os.environ.get("DEFAULT_AP_ID", -1))
DEFAULT_INSTALL_CHANNEL_ID = int(os.environ.get("DEFAULT_INSTALL_CHANNEL_ID", -1))
# 自动选择的云区域ID
AUTOMATIC_CHOICE_CLOUD_ID = int(os.environ.get("AUTOMATIC_CHOICE_CLOUD_ID", -1))
# 自动选择
AUTOMATIC_CHOICE = os.environ.get("AUTOMATIC_CHOICE", _("自动选择"))
# 默认安装通道
Expand Down
12 changes: 11 additions & 1 deletion apps/node_man/views/install_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,17 @@ def get_queryset(self):

def list(self, request, *args, **kwargs):
response = super().list(request, *args, **kwargs)
response.data.insert(0, {"id": constants.DEFAULT_INSTALL_CHANNEL_ID, "name": constants.AUTOMATIC_CHOICE})
response.data.insert(
0,
{
"id": constants.DEFAULT_INSTALL_CHANNEL_ID,
"name": constants.AUTOMATIC_CHOICE,
"bk_cloud_id": constants.AUTOMATIC_CHOICE_CLOUD_ID,
"jump_servers": [],
"upstream_servers": {},
"hidden": False,
},
)
return response

@swagger_auto_schema(
Expand Down
5 changes: 5 additions & 0 deletions env/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
"BK_NOTICE_ENABLED",
# WINDOWS IEOD脚本内容
"BKAPP_IEOD_ACTIVE_FIREWALL_POLICY_SCRIPT_INFO",
# 自动选择安装通道相关配置
"BKAPP_DEFAULT_INSTALL_CHANNEL_ID",
"BKAPP_AUTOMATIC_CHOICE_CLOUD_ID",
]

# ===============================================================================
Expand All @@ -91,6 +94,8 @@
BKAPP_IEOD_ACTIVE_FIREWALL_POLICY_SCRIPT_INFO = get_type_env(
key="BKAPP_IEOD_ACTIVE_FIREWALL_POLICY_SCRIPT_INFO", default="", _type=str
)
BKAPP_DEFAULT_INSTALL_CHANNEL_ID = get_type_env(key="BKAPP_DEFAULT_INSTALL_CHANNEL_ID", default=-1, _type=int)
BKAPP_AUTOMATIC_CHOICE_CLOUD_ID = get_type_env(key="BKAPP_AUTOMATIC_CHOICE_CLOUD_ID", default=-1, _type=int)

# ===============================================================================
# 日志
Expand Down
2 changes: 2 additions & 0 deletions support-files/kubernetes/helm/bk-nodeman/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ externalRabbitMQ:
| `config.bkAppSyncProcStatusTaskInterval` | 插件进程状态同步周期 | `20 * 60` |
| `config.bkAppScriptHooks` | Agent安装前置脚本 | `""` |
| `config.bkAppIEODActiveFirewallPolicyScriptInfo` | WINDOWS IEOD脚本内容 | `""` |
| `config.bkAppDefaultInstallChannelId` | 自动选择安装通道ID | `-1` |
| `config.bkAppAutomaticChoiceCloudId` | 自动选择安装通道对应云区域ID | `-1` |

## 额外的环境变量

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,5 @@ data:
BKAPP_LEGACY_AUTH: "{{ .Values.config.bkAppLegacyAuth }}"
BK_NOTICE_ENABLED: "{{ .Values.bkNotice.enabled }}"
BKAPP_IEOD_ACTIVE_FIREWALL_POLICY_SCRIPT_INFO: '{{ .Values.config.bkAppIEODActiveFirewallPolicyScriptInfo }}'
BKAPP_DEFAULT_INSTALL_CHANNEL_ID: "{{ .Values.config.bkAppDefaultInstallChannelId}}"
BKAPP_AUTOMATIC_CHOICE_CLOUD_ID: "{{ .Values.config.bkAppAutomaticChoiceCloudId}}"
4 changes: 4 additions & 0 deletions support-files/kubernetes/helm/bk-nodeman/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ config:
bkAppScriptHooks: ""
## WINDOWS IEOD脚本内容
bkAppIEODActiveFirewallPolicyScriptInfo: ""
## 自动选择安装通道ID
bkAppDefaultInstallChannelId: -1
## 自动选择安装通道对应云区域ID
bkAppAutomaticChoiceCloudId: -1


## --------------------------------------
Expand Down

0 comments on commit 5030f1e

Please sign in to comment.