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 new file mode 100644 index 0000000000..8af37491c6 --- /dev/null +++ b/bcs-services/bcs-bscp/ui/src/views/space/client/example/components/associate-config.vue @@ -0,0 +1,229 @@ + + + + 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 @@