Skip to content

Commit 36c616b

Browse files
author
ejacques
committed
allow resource names >2 parts
Dynamic client discovery for resources with three part names, the processing fails. Allow for processing names with >2 parts. This was failing on an OpenShift environment with the resource 'virtualmachineinstances/sev/fetchcertchain'
1 parent 5e5de93 commit 36c616b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kubernetes_asyncio/dynamic/discovery.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ async def get_resources_for_api_version(self, prefix, group, version, preferred)
189189
resources_raw = list(filter(lambda r: '/' not in r['name'], resources_response))
190190
subresources_raw = list(filter(lambda r: '/' in r['name'], resources_response))
191191
for subresource in subresources_raw:
192-
resource, name = subresource['name'].split('/')
192+
# Handle resources with >2 parts in their name
193+
parts = subresource['name'].split('/')
194+
resource = parts[0]
195+
name = '/'.join(parts[1:])
193196
if not subresources.get(resource):
194197
subresources[resource] = {}
195198
subresources[resource][name] = subresource

0 commit comments

Comments
 (0)