Skip to content
Merged
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
5 changes: 4 additions & 1 deletion kubernetes_asyncio/dynamic/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from functools import partial
from typing import Dict

from aiohttp.client_exceptions import ContentTypeError
from urllib3.exceptions import MaxRetryError, ProtocolError

from kubernetes_asyncio import __version__
Expand Down Expand Up @@ -183,7 +184,9 @@ async def get_resources_for_api_version(self, prefix, group, version, preferred)
try:
response = await self.client.request('GET', path)
resources_response = response.resources or []
except ServiceUnavailableError:
except (ServiceUnavailableError, ContentTypeError):
Copy link
Owner

Choose a reason for hiding this comment

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

LGTM, thanks for your contribution

# Handle both service unavailable errors and content type errors
# (e.g., when server returns 503 with text/plain)
resources_response = []

resources_raw = list(filter(lambda r: '/' not in r['name'], resources_response))
Expand Down