From 6a5cfa75b530809c571d6cef02bea5c5ee1a01c7 Mon Sep 17 00:00:00 2001 From: itisallgood <25401000+itisallgood@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:39:31 +0200 Subject: [PATCH] Added validation for namespaces (#349) --- robusta_krr/core/models/config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/robusta_krr/core/models/config.py b/robusta_krr/core/models/config.py index 6ad5804..d7c9297 100644 --- a/robusta_krr/core/models/config.py +++ b/robusta_krr/core/models/config.py @@ -101,6 +101,11 @@ def validate_namespaces(cls, v: Union[list[str], Literal["*"]]) -> Union[list[st if v == []: return "*" + if isinstance(v, list): + for val in v: + if val.startswith("*"): + raise ValueError("Namespace's values cannot start with an asterisk (*)") + return [val.lower() for val in v] @pd.validator("resources", pre=True)