diff --git a/bcs-ui/frontend/src/common/constant.ts b/bcs-ui/frontend/src/common/constant.ts index 1d9dd92cb0..23cf398287 100644 --- a/bcs-ui/frontend/src/common/constant.ts +++ b/bcs-ui/frontend/src/common/constant.ts @@ -26,6 +26,15 @@ export const SECRET_REGEX = '^[0-9a-zA-Z-~]+$'; export const SECRETKEY_REGEX = '^[0-9a-zA-Z/-]+$'; export const CLUSTER_NAME_REGEX = '^[0-9A-Za-z][A-Za-z0-9-_]*'; +// 只能包含小写字母([a-z])、数字字符([0-9])、下划线(_)和破折号(-),并且必须以字母开头 +export const GKE_LABEL_NAME_REGEX = '^[a-z][a-z0-9_-]*$'; + +// 内网cidr 正则 +export const INTRANET_CIDR_REGEX = '\\b(10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|172\\.(1[6-9]|2[0-9]|3[0-1])\\.\\d{1,3}\\.\\d{1,3}|192\\.168\\.\\d{1,3}\\.\\d{1,3})\\/([0-9]|[1-2][0-9]|3[0-2])\\b'; + +// 公网cidr 正则 +export const INTERNET_CIDR_REGEX = '\\b((?!(10|127)\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|172\\.(1[6-9]|2[0-9]|3[0-1])\\.\\d{1,3}\\.\\d{1,3}|192\\.168\\.\\d{1,3}\\.\\d{1,3}|0\\.0\\.0\\.0|255\\.255\\.255\\.255))(\\d{1,3}\\.){3}\\d{1,3}\\/([0-9]|[1-2][0-9]|3[0-2])\\b'; + // 集群环境 export const CLUSTER_ENV = { stag: 'UAT', diff --git a/bcs-ui/frontend/src/i18n/en-US.yaml b/bcs-ui/frontend/src/i18n/en-US.yaml index 9af0403955..53f06b992c 100644 --- a/bcs-ui/frontend/src/i18n/en-US.yaml +++ b/bcs-ui/frontend/src/i18n/en-US.yaml @@ -30,6 +30,8 @@ bcs: cloud: Cloud credential import platform: Platform created machine: Machine + autopilot: AutoPilot + standard: Standard msg: emptyHostResource: >- You do not have any host resources under the current business. Please @@ -500,6 +502,9 @@ generic: clusterName: >- The cluster name can only contain numbers, letters, mid-line lines (-), down line (_), The beginning must be numbers or letters + gkeLable: >- + Can only contain lowercase letters ([a-z]), numeric characters ([0-9]), + underscores (_), and dashes (-), and must start with a letter title: curVersion: Current diffVersion: Comparison version @@ -956,6 +961,24 @@ cluster: create a new Safety group, please go to the appropriate page in the {0}.' vpcMaster: VPC console + google: + labels: + areaType: Area Type + region: region + zone: zone + tips: + containerNet: >- + All pods in the cluster will be assigned an IP address from this range. + Please enter a range and mask in CIDR notation within the network range. + Once this setting is confirmed, it cannot be changed, so please evaluate + carefully before filling it in. + autopilot: >- + GKE manages the underlying infrastructure, such as node configuration, + auto-scaling, automatic upgrades, baseline security configurations, + and baseline network configurations. + standard: >- + You are responsible for managing the underlying infrastructure, + including configuring the individual nodes. detail: title: overview: Overview diff --git a/bcs-ui/frontend/src/i18n/zh-CN.yaml b/bcs-ui/frontend/src/i18n/zh-CN.yaml index b4d611fac8..5eecd3b90e 100644 --- a/bcs-ui/frontend/src/i18n/zh-CN.yaml +++ b/bcs-ui/frontend/src/i18n/zh-CN.yaml @@ -24,6 +24,8 @@ bcs: cloud: 云凭证导入 platform: 平台创建 machine: 控制面服务器导入 + autopilot: 托管集群 + standard: 标准集群 msg: emptyHostResource: 您在当前业务下没有主机资源,请联系业务运维 notDevOps: 您不是当前项目绑定业务的运维人员,请联系业务运维人员 @@ -462,6 +464,7 @@ generic: fieldRequired: '{0} 必填' fieldRepeat: '{0} 重复' clusterName: 集群名称只能包含数字、字母、中划线(-)、下划线(_),且开头必须是数字或字母 + gkeLable: '只能包含小写字母([a-z])、数字字符([0-9])、下划线(_)和破折号(-),并且必须以字母开头' title: createPublicCluster: 新建公有云集群 diffVersion: 线上版本 @@ -807,6 +810,15 @@ cluster: text: 安全组 vpcLink: '选择将应用到在您的控制平面子网中创建的 AKS 托管弹性网络接口的安全组。 要创建新的安全组,请转到 {0} 中的相应页面。' vpcMaster: VPC 控制台 + google: + labels: + areaType: 位置类型 + region: 区域 + zone: 可用区 + tips: + containerNet: 集群中所有 pod 都会分配一个此范围的IP地址。请以 CIDR 表示法输入网络范围内一个范围、掩码,此设置一经确定便无法更改,请谨慎评估后填写 + autopilot: GKE管理底层基础架构,例如节点配置、自动扩缩、自动升级、基准安全配置和基准网络配置。 + standard: 您负责管理底层基础架构,包括配置各个节点。 detail: title: overview: 集群总览 diff --git a/bcs-ui/frontend/src/router/cluster-manage.ts b/bcs-ui/frontend/src/router/cluster-manage.ts index d5beb71457..b5f0d877ff 100644 --- a/bcs-ui/frontend/src/router/cluster-manage.ts +++ b/bcs-ui/frontend/src/router/cluster-manage.ts @@ -14,8 +14,10 @@ const CreateVCluster = () => import(/* webpackChunkName: 'cluster' */'@/views/cl const CreateK8SCluster = () => import(/* webpackChunkName: 'cluster' */'@/views/cluster-manage/add/create/k8s.vue'); // 创建aws云集群 const CreateAWSCloudCluster = () => import(/* webpackChunkName: 'cluster' */'@/views/cluster-manage/add/create/aws-cloud/index.vue'); -// 创建aws云集群 +// 创建微软云集群 const CreateAzureCloudCluster = () => import(/* webpackChunkName: 'cluster' */'@/views/cluster-manage/add/create/azure-cloud/index.vue'); +// 创建谷歌云集群 +const CreateGoogleCloudCluster = () => import(/* webpackChunkName: 'cluster' */'@/views/cluster-manage/add/create/google-cloud/index.vue'); // import模式 const ImportCluster = () => import(/* webpackChunkName: 'cluster' */'@/views/cluster-manage/add/import/import-cluster.vue'); @@ -177,6 +179,16 @@ export default [ hideMenu: true, }, }, + // 创建谷歌云集群 + { + path: 'clusters/cloud/google', + name: 'CreateGoogleCloudCluster', + component: CreateGoogleCloudCluster, + meta: { + menuId: 'CLUSTER', + hideMenu: true, + }, + }, // 创建k8s原生集群 { path: 'clusters/k8s', diff --git a/bcs-ui/frontend/src/views/cluster-manage/add/components/region.vue b/bcs-ui/frontend/src/views/cluster-manage/add/components/region.vue index 97930e74f2..7a9252bd3d 100644 --- a/bcs-ui/frontend/src/views/cluster-manage/add/components/region.vue +++ b/bcs-ui/frontend/src/views/cluster-manage/add/components/region.vue @@ -41,6 +41,10 @@ const props = defineProps({ type: Boolean, default: false, }, + filter: { + type: Function, + default: null, + }, }); const emits = defineEmits(['input', 'change']); // 区域列表 @@ -56,6 +60,9 @@ const handleGetRegionList = async () => { }).catch(() => []); $store.commit('cloudMetadata/updateRegionList', data); regionList.value = data.filter(item => item.regionState === 'AVAILABLE'); + if (props.filter) { + regionList.value = props.filter(regionList.value, handleGetRegionList); + } regionLoading.value = false; }; diff --git a/bcs-ui/frontend/src/views/cluster-manage/add/components/subnet.vue b/bcs-ui/frontend/src/views/cluster-manage/add/components/subnet.vue new file mode 100644 index 0000000000..85dc64ce78 --- /dev/null +++ b/bcs-ui/frontend/src/views/cluster-manage/add/components/subnet.vue @@ -0,0 +1,95 @@ + + diff --git a/bcs-ui/frontend/src/views/cluster-manage/add/components/vpc.vue b/bcs-ui/frontend/src/views/cluster-manage/add/components/vpc.vue index dd69bfcc2a..59d01e61f9 100644 --- a/bcs-ui/frontend/src/views/cluster-manage/add/components/vpc.vue +++ b/bcs-ui/frontend/src/views/cluster-manage/add/components/vpc.vue @@ -10,7 +10,7 @@
@@ -20,6 +20,7 @@
+ @change="handleChange" />
{{ $t('generic.button.pre') }} @@ -86,10 +86,8 @@ const masterConfig = ref({ autoGenerateMasterNodes: true, clusterAdvanceSettings: { clusterConnectSetting: { - ITNType: 'intranet', isExtranet: false, subnetId: '', - cidrs: [], internet: { publicIPAssigned: false, publicAccessCidrs: [], @@ -98,6 +96,16 @@ const masterConfig = ref({ }, }); +const connectConfig = ref({ + ITNType: 'intranet', + isExtranet: false, + cidrs: [], + internet: { + publicIPAssigned: false, + publicAccessCidrs: [], + }, +}); + const networkSelectorRef = ref | null>(null); // 动态 i18n 问题,这里使用computed const masterConfigRules = computed(() => ({ @@ -106,7 +114,7 @@ const masterConfigRules = computed(() => ({ trigger: 'blur', message: $i18n.t('generic.validate.required'), async validator() { - if (masterConfig.value.clusterAdvanceSettings.clusterConnectSetting.ITNType === 'internet') { + if (connectConfig.value.ITNType === 'internet') { return await networkSelectorRef.value?.validate(); } return true; @@ -115,6 +123,16 @@ const masterConfigRules = computed(() => ({ ], })); +// 整理参数 +function handleChange(data) { + connectConfig.value = data; + masterConfig.value.clusterAdvanceSettings.clusterConnectSetting.isExtranet = data?.isExtranet; + // eslint-disable-next-line max-len + masterConfig.value.clusterAdvanceSettings.clusterConnectSetting.internet.publicAccessCidrs = data?.internet?.publicAccessCidrs; + // eslint-disable-next-line max-len + if (!data?.isExtranet) masterConfig.value.clusterAdvanceSettings.clusterConnectSetting.internet.publicAccessCidrs = []; +}; + // master配置 const handleChangeManageType = (type: 'INDEPENDENT_CLUSTER' | 'MANAGED_CLUSTER') => { masterConfig.value.manageType = type; diff --git a/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/basic-pool-info.vue b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/basic-pool-info.vue new file mode 100644 index 0000000000..640ddc4c1a --- /dev/null +++ b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/basic-pool-info.vue @@ -0,0 +1,309 @@ + + + + diff --git a/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/basic.vue b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/basic.vue new file mode 100644 index 0000000000..fed3acd707 --- /dev/null +++ b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/basic.vue @@ -0,0 +1,387 @@ + + + diff --git a/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/index.vue b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/index.vue new file mode 100644 index 0000000000..e2d5eab77b --- /dev/null +++ b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/index.vue @@ -0,0 +1,311 @@ + + + + diff --git a/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/master.vue b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/master.vue new file mode 100644 index 0000000000..20a0575c4c --- /dev/null +++ b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/master.vue @@ -0,0 +1,173 @@ + + diff --git a/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/network.vue b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/network.vue new file mode 100644 index 0000000000..ab1439ee3a --- /dev/null +++ b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/network.vue @@ -0,0 +1,399 @@ + + + diff --git a/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/node-pool-config.vue b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/node-pool-config.vue new file mode 100644 index 0000000000..0ce2c35877 --- /dev/null +++ b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/node-pool-config.vue @@ -0,0 +1,795 @@ + + + + diff --git a/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/node-pool-info.vue b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/node-pool-info.vue new file mode 100644 index 0000000000..d7a7414b85 --- /dev/null +++ b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/node-pool-info.vue @@ -0,0 +1,287 @@ + + diff --git a/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/nodes.vue b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/nodes.vue new file mode 100644 index 0000000000..2f1f77d2b5 --- /dev/null +++ b/bcs-ui/frontend/src/views/cluster-manage/add/create/google-cloud/nodes.vue @@ -0,0 +1,560 @@ + + + diff --git a/bcs-ui/frontend/src/views/cluster-manage/add/index.vue b/bcs-ui/frontend/src/views/cluster-manage/add/index.vue index 9fef5502a5..1072e81cd9 100644 --- a/bcs-ui/frontend/src/views/cluster-manage/add/index.vue +++ b/bcs-ui/frontend/src/views/cluster-manage/add/index.vue @@ -158,7 +158,6 @@ export default defineComponent({ title: $i18n.t('publicCloud.google.title'), desc: $i18n.t('publicCloud.google.desc'), type: 'createGoogleCloud', - disabled: true, }, // Azure { @@ -289,6 +288,7 @@ export default defineComponent({ createTencentCloud: 'createTKECluster', createAWSCloud: 'CreateAWSCloudCluster', createAzureCloud: 'CreateAzureCloudCluster', + createGoogleCloud: 'CreateGoogleCloudCluster', createK8S: 'createK8SCluster', createVCluster: 'createVCluster', // importKubeConfig: 'importCluster', diff --git a/bcs-ui/frontend/src/views/cluster-manage/autoscaler/google/node-config.vue b/bcs-ui/frontend/src/views/cluster-manage/autoscaler/google/node-config.vue index f714a3f99a..9ed3814c7a 100644 --- a/bcs-ui/frontend/src/views/cluster-manage/autoscaler/google/node-config.vue +++ b/bcs-ui/frontend/src/views/cluster-manage/autoscaler/google/node-config.vue @@ -287,8 +287,8 @@ import { computed, defineComponent, onMounted, ref, toRefs, watch } from 'vue'; import { cloudsZones } from '@/api/modules/cluster-manager'; import FormGroup from '@/components/form-group.vue'; -import usePage from '@/composables/use-page'; import { useFocusOnErrorField } from '@/composables/use-focus-on-error-field'; +import usePage from '@/composables/use-page'; import $i18n from '@/i18n/i18n-setup'; import $router from '@/router'; import $store from '@/store/index'; @@ -348,6 +348,7 @@ export default defineComponent({ vpcID: '', // todo 放在basic-pool-info组件比较合适 zones: defaultValues.value.autoScaling?.zones || [], }, + nodeOS: defaultValues.value.launchTemplate?.imageInfo?.imageName, // 操作系统类型 launchTemplate: { imageInfo: { imageName: defaultValues.value.launchTemplate?.imageInfo?.imageName, // 镜像名称 @@ -663,6 +664,7 @@ export default defineComponent({ // CPU和mem信息从机型获取 nodePoolConfig.value.launchTemplate.CPU = curInstanceItem.value.cpu; nodePoolConfig.value.launchTemplate.Mem = curInstanceItem.value.memory; + nodePoolConfig.value.nodeOS = nodePoolConfig.value.launchTemplate.imageInfo.imageName; return nodePoolConfig.value; }; const validate = async () => { @@ -690,7 +692,7 @@ export default defineComponent({ return true; }; - + const { focusOnErrorField } = useFocusOnErrorField(); const handleNext = async () => { // 校验错误滚动到第一个错误的位置 diff --git a/bcs-ui/frontend/src/views/cluster-manage/autoscaler/google/node-pool-detail.vue b/bcs-ui/frontend/src/views/cluster-manage/autoscaler/google/node-pool-detail.vue index 5f5d9596f4..a11b2382f6 100644 --- a/bcs-ui/frontend/src/views/cluster-manage/autoscaler/google/node-pool-detail.vue +++ b/bcs-ui/frontend/src/views/cluster-manage/autoscaler/google/node-pool-detail.vue @@ -85,7 +85,7 @@ {{ cloudAreaName || '--' }} - {{clusterOS || '--'}} + {{nodeOS || '--'}} {{`${clusterData.clusterAdvanceSettings @@ -331,6 +331,7 @@ export default defineComponent({ ]); // 获取详情 + const nodeOS = computed(() => nodePoolData.value?.nodeOS); const getNodeGroupDetail = async () => { nodePoolData.value = await $store.dispatch('clustermanager/nodeGroupDetail', { $nodeGroupID: props.nodeGroupID, @@ -440,6 +441,7 @@ export default defineComponent({ zoneLoading, cloudAreaLoading, cloudAreaName, + nodeOS, }; }, }); diff --git a/bcs-ui/frontend/src/views/cluster-manage/detail/master/master-gcp.vue b/bcs-ui/frontend/src/views/cluster-manage/detail/master/master-gcp.vue index 525362dd0a..d965b49116 100644 --- a/bcs-ui/frontend/src/views/cluster-manage/detail/master/master-gcp.vue +++ b/bcs-ui/frontend/src/views/cluster-manage/detail/master/master-gcp.vue @@ -3,11 +3,14 @@ - {{ $t('bcs.cluster.managed') }} + {{ manageType === 'MANAGED_CLUSTER' ? $t('bcs.cluster.autopilot') : $t('bcs.cluster.standard') }} - + ({{ $t('cluster.create.label.manageType.managed.gkeDesc') }}) + + ({{ $t('cluster.create.google.tips.standard') }}) + @@ -43,10 +46,14 @@ export default defineComponent({ // google cloud locationType const locationType = computed(() => curCluster.value?.extraInfo?.locationType); + // google cloud manageType + const manageType = computed(() => curCluster.value?.manageType); + return { curCluster, locationType, + manageType, }; }, }); diff --git a/bcs-ui/frontend/src/views/cluster-manage/node-list/node.vue b/bcs-ui/frontend/src/views/cluster-manage/node-list/node.vue index 2ff217557d..60b5dd11d0 100644 --- a/bcs-ui/frontend/src/views/cluster-manage/node-list/node.vue +++ b/bcs-ui/frontend/src/views/cluster-manage/node-list/node.vue @@ -8,7 +8,7 @@
{{$t('cluster.nodeList.article1')}} - + {{ clusterData.extraInfo?.clusterCurNodeNum || '--' }} {{ clusterData.extraInfo?.clusterSupNodeNum || '--' }} @@ -20,46 +20,47 @@
- + : + + +
+
@@ -571,7 +572,7 @@