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

MAIN-2538 openshift groups fixes #1633

Merged
merged 4 commits into from
Nov 17, 2024
Merged
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
4 changes: 4 additions & 0 deletions src/robusta/core/discovery/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ def discovery_process() -> DiscoveryResults:
for role_binding in role_bindings.items:
ns = role_binding.metadata.namespace

if not role_binding.subjects:
logging.info(f"Skipping role binding: {role_binding.metadata.name} in ns: {role_binding.metadata.namespace}")
continue

for subject in role_binding.subjects:
if subject.kind == "Group":
groupname_to_namespaces[subject.name].append(ns)
Expand Down
6 changes: 3 additions & 3 deletions src/robusta/core/model/openshift_group.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict
from typing import Dict, Optional

from pydantic import BaseModel

Expand All @@ -9,8 +9,8 @@ class OpenshiftGroup(BaseModel):
namespace: str = ""
users: list[str] = []
namespaces: list[str] = []
labels: Dict[str, str]
annotations: Dict[str, str]
labels: Optional[Dict[str, str]] = None
annotations: Optional[Dict[str, str]] = None
deleted: bool = False

def get_service_key(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion src/robusta/core/sinks/robusta/robusta_sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ def __discover_resources(self) -> DiscoveryResults:

self.__pods_running_count = results.pods_running_count

self.__assert_openshift_groups_cache_initialized()
if results.openshift_groups:
self.__assert_openshift_groups_cache_initialized()
self.__publish_new_openshift_groups(results.openshift_groups)

# save the cached services for the resolver.
Expand Down
Loading