Skip to content

Commit e3717fe

Browse files
authored
Merge pull request #1110 from ioito/automated-cherry-pick-of-#1109-upstream-release-3.12
Automated cherry pick of #1109: fix(gcp): validate gcp disk name length
2 parents 1d42dc1 + 94d7282 commit e3717fe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/multicloud/google/instance.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,14 @@ func (region *SRegion) _createVM(zone string, desc *cloudprovider.SManagedVMCrea
574574
nameConv := func(name string) string {
575575
name = strings.Replace(name, "_", "-", -1)
576576
name = pinyinutils.Text2Pinyin(name)
577-
return strings.ToLower(name)
577+
name = strings.ToLower(name)
578+
if len(name) > 63 {
579+
name = name[:63]
580+
}
581+
if name[len(name)-1] == '-' {
582+
name = name[:len(name)-1] + "1"
583+
}
584+
return name
578585
}
579586

580587
labels := map[string]string{}

0 commit comments

Comments
 (0)