Skip to content

Commit 2bb3bd8

Browse files
committed
Allow underscore in volume ID
1 parent 18436b6 commit 2bb3bd8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

internal/util/validate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929

3030
// A regex to verify the expected format: 0000-0000-arbitrary-number-of-000-and-chars.
3131
// First two blocks are hexadecimal.
32-
var validator = regexp.MustCompile(`^[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[a-zA-Z0-9\-]+$`)
32+
var validator = regexp.MustCompile(`^[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[a-zA-Z0-9\-_]+$`)
3333

3434
// ValidateControllerPublishVolumeRequest validates the controller publish request.
3535
func ValidateControllerPublishVolumeRequest(req *csi.ControllerPublishVolumeRequest) error {

internal/util/validate_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func TestValidateVolumeID(t *testing.T) {
3434
{"valid short", "0001-0024-pool-abc", false, false},
3535
{"valid long", "0001-0024-cluster-pool-0000-0000-0000-0001", false, false},
3636
{"valid very long", "0001-000b-clusterID-1-0000000000000001-c156bd07-e430-435f-b175-56c61a2d9297", false, false},
37+
{"valid with underscore", "0001-0024-rook_ceph-pool-uuid", false, false},
3738
{"invalid very long", "00fg-01bg-clusterID-1-0000000000000001-c156bd07-e430-435f-b175-56c61a2d9297", false, true},
3839

3940
// Static Volumes, skip enforcing format.

0 commit comments

Comments
 (0)