Skip to content

Conversation

@pantierra
Copy link
Contributor

@pantierra pantierra commented Nov 24, 2025

This could be useful when the auth server is deployed with stac-auth-proxy and we need to wait.
At least in eoAPI would be good for testing (developmentseed/eoapi-k8s#358).

@pantierra pantierra requested review from alukach and batpad November 24, 2025 22:02
Copy link
Member

@alukach alukach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll be honest that this is a bit beyond my knowledge but it appears reasonable

@alukach
Copy link
Member

alukach commented Nov 24, 2025

I should also note that today, the STAC Auth Proxy does do a wait for the upstream STAC API to be available before accepting requests:

async def check_server_health(
url: str | HttpUrl,
max_retries: int = 10,
retry_delay: float = 1.0,
retry_delay_max: float = 5.0,
timeout: float = 5.0,
) -> None:
"""Wait for upstream API to become available."""
# Convert url to string if it's a HttpUrl
if isinstance(url, HttpUrl):
url = str(url)
async with httpx.AsyncClient(
base_url=url, timeout=timeout, follow_redirects=True
) as client:
for attempt in range(max_retries):
try:
response = await client.get("/")
response.raise_for_status()
logger.info(f"Upstream API {url!r} is healthy")
return
except httpx.ConnectError as e:
logger.warning(f"Upstream health check for {url!r} failed: {e}")
retry_in = min(retry_delay * (2**attempt), retry_delay_max)
logger.warning(
f"Upstream API {url!r} not healthy, retrying in {retry_in:.1f}s "
f"(attempt {attempt + 1}/{max_retries})"
)
await asyncio.sleep(retry_in)
raise RuntimeError(
f"Upstream API {url!r} failed to respond after {max_retries} attempts"
)

@pantierra
Copy link
Contributor Author

At least in Kubernetes, initContainers would allow to configure the waiting for the Stac API being up and running.

@batpad
Copy link
Member

batpad commented Nov 25, 2025

Seems like this just adds support to allow someone deploying this to add a custom init container? Seems good to me, if being able to configure that is useful, makes sense 👍

@batpad
Copy link
Member

batpad commented Nov 25, 2025

Hmm am seeing CI failures that seem unrelated to this commit. Not sure what's going on there.

@pantierra
Copy link
Contributor Author

Thanks for your reviews! Yes, the errors seemed unrelated to me, too. Can this be merged?

@alukach alukach changed the title Add support for initContainers. feat(helm): Add support for initContainers. Nov 25, 2025
@github-actions github-actions bot added the feat label Nov 25, 2025
@alukach
Copy link
Member

alukach commented Nov 25, 2025

@pantierra good to go now

@pantierra pantierra merged commit a7ca408 into main Nov 25, 2025
3 checks passed
@pantierra pantierra deleted the feature/add-initContainers branch November 25, 2025 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants