Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Krr custom resources labels #378

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions robusta_krr/core/integrations/kubernetes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,12 @@ def __build_scannable_object(
kind = kind or item.__class__.__name__[2:]

labels = {}
annotations = {}
if item.metadata.labels:
if type(item.metadata.labels) is ObjectLikeDict:
labels = item.metadata.labels.__dict__
else:
labels = item.metadata.labels

annotations = {}
if item.metadata.annotations:
if type(item.metadata.annotations) is ObjectLikeDict:
annotations = item.metadata.annotations.__dict__
Expand Down
5 changes: 4 additions & 1 deletion robusta_krr/core/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,10 @@ async def _collect_result(self) -> Result:
if not clusters or len(clusters) == 1:
cluster_name = clusters[0] if clusters else None # its none if krr is running inside cluster
prometheus_loader = self._get_prometheus_loader(cluster_name)
cluster_summary = await prometheus_loader.get_cluster_summary()
if prometheus_loader:
cluster_summary = await prometheus_loader.get_cluster_summary()
else:
cluster_summary = {}
else:
cluster_summary = {}
scans = await asyncio.gather(*[self._gather_object_allocations(k8s_object) for k8s_object in workloads])
Expand Down
Loading