Skip to content
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
7 changes: 7 additions & 0 deletions src/firecrest/status/health_check/health_checker_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
from lib.scheduler_clients.scheduler_base_client import SchedulerBaseClient
from authlib.integrations.httpx_client import AsyncOAuth2Client
from firecrest.plugins import settings
import ssl
import certifi
import os


class ClusterHealthChecker:
Expand All @@ -41,9 +44,13 @@ def __init__(self, cluster: HPCCluster, token_decoder: OIDCTokenAuth = None):

async def check(self) -> None:
try:
ctx = ssl.create_default_context(
cafile=os.environ.get("REQUESTS_CA_BUNDLE", certifi.where()),
)
client = AsyncOAuth2Client(
self.cluster.service_account.client_id,
self.cluster.service_account.secret.get_secret_value(),
verify=ctx,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we reduce the number of new imports by simplifying the change?
Would something like this work?

ca_bundle = os.environ.get("REQUESTS_CA_BUNDLE", None)
...
verify= ca_bundle if ca_bundle else True

)

token = await client.fetch_token(
Expand Down