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

feat(kubernetes): added base class K8SEdgeBuilder #3530

Merged
merged 5 commits into from
Sep 19, 2022
Merged
Changes from 4 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from __future__ import annotations
from abc import abstractmethod

from checkov.kubernetes.graph_builder.graph_components.blocks import KubernetesBlock

PelegLi marked this conversation as resolved.
Show resolved Hide resolved
class K8SEdgeBuilder:

@abstractmethod
def should_search_for_edges(self, vertex: KubernetesBlock) -> bool:
"""
implementation should examine vertex's attributes and indicate if it's potentially
suitable for the concrete class's edge type.
e.g: search for a label attribute in LabelSelectorEdgeBuilder's implementation
"""
raise NotImplementedError

@abstractmethod
def find_connection(self, vertex: KubernetesBlock, vertices: list[KubernetesBlock]) -> list[KubernetesBlock]:
PelegLi marked this conversation as resolved.
Show resolved Hide resolved
"""
implementation should search in each of the vertices for a possible connection
to the vertex param according to the concrete class's rule(s).
e.g: find vertices with a label attribute that match current vertex's selector attribute
"""
raise NotImplementedError