Skip to content

Commit 70cbc64

Browse files
authored
Merge pull request #16796 from rifelpet/gcp-job-name
Don't truncate the top level domains for GCP jobs
2 parents 4f8b2af + 2ef7ebd commit 70cbc64

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/e2e/kubetest2-kops/deployer/common.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,17 @@ func defaultClusterName(cloudProvider string) (string, error) {
300300
jobName = jobName[:79]
301301
}
302302
if jobType == "presubmit" {
303-
jobName = fmt.Sprintf("e2e-pr%s.%s.%s", pullNumber, jobName, suffix)
303+
jobName = fmt.Sprintf("e2e-pr%s.%s", pullNumber, jobName)
304304
} else {
305-
jobName = fmt.Sprintf("e2e-%s.%s", jobName, suffix)
305+
jobName = fmt.Sprintf("e2e-%s", jobName)
306306
}
307-
if len(jobName) > 63 && cloudProvider == "gce" { // GCP has char limit of 64
308-
jobName = jobName[:63]
307+
308+
// GCP has char limit of 64
309+
gcpLimit := 63 - (len(suffix) + 1) // 1 for the dot
310+
if len(jobName) > gcpLimit && cloudProvider == "gce" {
311+
jobName = jobName[:gcpLimit]
309312
}
310-
return jobName, nil
313+
return fmt.Sprintf("%v.%v", jobName, suffix), nil
311314
}
312315

313316
// stateStore returns the kops state store to use

0 commit comments

Comments
 (0)