Skip to content

Commit 59a8d7f

Browse files
committed
Fixes 264
1 parent 89d1b9f commit 59a8d7f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

robusta_krr/core/integrations/kubernetes/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,15 @@ def _build_selector_query(selector: Any) -> Union[str, None]:
184184
label_filters += [
185185
ClusterLoader._get_match_expression_filter(expression) for expression in selector.match_expressions
186186
]
187+
188+
# normally the kubernetes API client renames matchLabels to match_labels in python
189+
# but for CRDs like ArgoRollouts that renaming doesn't happen and we have selector={'matchLabels': {'app': 'test-app'}}
190+
if getattr(selector, "matchLabels", None):
191+
label_filters += [f"{label[0]}={label[1]}" for label in getattr(selector, "matchLabels").items()]
192+
if getattr(selector, "matchExpressions", None):
193+
label_filters += [
194+
ClusterLoader._get_match_expression_filter(expression) for expression in getattr(selector, "matchExpressions").items()
195+
]
187196

188197
if label_filters == []:
189198
# NOTE: This might mean that we have DeploymentConfig,

0 commit comments

Comments
 (0)