diff --git a/pyproject.toml b/pyproject.toml index bf0ac5a..3113b3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ dependencies = [ "jsontas~=1.3", "packageurl-python~=0.11", "etcd3gw~=2.3", - "etos-lib==4.4.1", + "etos-lib==4.4.2", "opentelemetry-api~=1.21", "opentelemetry-exporter-otlp~=1.21", "opentelemetry-sdk~=1.21", diff --git a/src/environment_provider/lib/config.py b/src/environment_provider/lib/config.py index 406ac58..61076c2 100644 --- a/src/environment_provider/lib/config.py +++ b/src/environment_provider/lib/config.py @@ -20,6 +20,7 @@ import os from typing import Optional +from urllib3.exceptions import MaxRetryError from etos_lib import ETOS from etos_lib.kubernetes.schemas.testrun import Suite from etos_lib.kubernetes.schemas.environment_request import ( @@ -59,9 +60,18 @@ def __init__(self, etos: ETOS, kubernetes: Kubernetes, ids: Optional[list[str]] @property def etos_controller(self) -> bool: """Whether or not the environment provider is running as a part of the ETOS controller.""" - request = EnvironmentRequest(self.kubernetes) - request_name = os.getenv("REQUEST") - return request_name is not None and request.exists(request_name) + try: + request = EnvironmentRequest(self.kubernetes) + request_name = os.getenv("REQUEST") + return request_name is not None and request.exists(request_name) + except MaxRetryError: + self.logger.warning( + "Could not initialize EnvironmentRequest client, " + "assuming that the environment provider is not running " + "in Kubernetes or that the ETOS controller system is not " + "deployed in this cluster." + ) + return False def load_config(self) -> None: """Load config from environment variables."""