Fails to the functional test for a ControllerRevision

Bug #1910327 reported by Naoaki Horie
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tacker
Fix Released
Medium
Unassigned

Bug Description

The functional test for a ControllerRevision [1] is failed due to a "module 'kubernetes.client' has no attribute 'object" error.

[1] https://github.com/openstack/tacker/blob/master/tacker/tests/functional/vnflcm/test_kubernetes.py#L358-L392

The details of tacker logs are as follows.
```
Jan 05 06:53:25.363944 ubuntu-focal-limestone-regionone-0022391378 tacker-conductor[35808]: 2021-01-05 06:53:25.363 ERROR tacker.vnfm.infra_drivers.kubernetes.k8s.translate_outputs [req-70fc6e94-2d25-4fa9-9690-dc2d9812e73d nfv_user nfv] ControllerRevision create failure. Reason=module 'kubernetes.client' has no attribute 'object'
Jan 05 06:53:25.364704 ubuntu-focal-limestone-regionone-0022391378 tacker-conductor[35808]: 2021-01-05 06:53:25.364 ERROR tacker.vnflcm.vnflcm_driver [req-70fc6e94-2d25-4fa9-9690-dc2d9812e73d nfv_user nfv] Unable to instantiate vnf instance 1b56aa3e-1495-4bd4-a080-eda8ead2007f due to error : Failed to init resource.: tacker.common.exceptions.InitApiFalse: Failed to init resource.
Jan 05 06:53:25.366124 ubuntu-focal-limestone-regionone-0022391378 tacker-conductor[35808]: 2021-01-05 06:53:25.365 ERROR root [req-70fc6e94-2d25-4fa9-9690-dc2d9812e73d nfv_user nfv] Original exception being dropped: ['
Traceback (most recent call last):
  File "/opt/stack/tacker/tacker/vnfm/infra_drivers/kubernetes/k8s/translate_outputs.py", line 303, in get_k8s_objs_from_yaml
    k8s_obj[\'object\'] = self._create_k8s_object(
  File "/opt/stack/tacker/tacker/vnfm/infra_drivers/kubernetes/k8s/translate_outputs.py", line 283, in _create_k8s_object
    self._init_k8s_obj(k8s_obj, file_content_dict, must_param)
  File "/opt/stack/tacker/tacker/vnfm/infra_drivers/kubernetes/k8s/translate_outputs.py", line 452, in _init_k8s_obj
    rely_obj = eval(\'client.\' + obj_name + \'()\')
  File "<string>", line 1, in <module>
', "AttributeError: module 'kubernetes.client' has no attribute 'object'", '
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/stack/tacker/tacker/vnflcm/vnflcm_driver.py", line 341, in _instantiate_vnf
    instance_id = self._vnf_manager.invoke(
  File "/opt/stack/tacker/tacker/common/driver_manager.py", line 71, in invoke
    return getattr(driver, method_name)(**kwargs)
  File "/opt/stack/tacker/tacker/vnfm/infra_drivers/kubernetes/kubernetes_driver.py", line 1279, in instantiate_vnf
    k8s_objs = transformer.\\
  File "/opt/stack/tacker/tacker/vnfm/infra_drivers/kubernetes/k8s/translate_outputs.py", line 317, in get_k8s_objs_from_yaml
    raise exceptions.InitApiFalse(error=msg)
tacker.common.exceptions.InitApiFalse: Failed to init resource.
']: tacker.common.exceptions.VnfInstantiationFailed: Vnf instantiation failed for vnf 1b56aa3e-1495-4bd4-a080-eda8ead2007f, error: Failed to init resource.

```

Revision history for this message
Naoaki Horie (naoaki-horie) wrote :

This issue seems to have occurred due to used the Kubernetes Python Client v12.0.0.
As below, in V1ControllerRevision modules, a 'data' key for openapi_types is setting a 'RuntimeRawExtension' resource in v11.0.0, but it is setting a 'object' instead of 'RuntimeRawExtension' in v12.0.0.
The current tacker seems to be assumes that the kubernetes resource is set [1]. so, I think it was outputed "AttributeError: module 'kubernetes.client' has no attribute 'object'" in tacker-conductor.log.

* v11.0.0:
-----
    openapi_types = {
        'api_version': 'str',
        'data': 'RuntimeRawExtension', *
        'kind': 'str',
        'metadata': 'V1ObjectMeta',
        'revision': 'int'
    }
-----
https://github.com/kubernetes-client/python/blob/v11.0.0/kubernetes/client/models/v1_controller_revision.py

* v12.0.0:
-----
    openapi_types = {
        'api_version': 'str',
        'data': 'object', * The value changed
        'kind': 'str',
        'metadata': 'V1ObjectMeta',
        'revision': 'int'
    }
-----
https://github.com/kubernetes-client/python/blob/v12.0.0/kubernetes/client/models/v1_controller_revision.py

[1] https://github.com/openstack/tacker/blob/master/tacker/vnfm/infra_drivers/kubernetes/k8s/translate_outputs.py#L444

Yasufumi Ogawa (yasufum)
Changed in tacker:
importance: Undecided → Medium
Revision history for this message
Yasufumi Ogawa (yasufum) wrote :
Changed in tacker:
status: New → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to tacker (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/tacker/+/812625

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.