Missing required parameter in translate_outputs._create_k8s_object

Bug #1928153 reported by LiangLu
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tacker
Fix Released
Medium
LiangLu

Bug Description

While deploying CNF(deployment) using pod-affinity rules, a parameter error happened:

```
ERROR tacker.vnfm.infra_drivers.kubernetes.k8s.translate_outputs [^[[01;36mreq-99899eb8-47a8-4c4c-9798-0b289af754f1 ^[[00;36mnfv nfv_user] ^[[01;35mDeployment create failure. Reason=Invalid value for `topology_key`, must not be `None`^[[00m
ERROR tacker.vnflcm.vnflcm_driver [^[[01;36mreq-99899eb8-47a8-4c4c-9798-0b289af754f1 ^[[00;36mnfv nfv_user] ^[[01;35mUnable to instantiate vnf instance 3b45b920-0e77-4a64-9ca2-4f9d425014db due to error : Failed to init resource.^[[00m: tacker.common.exceptions.InitApiFalse: Failed to init resource.
```

This is caused by `topology_key` parameter is required while deploying deployment resource with pod affinity rule:
https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1PodAffinityTerm.md

in tacker/vnfm/infra_drivers/kubernetes/k8s/translate_outputs.py,
required parameters are defined in _create_k8s_object(), however it seems not cover pod affinity rule situation:

https://opendev.org/openstack/tacker/src/branch/master/tacker/vnfm/infra_drivers/kubernetes/k8s/translate_outputs.py#L168

Fix:

add `topology_key=""` to must_param

LiangLu (lianglu)
Changed in tacker:
assignee: nobody → LiangLu (lianglu)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tacker (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/tacker/+/791123

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

Reviewed: https://review.opendev.org/c/openstack/tacker/+/791123
Committed: https://opendev.org/openstack/tacker/commit/26a2b5fce201641b89ca3d7a432e23df779e5cf3
Submitter: "Zuul (22348)"
Branch: master

commit 26a2b5fce201641b89ca3d7a432e23df779e5cf3
Author: LiangLu <email address hidden>
Date: Thu May 13 17:26:56 2021 +0900

    Fix missing required parameter when k8s_obj init

    While deploying CNF(deployment) using pod-affinity rules, a
    parameter error happended because the topology_key is not
    assigned when initializing k8s object.

    This patch fixes this bug by adding the topology_key's default
    value into `must_param` in translate_outputs._create_k8s_object().
    At the same time, in order to deal with the recurrence of this
    kind of bug, we checked the required parameters of all resources
    in kubernetes again and added them to must_param.
        * Kubernetes version: from v1.18.20 to v1.21.1
        * Kubernetes-python-client version: v18.20.0

    The major changes from the "must_param" used in the previous
    Wallaby release of Tacker are probably as follows:

    RuntimeRawExtension
      The `data` parameter of `V1ControllerRevision`[1] in v11.0.0
      was `RuntimeRawExtension`[2], but the `RuntimeRawExtension` was
      not support for v12.0.0 or later. Therefore `V1ControllerRevision`
      in v18.20.0[3] it has been changed to` object` type.

    V1ServiceReference
      The `service` parameter of `V1APIServiceSpec`[4] in v11.0.0 was
      `V1ServiceReference`[5], but the `V1ServiceReference` was not
      support for v12.0.0 or later.
      Therefore `V1APIServiceSpec` in v18.20.0[6] it has been changed
      to `ApiregistrationV1ServiceReference`[7].

    V1LimitRangeItem
      The `type` parameter of `V1LimitRangeItem`[8] in v11.0.0 was
      optional type, but the parameter has changed to must param
      in v18.20.0[9].
      Therefore, the parameter should be added into `must_param`.

    [1] https://github.com/kubernetes-client/python/blob/v11.0.0/kubernetes/docs/V1ControllerRevision.md
    [2] https://github.com/kubernetes-client/python/blob/v11.0.0/kubernetes/docs/RuntimeRawExtension.md
    [3] https://github.com/kubernetes-client/python/blob/v18.20.0/kubernetes/docs/V1ControllerRevision.md
    [4] https://github.com/kubernetes-client/python/blob/v11.0.0/kubernetes/docs/V1APIServiceSpec.md
    [5] https://github.com/kubernetes-client/python/blob/v11.0.0/kubernetes/docs/V1ServiceReference.md
    [6] https://github.com/kubernetes-client/python/blob/v18.20.0/kubernetes/docs/V1APIServiceSpec.md
    [7] https://github.com/kubernetes-client/python/blob/v18.20.0/kubernetes/docs/ApiregistrationV1ServiceReference.md
    [8] https://github.com/kubernetes-client/python/blob/v11.0.0/kubernetes/docs/V1LimitRangeItem.md
    [9] https://github.com/kubernetes-client/python/blob/v18.20.0/kubernetes/docs/V1LimitRangeItem.md

    Closes-Bug: #1928153
    Closes-Bug: #1940602
    Change-Id: If77be98d0c4cec6f4c860ae84978f59772f9a6ee

Changed in tacker:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tacker 6.0.0.0rc1

This issue was fixed in the openstack/tacker 6.0.0.0rc1 release candidate.

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.