Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/k8s/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ func TruncateString(s string, n int) string {
func CleanStringForDNS(s string) string {
// Keep only letters, numbers, and dashes.
re := regexp.MustCompile(`[^a-zA-Z0-9-]+`)
return re.ReplaceAllString(s, ResourceNameSeparator)
// Lowercase to ensure RFC 1123 DNS label compliance for Kubernetes resource names.
return strings.ToLower(re.ReplaceAllString(s, ResourceNameSeparator))
}

// Build ID is used as a label in k8s, and as the build ID for
Expand Down
6 changes: 6 additions & 0 deletions internal/k8s/deployments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,12 @@ func TestComputeVersionedDeploymentName(t *testing.T) {
buildID: "image-v2.1.0-a1b2c3d4",
expectedName: "worker-name-image-v2-1-0-a1b2c3d4",
},
{
name: "uppercase characters in build ID are lowercased",
baseName: "worker-name",
buildID: "master--HEAD",
expectedName: "worker-name-master--head",
},
{
name: "exceed max length",
baseName: "worker-name-0123456789-0123456789",
Expand Down
Loading