Skip to content

Commit 5de7ad9

Browse files
author
Yann Rouillard
committed
feat: add new check for topic name compliance in gitops validation
1 parent 2399046 commit 5de7ad9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

kp_pre_commit_hooks/gitops-values-validation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ def validate_additional_checks(self, validator, additional_checks, value, schema
246246
if check_method := getattr(self, f"validate_{camel_to_snake(check)}", None):
247247
yield from check_method(value, schema)
248248

249+
def validate_topic_name_compliance(self, value, schema):
250+
match = TOPIC_NAME_REGEXP.match(str(value))
251+
service_name = self.service_instance_config.service_name
252+
if match and match["serviceName"] != service_name:
253+
yield ValidationError(f"topicName '{value}' it not compliant, it should contain the service name '{service_name}'")
254+
249255

250256
def format_error(error: Union[ValidationError, SchemaValidationError]):
251257
if isinstance(error, SchemaValidationError):

0 commit comments

Comments
 (0)