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
4 changes: 3 additions & 1 deletion kubernetes/base/dynamic/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from collections import defaultdict
from abc import abstractmethod, abstractproperty

from json.decoder import JSONDecodeError
from urllib3.exceptions import ProtocolError, MaxRetryError

from kubernetes import __version__
Expand Down Expand Up @@ -164,7 +165,8 @@ def get_resources_for_api_version(self, prefix, group, version, preferred):
path = '/'.join(filter(None, [prefix, group, version]))
try:
resources_response = self.client.request('GET', path).resources or []
except ServiceUnavailableError:
except (ServiceUnavailableError, JSONDecodeError):
# Handle both service unavailable errors and JSON decode errors
resources_response = []

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