diff --git a/bcs-services/cluster-resources/pkg/i18n/locale/lc_msgs.yaml b/bcs-services/cluster-resources/pkg/i18n/locale/lc_msgs.yaml index d610aba5d8..1edb13ab68 100644 --- a/bcs-services/cluster-resources/pkg/i18n/locale/lc_msgs.yaml +++ b/bcs-services/cluster-resources/pkg/i18n/locale/lc_msgs.yaml @@ -72,6 +72,8 @@ en: "value required" - msgID: "仅支持小写字母,数字及 '-' 且需以字母数字开头和结尾" en: "only lowercase letters, numbers and '-' are supported and must start and end with an alphanumeric" +- msgID: "必须由小写字母数字字符或'-'组成,并且必须以字母数字字符开头和结尾" + en: "must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character" - msgID: 仅可包含数字字符与小数点 en: "can only contain numeric characters and decimal points" - msgID: 超过长度限制(64) diff --git a/bcs-services/cluster-resources/pkg/resource/form/renderer/schema.go b/bcs-services/cluster-resources/pkg/resource/form/renderer/schema.go index 722ee28cc2..a2635c65e3 100644 --- a/bcs-services/cluster-resources/pkg/resource/form/renderer/schema.go +++ b/bcs-services/cluster-resources/pkg/resource/form/renderer/schema.go @@ -169,6 +169,10 @@ func genSchemaRules(ctx context.Context) map[string]interface{} { "validator": "/^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*|{{.*}})$/", "message": i18n.GetMsg(ctx, "仅支持小写字母,数字及 '-' 且需以字母数字开头和结尾"), }, + "rfc1123LabelRegex": map[string]interface{}{ + "validator": "/^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/", + "message": i18n.GetMsg(ctx, "必须由小写字母数字字符或'-'组成,并且必须以字母数字字符开头和结尾"), + }, "numberRegex": map[string]interface{}{ "validator": "/^[0-9]+(\\.[0-9])?[0-9]*$/", "message": i18n.GetMsg(ctx, "仅可包含数字字符与小数点"), diff --git a/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/PersistentVolume.yaml b/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/PersistentVolume.yaml index 6f7bb424da..6571387d1b 100644 --- a/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/PersistentVolume.yaml +++ b/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/PersistentVolume.yaml @@ -80,6 +80,7 @@ properties: accessModes: title: {{ i18n "访问模式" .lang }} type: array + default: ["ReadWriteOnce"] items: type: string ui:component: @@ -99,6 +100,7 @@ properties: message: {{ i18n "至少选择一个 AccessMode" .lang }} scName: title: {{ i18n "存储类名称" .lang }} + default: fast-storage type: string storageSize: title: {{ i18n "容量" .lang }} @@ -113,6 +115,7 @@ properties: localPath: title: Path type: string + default: /tmp/data ui:rules: - validator: "{{`{{`}} $self.getValue('spec.type') !== 'local' || $self.value {{`}}`}}" message: {{ i18n "值不能为空" .lang }} diff --git a/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/PersistentVolumeClaim.yaml b/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/PersistentVolumeClaim.yaml index 54f07637d3..915a50e4cc 100644 --- a/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/PersistentVolumeClaim.yaml +++ b/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/PersistentVolumeClaim.yaml @@ -93,6 +93,7 @@ properties: accessModes: title: {{ i18n "访问模式" .lang }} type: array + default: ["ReadWriteOnce"] items: type: string ui:component: diff --git a/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/hpa.tpl b/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/hpa.tpl index 04cd974a72..df12e20336 100644 --- a/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/hpa.tpl +++ b/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/hpa.tpl @@ -50,6 +50,7 @@ ref: resName: title: {{ i18n "资源名称" .lang }} type: string + default: deployment-test ui:rules: - required minReplicas: diff --git a/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/network.tpl b/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/network.tpl index 0fd0ce8801..76049d7578 100644 --- a/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/network.tpl +++ b/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/network.tpl @@ -59,6 +59,7 @@ ruleConf: path: title: {{ i18n "路径" .lang }} type: string + default: /testpath ui:rules: - required - maxLength128 @@ -67,11 +68,13 @@ ruleConf: targetSVC: title: {{ i18n "目标 Service" .lang }} type: string + default: test ui:rules: - required port: title: {{ i18n "端口" .lang }} type: integer + default: 80 ui:component: props: min: 1 @@ -136,6 +139,7 @@ network: existLBID: title: "CLB ID" type: string + default: lb-c5xxxxd6 ui:component: props: placeholder: {{ i18n "例如:lb-c5xxxxd6" .lang | quote }} @@ -334,9 +338,11 @@ portConf: type: string ui:rules: - maxLength64 + - rfc1123LabelRegex port: title: {{ i18n "监听端口" .lang }} type: integer + default: 80 ui:component: props: min: 1 @@ -360,6 +366,7 @@ portConf: targetPort: title: {{ i18n "目标端口" .lang }} type: string + default: "80" ui:rules: - validator: "{{`{{`}} $self.value {{`}}`}}" message: {{ i18n "值不能为空" .lang }} @@ -399,10 +406,6 @@ portConf: selector: title: {{ i18n "选择器" .lang }} type: object - required: - - associatedResources - - associatedApplications - - labels properties: associatedResources: title: {{ i18n "关联资源" .lang }} @@ -437,8 +440,6 @@ selector: value: "" actions: - "{{`{{`}} $loadDataSource {{`}}`}}" - ui:rules: - - required labels: title: {{ i18n "标签选择器" .lang }} type: array diff --git a/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/volume.tpl b/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/volume.tpl index 9581ef21cd..20f7d41e19 100644 --- a/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/volume.tpl +++ b/bcs-services/cluster-resources/pkg/resource/form/tmpl/filetmpl/schema/volume.tpl @@ -11,7 +11,7 @@ pvc: ui:rules: - required - maxLength64 - - nameRegexWithVar + - rfc1123LabelRegex pvcName: title: PersistentVolumeClaim type: string @@ -53,7 +53,7 @@ hostPath: ui:rules: - required - maxLength128 - - nameRegexWithVar + - rfc1123LabelRegex path: title: {{ i18n "路径或节点" .lang }} type: string @@ -105,7 +105,7 @@ configMap: ui:rules: - required - maxLength128 - - nameRegexWithVar + - rfc1123LabelRegex defaultMode: title: {{ i18n "默认模式" .lang }} type: string @@ -168,7 +168,7 @@ secret: ui:rules: - required - maxLength128 - - nameRegexWithVar + - rfc1123LabelRegex defaultMode: title: {{ i18n "默认模式" .lang }} type: string @@ -228,7 +228,7 @@ emptyDir: ui:rules: - required - maxLength128 - - nameRegexWithVar + - rfc1123LabelRegex ui:component: name: bfArray ui:props: @@ -248,7 +248,7 @@ nfs: ui:rules: - required - maxLength128 - - nameRegexWithVar + - rfc1123LabelRegex path: title: {{ i18n "路径" .lang }} type: string diff --git a/bcs-services/cluster-resources/pkg/resource/form/tmpl/schema/common.tpl b/bcs-services/cluster-resources/pkg/resource/form/tmpl/schema/common.tpl index a61261c5f5..c6cea3220a 100644 --- a/bcs-services/cluster-resources/pkg/resource/form/tmpl/schema/common.tpl +++ b/bcs-services/cluster-resources/pkg/resource/form/tmpl/schema/common.tpl @@ -38,7 +38,7 @@ metadata: ui:rules: - required - maxLength128 - - nameRegex + - rfc1123LabelRegex namespace: title: {{ i18n "命名空间" .lang }} type: string @@ -63,7 +63,7 @@ metadata: ui:rules: - required - maxLength64 - - nameRegex + - rfc1123LabelRegex labels: title: {{ i18n "标签" .lang }} type: array diff --git a/bcs-services/cluster-resources/pkg/resource/form/tmpl/schema/network.tpl b/bcs-services/cluster-resources/pkg/resource/form/tmpl/schema/network.tpl index fabc8fda97..e1de21485b 100644 --- a/bcs-services/cluster-resources/pkg/resource/form/tmpl/schema/network.tpl +++ b/bcs-services/cluster-resources/pkg/resource/form/tmpl/schema/network.tpl @@ -395,6 +395,7 @@ portConf: type: string ui:rules: - maxLength64 + - rfc1123LabelRegex port: title: {{ i18n "监听端口" .lang }} type: integer diff --git a/bcs-services/cluster-resources/pkg/resource/form/tmpl/schema/volume.tpl b/bcs-services/cluster-resources/pkg/resource/form/tmpl/schema/volume.tpl index c403608e8f..779df9d2c2 100644 --- a/bcs-services/cluster-resources/pkg/resource/form/tmpl/schema/volume.tpl +++ b/bcs-services/cluster-resources/pkg/resource/form/tmpl/schema/volume.tpl @@ -11,7 +11,7 @@ pvc: ui:rules: - required - maxLength64 - - nameRegex + - rfc1123LabelRegex pvcName: title: PersistentVolumeClaim type: string @@ -59,7 +59,7 @@ hostPath: ui:rules: - required - maxLength128 - - nameRegex + - rfc1123LabelRegex path: title: {{ i18n "路径或节点" .lang }} type: string @@ -111,7 +111,7 @@ configMap: ui:rules: - required - maxLength128 - - nameRegex + - rfc1123LabelRegex defaultMode: title: {{ i18n "默认模式" .lang }} type: string @@ -189,7 +189,7 @@ secret: ui:rules: - required - maxLength128 - - nameRegex + - rfc1123LabelRegex defaultMode: title: {{ i18n "默认模式" .lang }} type: string @@ -264,7 +264,7 @@ emptyDir: ui:rules: - required - maxLength128 - - nameRegex + - rfc1123LabelRegex ui:component: name: bfArray ui:props: @@ -284,7 +284,7 @@ nfs: ui:rules: - required - maxLength128 - - nameRegex + - rfc1123LabelRegex path: title: {{ i18n "路径" .lang }} type: string