diff --git a/pkg/migrate/migrate.go b/pkg/migrate/migrate.go index 73072d3..346732a 100644 --- a/pkg/migrate/migrate.go +++ b/pkg/migrate/migrate.go @@ -585,12 +585,12 @@ const nameSuffix = "-pvcmigrate" // TODO: refactor to k8sutil package func newPvcName(originalName string) string { candidate := originalName + nameSuffix - if len(candidate) <= 63 { + if len(candidate) <= 253 { return candidate } // remove characters from the middle of the string to reduce the total length to 63 characters - newCandidate := candidate[0:31] + candidate[len(candidate)-32:] + newCandidate := candidate[0:100] + candidate[len(candidate)-153:] return newCandidate } diff --git a/pkg/migrate/migrate_test.go b/pkg/migrate/migrate_test.go index 0e94205..dc20009 100644 --- a/pkg/migrate/migrate_test.go +++ b/pkg/migrate/migrate_test.go @@ -3230,16 +3230,16 @@ func Test_newPvcName(t *testing.T) { want: "abc-pvcmigrate", }, { - originalName: "very very very long name test with a suffix that might be the only unique part of it 0", - want: "very very very long name test wy unique part of it 0-pvcmigrate", + originalName: "very very very 253longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong name test with a suffix that might be the only unique part of it 0", + want: "very very very 253longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongloonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong name test with a suffix that might be the only unique part of it 0-pvcmigrate", }, { - originalName: "0 very very very long name test with a prefix that might be the only unique part of it", - want: "0 very very very long name testnly unique part of it-pvcmigrate", + originalName: "0 very very very 253longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong name test with a prefix that might be the only unique part of it", + want: "0 very very very 253longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong name test with a prefix that might be the only unique part of it-pvcmigrate", }, { - originalName: "63 character (after suffix) name is untouched paddin", - want: "63 character (after suffix) name is untouched paddin-pvcmigrate", + originalName: "253 character (after suffix) 253longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong name is untouched paddin", + want: "253 character (after suffix) 253longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong name is untouched paddin-pvcmigrate", }, } for _, tt := range tests {