Bug 2224076

Summary: Newly added API endpoints for virtualmachineinstances broke openshift-restclient-python
Product: Container Native Virtualization (CNV) Reporter: Debarati Basu-Nag <dbasunag>
Component: VirtualizationAssignee: Debarati Basu-Nag <dbasunag>
Status: MODIFIED --- QA Contact: Kedar Bidarkar <kbidarka>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 4.15.0CC: aasserzo, acardace, acardena, gkapoor, kmajcher, myakove, ycui
Target Milestone: ---Keywords: TestBlocker
Target Release: 4.15.0Flags: dbasunag: needinfo? (acardena)
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Debarati Basu-Nag 2023-07-19 18:00:59 UTC
Description of problem: Four API endpoints were added recently: https://github.com/kubevirt/kubevirt/blame/9cf6dbb3e33c9ec9e9af8b18eb115c7fb9f7c311/pkg/virt-operator/resource/generate/rbac/cluster.go#L45-49. They broke openshift-restclient-python, which expects these end points to be of the format <a>/<b>
https://github.com/openshift/openshift-restclient-python/blob/master/openshift/dynamic/discovery.py#L133

This would block all test runs as we use openshift-restclient-python indirectly in cnv-tests for all api calls via openshift-python-wrapper.

Version-Release number of selected component (if applicable):
4.15.0

How reproducible:
100%

Steps to Reproduce:
1. https://main-jenkins-csb-cnvqe.apps.ocp-c1.prod.psi.redhat.com/view/cnv-tests%20runner/job/cnv-tests-runner-containerized/1599/console
2.
3.

Actual results:
12:15:59  INTERNALERROR>   File "/cnv-tests/.venv/lib/python3.9/site-packages/kubernetes/dynamic/discovery.py", line 269, in __search
12:15:59  INTERNALERROR>     resourcePart.resources = self.get_resources_for_api_version(
12:15:59  INTERNALERROR>   File "/cnv-tests/.venv/lib/python3.9/site-packages/openshift/dynamic/discovery.py", line 133, in get_resources_for_api_version
12:15:59  INTERNALERROR>     resource, name = subresource['name'].split('/')
12:15:59  INTERNALERROR> ValueError: too many values to unpack (expected 2)
=======================================
{'kind': '',
 'name': 'virtualmachineinstances/sev/fetchcertchain',
 'namespaced': True,
 'singularName': '',
 'verbs': None}, {'kind': '',
 'name': 'virtualmachineinstances/sev/querylaunchmeasurement',
 'namespaced': True,
 'singularName': '',
 'verbs': None}, {'kind': '',
 'name': 'virtualmachineinstances/sev/setupsession',
 'namespaced': True,
 'singularName': '',
 'verbs': None}, {'kind': '',
 'name': 'virtualmachineinstances/sev/injectlaunchsecret',
 'namespaced': True,
 'singularName': '',
 'verbs': None}

Expected results:


Additional info:
This would block all T2/smoke tests against 4.15.0

Comment 1 Kedar Bidarkar 2023-07-24 07:14:29 UTC
Assuming the version is a typo and updating it to 4.15.0

Comment 3 Antonio Cardace 2023-07-24 12:19:39 UTC
@dbasunag can the openshift-restclient-python be fixed instead? This looks like quite a hard limitation and would make the API weirder.

Is this just an implementation detail or is it mandated by OCP?

If you don't know the answer to these do you have a contact point?

Comment 7 Debarati Basu-Nag 2023-07-31 18:09:19 UTC
This is currently being addressed in https://github.com/openshift/openshift-restclient-python/pull/438 and https://github.com/kubernetes-client/python/pull/2095. Both are merged. With openshift-restclient-python 0.13.2, we are unblocked. I will wait for the release of kubernetes-client, to close it.