Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPBUGS-46375: Allow spaces in the aws tags #9315

Open
wants to merge 1 commit into
base: release-4.17
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion pkg/types/aws/validation/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// tagRegex is used to check that the keys and values of a tag contain only valid characters.
var tagRegex = regexp.MustCompile(`^[0-9A-Za-z_.:/=+-@]*$`)
var tagRegex = regexp.MustCompile(`^[0-9A-Za-z_.:/=+-@\p{Z}]*$`)

// kubernetesNamespaceRegex is used to check that a tag key is not in the kubernetes.io namespace.
var kubernetesNamespaceRegex = regexp.MustCompile(`^([^/]*\.)?kubernetes.io/`)
Expand Down
20 changes: 20 additions & 0 deletions pkg/types/aws/validation/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,26 @@ func TestValidatePlatform(t *testing.T) {
},
expected: `^\Qtest-path.userTags[kubernetes.io/cluster/test-cluster]: Invalid value: "shared": Keys with prefix 'kubernetes.io/cluster/' are not allowed for user defined tags\E$`,
},
{
name: "invalid userTags, value with invalid characters",
platform: &aws.Platform{
Region: "us-east-1",
UserTags: map[string]string{
"usage-user": "cloud-team-rebase-bot[bot]",
},
},
expected: `^\Qtest-path.userTags[usage-user]: Invalid value: "cloud-team-rebase-bot[bot]": value contains invalid characters`,
},
{
name: "valid userTags, value with spaces",
platform: &aws.Platform{
Region: "us-east-1",
UserTags: map[string]string{
"test-key": "this test has spaces",
},
PropagateUserTag: true,
},
},
{
name: "valid userTags",
platform: &aws.Platform{
Expand Down