diff --git a/src/robusta/core/model/services.py b/src/robusta/core/model/services.py index 84ae73059..b5a13e6ac 100644 --- a/src/robusta/core/model/services.py +++ b/src/robusta/core/model/services.py @@ -37,7 +37,9 @@ def get_container_info(container: V1Container) -> "ContainerInfo": limits = container.resources.limits if container.resources.limits else {} requests = container.resources.requests if container.resources.requests else {} resources = Resources(limits=limits, requests=requests) - return ContainerInfo(name=container.name, image=container.image, env=env, resources=resources) + ports = [p.container_port for p in container.ports] if container.ports else [] + return ContainerInfo(name=container.name, image=container.image, env=env, resources=resources, ports=ports) + @staticmethod def get_container_info_k8(container: Container) -> "ContainerInfo": @@ -49,7 +51,7 @@ def get_container_info_k8(container: Container) -> "ContainerInfo": limits = container.resources.limits if container.resources.limits else {} requests = container.resources.requests if container.resources.requests else {} resources = Resources(limits=limits, requests=requests) - ports = [p.container_port for p in container.ports] if container.ports else [] + ports = [p.containerPort for p in container.ports] if container.ports else [] return ContainerInfo(name=container.name, image=container.image, env=env, resources=resources, ports=ports) def __eq__(self, other):