Skip to content
New issue

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

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

Already on GitHub? # to your account

Add logics to change type when argocd rollout managed object' labels and annotations are passed #382

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
19 changes: 9 additions & 10 deletions robusta_krr/core/integrations/kubernetes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,15 @@ def __build_scannable_object(
namespace = item.metadata.namespace
kind = kind or item.__class__.__name__[2:]

labels = {}
annotations = {}
if item.metadata.labels:
labels = item.metadata.labels

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

# NOTE: Argocd Rollouts managed object' labels and annotations are interpreted as ObjectLikeDict
if labels and type(labels) is ObjectLikeDict:
labels = labels.__dict__

if annotations and type(annotations) is ObjectLikeDict:
annotations = annotations.__dict__

obj = K8sObjectData(
cluster=self.cluster,
Expand Down