Repository: SeldonIO/seldon-core (language: python)

Issue:
Kafka topic prefix misses allowing digits

https://github.com/SeldonIO/seldon-core/blob/v2/scheduler/pkg/kafka/topics.go#L46-L59


Discussion / hints:

Fix patch:
diff --git a/scheduler/pkg/kafka/topics.go b/scheduler/pkg/kafka/topics.go
index 5ea85d9db2..5118f11ead 100644
--- a/scheduler/pkg/kafka/topics.go
+++ b/scheduler/pkg/kafka/topics.go
@@ -44,7 +44,7 @@ type TopicNamer struct {
 }
 
 var (
-	isValidPrefix = regexp.MustCompile(`^[A-Za-z._-]+$`).MatchString
+	isValidPrefix = regexp.MustCompile(`^[A-Za-z0-9._-]+$`).MatchString
 )
 
 // Topics can only have a-z, A-Z, 0-9, . (dot), _ (underscore), and - (dash)


Test patch:
diff --git a/scheduler/pkg/kafka/topics_test.go b/scheduler/pkg/kafka/topics_test.go
index d5a8758ab4..bca6afee8c 100644
--- a/scheduler/pkg/kafka/topics_test.go
+++ b/scheduler/pkg/kafka/topics_test.go
@@ -457,6 +457,12 @@ func TestNewTopicNamer(t *testing.T) {
 			topicPrefix: "my_prefix&",
 			err:         true,
 		},
+		{
+			name:        "prefix with digits",
+			namespace:   "seldon-mesh",
+			topicPrefix: "a51691-preprod-seldon",
+			err:         false,
+		},
 	}
 	for _, test := range tests {
 		t.Run(test.name, func(t *testing.T) {