From 59a8d7fb4fa25c101e129b5f79ca96b0b4bc6630 Mon Sep 17 00:00:00 2001 From: Robusta Runner Date: Thu, 16 Jan 2025 13:17:41 +0200 Subject: [PATCH] Fixes 264 --- robusta_krr/core/integrations/kubernetes/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/robusta_krr/core/integrations/kubernetes/__init__.py b/robusta_krr/core/integrations/kubernetes/__init__.py index 6b3f23bc..8fd5ab96 100644 --- a/robusta_krr/core/integrations/kubernetes/__init__.py +++ b/robusta_krr/core/integrations/kubernetes/__init__.py @@ -184,6 +184,15 @@ def _build_selector_query(selector: Any) -> Union[str, None]: label_filters += [ ClusterLoader._get_match_expression_filter(expression) for expression in selector.match_expressions ] + + # normally the kubernetes API client renames matchLabels to match_labels in python + # but for CRDs like ArgoRollouts that renaming doesn't happen and we have selector={'matchLabels': {'app': 'test-app'}} + if getattr(selector, "matchLabels", None): + label_filters += [f"{label[0]}={label[1]}" for label in getattr(selector, "matchLabels").items()] + if getattr(selector, "matchExpressions", None): + label_filters += [ + ClusterLoader._get_match_expression_filter(expression) for expression in getattr(selector, "matchExpressions").items() + ] if label_filters == []: # NOTE: This might mean that we have DeploymentConfig,