revert(性能测试): K8S资源池找回nodeSelector

This commit is contained in:
CaptainB 2022-05-26 14:20:13 +08:00 committed by 刘瑞斌
parent f3b86d6d00
commit 10228087ef
4 changed files with 38 additions and 2 deletions

View File

@ -172,6 +172,21 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item>
<template v-slot:label>
NodeSelector
<el-tooltip :content="$t('test_resource_pool.node_selector_tip')"
effect="light"
trigger="hover">
<i class="el-icon-info"></i>
</el-tooltip>
</template>
<el-input v-model="item.nodeSelector" placeholder='{"disktype": "ssd",...}'/>
</el-form-item>
</el-col>
</el-row>
</div>
</div>
@ -390,11 +405,12 @@ export default {
if (this.infoList.length <= 0) {
return {validate: false, msg: this.$t('test_resource_pool.cannot_empty')};
}
let resourcePoolType = this.form.type;
let resultValidate = {validate: true, msg: this.$t('test_resource_pool.fill_the_data')};
this.infoList.forEach(info => {
for (let key in info) {
//
if (key === 'apiImage') {
if (key === 'nodeSelector' || key === 'apiImage') {
continue;
}
if (info[key] != '0' && !info[key]) {
@ -407,6 +423,14 @@ export default {
resultValidate.validate = false;
return false;
}
if (resourcePoolType === 'K8S' && info.nodeSelector) {
let validate = this.isJsonString(info.nodeSelector);
if (!validate) {
resultValidate.validate = false;
resultValidate.msg = this.$t('test_resource_pool.node_selector_invalid');
}
}
});
return resultValidate;
},
@ -435,7 +459,6 @@ export default {
configuration.monitorPort = configuration.monitorPort || '9100';
configuration.deployType = configuration.deployType || 'DaemonSet';
configuration.deployName = configuration.deployName || 'ms-node-controller';
delete configuration.nodeSelector;
resources.push(configuration);
});
}
@ -599,6 +622,16 @@ export default {
let i = response.data.lastIndexOf('-');
this.apiImageTag = response.data.substring(0, i);
});
},
isJsonString(str) {
try {
if (typeof JSON.parse(str) == "object") {
return true;
}
} catch (e) {
return false;
}
return false;
}
}
};

View File

@ -2458,6 +2458,7 @@ export default {
status_change_failed: 'Failed to change the status, resource pool is invalid!',
check_in: 'Check in',
node_selector_invalid: 'nodeSelector must be JSON',
node_selector_tip: 'Configure the nodeSelector of the load test Pod',
pod_thread_limit: 'Maximum number of threads per POD',
usage: 'Usage',
backend_listener: 'Backend Listener',

View File

@ -2462,6 +2462,7 @@ export default {
status_change_failed: '状态修改失败, 校验不通过!',
check_in: '校验中',
node_selector_invalid: 'nodeSelector 必须是有效的JSON',
node_selector_tip: '配置性能测试Pod的 nodeSelector',
pod_thread_limit: '单POD最大线程数',
usage: '用途',
backend_listener: '后置监听器',

View File

@ -2461,6 +2461,7 @@ export default {
status_change_failed: '狀態修改失敗, 校驗不通過!',
check_in: '校驗中',
node_selector_invalid: 'nodeSelector 必須是有效的JSON',
node_selector_tip: '配置性能測試Pod的 nodeSelector',
pod_thread_limit: '單POD最大線程數',
usage: '用途',
backend_listener: '後置監聽器',