Thanks to visit codestin.com
Credit goes to github.com

Skip to content

get_resources_for_api_version() expects sub-resource names to be of the format a/b #2091

@dbasunag

Description

@dbasunag

What happened (please include outputs or screenshots):
get_resources_for_api_version() in https://github.com/kubernetes-client/python/blob/master/kubernetes/base/dynamic/discovery.py#L173, currently expects sub-resource names to be of the format a/b. This does not work with newly added apis in kubevirt which are of the format a/b/c. https://github.com/kubevirt/kubevirt/blame/9cf6dbb3e33c9ec9e9af8b18eb115c7fb9f7c311/pkg/virt-operator/resource/generate/rbac/cluster.go#L45-49

14:46:39  INTERNALERROR>   File "/cnv-tests/.venv/lib/python3.9/site-packages/kubernetes/dynamic/discovery.py", line 173, in get_resources_for_api_version
14:46:39  INTERNALERROR>     resource, name = subresource['name'].split('/')
14:46:39  INTERNALERROR> ValueError: too many values to unpack (expected 2)

What you expected to happen:
Are the sub-resource names supposed to be restricted to this a/b format because of any kubernetes or openshift restrictions? If not can we remove this restrictions?
How to reproduce it (as minimally and precisely as possible):
Check with any subresources with the format of virtualmachineinstances/sev/fetchcertchain
Anything else we need to know?:

Environment:

  • Kubernetes version (kubectl version): 1.27
  • OS (e.g., MacOS 10.13.6): linux
  • Python version (python --version): 3.9
  • Python client version (pip list | grep kubernetes): 26.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions