diff --git a/bcs-services/bcs-bscp/ui/src/assets/example-data/file-cmd.yaml b/bcs-services/bcs-bscp/ui/src/assets/example-data/file-cmd.yaml
index 9a07f4a69f..9992b38f4b 100644
--- a/bcs-services/bcs-bscp/ui/src/assets/example-data/file-cmd.yaml
+++ b/bcs-services/bcs-bscp/ui/src/assets/example-data/file-cmd.yaml
@@ -13,4 +13,6 @@ labels: {{ .Bk_Bscp_Variable_Leabels }}
# 临时目录,在拉取配置文件时,用于存储配置文件的目录,默认为:/data/bscp,可根据实际情况调整
temp_dir: {{ .Bk_Bscp_VariableTempDir }}
+
+{{ .Bk_Bscp_Variable_Rules }}
EOF
\ No newline at end of file
diff --git a/bcs-services/bcs-bscp/ui/src/assets/example-data/file-container.yaml b/bcs-services/bcs-bscp/ui/src/assets/example-data/file-container.yaml
index c342428349..dec024ed18 100644
--- a/bcs-services/bcs-bscp/ui/src/assets/example-data/file-container.yaml
+++ b/bcs-services/bcs-bscp/ui/src/assets/example-data/file-container.yaml
@@ -38,6 +38,7 @@ spec:
- name: temp_dir
value: {{ .Bk_Bscp_Variable_TempDir }}
{{ .Bk_Bscp_Variable_p2p_part1 }}
+ {{ .Bk_Bscp_Variable_Rules }}
# 需要同时挂载文件临时目录到 Init 容器,sidecar 容器,业务容器
volumeMounts:
- mountPath: {{ .Bk_Bscp_Variable_TempDir }}
diff --git a/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts b/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts
index 2f3e2a1462..a086b2931a 100644
--- a/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts
+++ b/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts
@@ -849,7 +849,7 @@ export default {
复制命令: 'Command Copy',
'仅支持字母,数字,\'-\',\'_\',\'.\' 及 \'/\' 且需以字母数字开头和结尾': 'Only supports letters, numbers, \'-\', \'_\', \'.\' and \'/\' characters, and must start and end with a letter or number',
'需以字母、数字开头和结尾,可包含 \'-\',\'_\',\'.\' 和字母数字及负数': 'Must start and end with a letter or number, can include \'-\', \'_\', \'.\', and alphanumeric characters, as well as negative numbers',
- 服务标签: 'service label',
+ 服务标签: 'Service label',
'启用 P2P 网络加速': 'Enable P2P network acceleration',
查看说明: 'View instructions',
'启用 P2P 网络加速主要适用于业务但配置文件较大及大量节点拉取配置的场景,以实现更优的文件传输速度。': 'Enabling P2P network acceleration is primarily suitable for scenarios where business configuration files are large and many nodes are pulling configurations, to achieve better file transfer speeds',
@@ -867,6 +867,15 @@ export default {
'请输入BCS 集群 ID,替换下方示例代码后,再尝试复制示例': 'Please enter the BCS cluster ID, replace the example code below, and then try copying the example',
'BCS集群ID须符合以下格式:BCS-K8S-xxxxx,其中xxxxx为5位数字': 'The BCS cluster ID must follow the format: BCS-K8S-xxxxx, where xxxxx is a five-digit numbe',
一键复制: 'Copy',
+ 启用配置文件筛选: 'Enable configuration file filtering',
+ '当客户端无需拉取配置服务中的全量配置文件时,可以启用此功能,指定相应的通配符,可仅拉取客户端所需的文件': 'When the client does not need to pull the full configuration files from the configuration service, this feature can be enabled. By specifying the appropriate wildcard, the client can pull only the required files',
+ 已设置的筛选规则: '{count} filtering rules have been set',
+ 规则设置: 'Rule configuration',
+ 配置文件筛选规则: 'Configuration file filter rules',
+ 配置文件筛选: 'Configuration file filter',
+ '全局配置文件筛选:': 'Global Configuration File Filter:',
+ '(全局配置文件筛选与服务配置文件筛选一样,不同的是全局配置文件筛选可供多个服务共用)': '(The filtering of the global configuration file is the same as that of the service configuration file; the difference is that the global configuration file can be shared among multiple services)',
+ 配置筛选规则: 'Configuration filtering rules',
// 公共组件
页面不存在: 'Page does not exist',
diff --git a/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts b/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts
index 05e6b679a4..e7935ce150 100644
--- a/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts
+++ b/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts
@@ -870,6 +870,15 @@ export default {
'请输入BCS 集群 ID,替换下方示例代码后,再尝试复制示例': '请输入BCS 集群 ID,替换下方示例代码后,再尝试复制示例',
'BCS集群ID须符合以下格式:BCS-K8S-xxxxx,其中xxxxx为5位数字': 'BCS集群ID须符合以下格式:BCS-K8S-xxxxx,其中xxxxx为5位数字',
一键复制: '一键复制',
+ 启用配置文件筛选: '启用配置文件筛选',
+ '当客户端无需拉取配置服务中的全量配置文件时,可以启用此功能,指定相应的通配符,可仅拉取客户端所需的文件': '当客户端无需拉取配置服务中的全量配置文件时,可以启用此功能,指定相应的通配符,可仅拉取客户端所需的文件',
+ 已设置的筛选规则: '已设置 {count} 个筛选规则',
+ 规则设置: '规则设置',
+ 配置文件筛选规则: '配置文件筛选规则',
+ 配置文件筛选: '配置文件筛选',
+ '全局配置文件筛选:': '全局配置文件筛选:',
+ '(全局配置文件筛选与服务配置文件筛选一样,不同的是全局配置文件筛选可供多个服务共用)': '全局配置文件筛选与服务配置文件筛选一样,不同的是全局配置文件筛选可供多个服务共用',
+ 配置筛选规则: '配置筛选规则',
// 公共组件
页面不存在: '页面不存在',
diff --git a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/associate-config.vue b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/associate-config.vue
index fe5728d488..8af37491c6 100644
--- a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/associate-config.vue
+++ b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/associate-config.vue
@@ -15,9 +15,9 @@
-
已设置 {{ ruleList.length }} 个筛选规则
+
{{ $t('已设置的筛选规则', { count: ruleList.length }) }}
- 规则设置
+ {{ $t('规则设置') }}
+ @send-example-rules="updateRule"
+ @close="handleClose" />
@@ -39,7 +40,7 @@
import { permissionCheck } from '../../../../../api/index';
import { ICredentialRule, IRuleUpdateParams } from '../../../../../../types/credential';
- const emits = defineEmits(['send-switcher']);
+ const emits = defineEmits(['updateRules']);
const route = useRoute();
@@ -96,6 +97,7 @@
const filteredVal = ruleList.value.filter((item) => !del_id.includes(item.id));
ruleList.value = filteredVal;
}
+ sendRules();
sideBarShow.value = false;
};
@@ -123,13 +125,21 @@
sideBarShow.value = true;
};
+ const handleClose = () => {
+ sideBarShow.value = false;
+ };
+
const handleSwitcher = (val: boolean) => {
configSwitch.value = val;
- sendVal(configSwitch.value);
+ if (!val) {
+ ruleList.value = [];
+ sendRules();
+ }
};
- const sendVal = (configSwitch: boolean) => {
- emits('send-switcher', configSwitch);
+ const sendRules = () => {
+ const ruleString = ruleList.value.map((item) => item.scope);
+ emits('updateRules', ruleString);
};
diff --git a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/cmd-example.vue b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/cmd-example.vue
index 7cae7e9c33..db24ea3341 100644
--- a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/cmd-example.vue
+++ b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/cmd-example.vue
@@ -3,6 +3,7 @@
{{ $t('配置指引与示例预览') }}
@@ -142,6 +143,7 @@
privacyCredential: '',
labelArr: [],
tempDir: '',
+ rules: [],
});
const cmdContent = computed(() => {
@@ -173,7 +175,19 @@
let updateString = replaceVal.value;
updateString = updateString.replace('{{ .Bk_Bscp_Variable_BkBizId }}', bkBizId.value);
updateString = updateString.replace('{{ .Bk_Bscp_Variable_ServiceName }}', basicInfo!.serviceName.value);
- replaceVal.value = updateString.replaceAll('{{ .Bk_Bscp_Variable_FEED_ADDR }}', (window as any).GRPC_ADDR);
+ updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_FEED_ADDR }}', (window as any).GRPC_ADDR);
+ // 文件配置筛选规则动态增/删
+ if (optionData.value.rules?.length) {
+ const rulesPart = `
+ # 当客户端无需拉取配置服务中的全量配置文件时,指定相应的通配符,可仅拉取客户端所需的文件,支持多个通配符
+config_matches
+${optionData.value.rules.map((rule) => `- "${rule}"`).join('\n')}`;
+ updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_Rules }}', rulesPart.trim());
+ } else {
+ updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_Rules }}', '');
+ }
+ // 去除 动态插入的值为空的情况下产生的空白行
+ replaceVal.value = updateString.replaceAll(/\r\n\s+\r\n/g, '\n');
};
const updateVariables = () => {
variables.value = [
diff --git a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/container-example.vue b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/container-example.vue
index 7b83038e2b..3feafa1007 100644
--- a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/container-example.vue
+++ b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/container-example.vue
@@ -1,6 +1,10 @@
-
+
{{ $t('示例预览') }}
{{ $t('复制示例') }}
@@ -41,6 +45,7 @@
tempDir: '',
clusterSwitch: false,
clusterInfo: '',
+ rules: [],
});
const bkBizId = ref(String(route.params.spaceId));
const replaceVal = ref('');
@@ -98,13 +103,24 @@
apiVersion: v1
fieldPath: metadata.uid`;
updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_p2p_part1 }}', p2pPart1.trim());
- replaceVal.value = updateString.replaceAll('{{ .Bk_Bscp_Variable_p2p_part2 }}', p2pPart2.trim());
+ updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_p2p_part2 }}', p2pPart2.trim());
} else {
updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_p2p_part1 }}', '');
updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_p2p_part2 }}', '');
- // 去除不含p2p相关内容后,遗留的空白行去除
- replaceVal.value = updateString.replaceAll(/\r\n\s+\r\n/g, '\n');
}
+
+ // 文件配置筛选规则动态增/删
+ if (optionData.value.rules?.length) {
+ const rulesPart = `
+ # 当客户端无需拉取配置服务中的全量配置文件时,指定相应的通配符,可仅拉取客户端所需的文件,支持多个通配符
+ - name: config_matches
+ value: ${optionData.value.rules}`;
+ updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_Rules }}', rulesPart.trim());
+ } else {
+ updateString = updateString.replaceAll('{{ .Bk_Bscp_Variable_Rules }}', '');
+ }
+ // 去除 动态插入的值为空的情况下产生的空白行
+ replaceVal.value = updateString.replaceAll(/\r\n\s+\r\n/g, '\n');
};
// 高亮配置
const updateVariables = () => {
diff --git a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/node-mana-example.vue b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/node-mana-example.vue
index a7dd1365ff..81e6a42c73 100644
--- a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/node-mana-example.vue
+++ b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/content/node-mana-example.vue
@@ -1,6 +1,10 @@
-
+
{{ $t('示例预览') }}
@@ -14,37 +18,50 @@
-
+
+
+
+
{{ $t('服务名称') }}:
+
+
+ {{ basicInfo!.serviceName.value }}
+
+
+
--
+
+
{{ $t('标签') }}:
-
- -
+
+ -
-
key
-
{{ item.key }}
-
-
-
-
value
-
{{ item.value }}
-
+
+
{{ item.key || 'key' }}
+ =
+
{{ item.value || 'value' }}
+
--
+
-
{{ $t('服务名称') }}:
-
-
- {{ basicInfo!.serviceName.value }}
-
-
+
{{ $t('配置文件筛选') }}:
+
+
--
@@ -68,6 +85,11 @@
{{ $t('(全局标签与服务标签参数一样,常用于按标签进行灰度发布;不同的是全局标签可供多个服务共用)') }}
+
+
+ {{ $t('(全局配置文件筛选与服务配置文件筛选一样,不同的是全局配置文件筛选可供多个服务共用)') }}
+
+
{{ optionData.privacyCredential }}
@@ -87,7 +109,6 @@
import BkMessage from 'bkui-vue/lib/message';
import FormOption from '../form-option.vue';
import { useI18n } from 'vue-i18n';
- // import { cloneDeep } from 'lodash';
interface labelItem {
key: String;
@@ -120,6 +141,7 @@
privacyCredential: '',
labelArr: [] as labelItem[],
tempDir: '',
+ rules: [],
});
const getOptionData = async (data: any) => {
@@ -202,8 +224,7 @@
}
.preview-content {
margin-top: 13px;
- padding: 24px 0;
- // height: 500px;
+ padding: 24px 10px 24px 0;
background-color: #f5f7fa;
.icon-shape {
font-size: 12px;
@@ -240,7 +261,7 @@
}
.label-li {
& + .label-li {
- margin-top: 24px;
+ margin-top: 8px;
}
.label-content {
display: flex;
@@ -261,21 +282,18 @@
cursor: pointer;
}
}
- .label-key {
- margin-right: 16px;
- width: 31px;
- height: 30px;
- text-align: right;
- }
- .label-value {
+ .input-wrap {
padding: 0 8px;
- width: 240px;
+ width: 212px;
height: 30px;
line-height: 30px;
border: 1px solid #dcdee5;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
+ &.full {
+ width: 440px;
+ }
}
}
.service-content {
@@ -293,14 +311,14 @@
}
.item-label {
flex-shrink: 0;
- width: 60px;
+ width: 90px;
font-size: 12px;
white-space: nowrap;
text-align: right;
color: #63656e;
line-height: 32px;
&--en {
- width: 91px;
+ width: 162px;
}
}
.item-content {
diff --git a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/form-option.vue b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/form-option.vue
index 50b63d994c..cdccc23182 100644
--- a/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/form-option.vue
+++ b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/form-option.vue
@@ -78,8 +78,7 @@
-
-
+
@@ -112,7 +111,7 @@
labelName: '标签',
p2pShow: false,
httpConfigShow: false,
- associateConfigShow: true,
+ associateConfigShow: false,
},
);
@@ -135,6 +134,7 @@
labelArr: [], // 添加的标签
clusterSwitch: false, // 集群开关
clusterInfo: 'BCS-K8S-', // 集群ID
+ rules: [], // 文件筛选规则
// clusterInfo: {
// name: '', // 集群名称
// value: '', // 集群id
diff --git a/bcs-services/bcs-bscp/ui/types/client.ts b/bcs-services/bcs-bscp/ui/types/client.ts
index 07e1d3a604..aa656225a6 100644
--- a/bcs-services/bcs-bscp/ui/types/client.ts
+++ b/bcs-services/bcs-bscp/ui/types/client.ts
@@ -168,4 +168,5 @@ export interface IExampleFormData {
labelArr: string[];
clusterSwitch?: boolean;
clusterInfo?: string;
+ rules?: string[];
}