Bug 2028396

Summary: Neutron Ports assigned to Completed Pods are not reused Edit
Product: OpenShift Container Platform Reporter: Maysa Macedo <mdemaced>
Component: NetworkingAssignee: Maysa Macedo <mdemaced>
Networking sub component: kuryr QA Contact: Itay Matza <imatza>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high CC: imatza, mdulko, openshift-bugzilla-robot
Version: 4.8Keywords: Triaged
Target Milestone: ---   
Target Release: 4.7.z   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: 2022722
: 2041903 (view as bug list) Environment:
Last Closed: 2022-01-19 13:30:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 2022722    
Bug Blocks: 2041903    

Comment 3 Itay Matza 2021-12-20 12:18:24 UTC
Verified in OCP 4.7.0-0.nightly-2021-12-17-022306 with Kury on top of RHOS-16.1-RHEL-8-20211126.n.1.

Verification steps:

## When a pod is in 'Completed' state, the Neutron port assigned to it remains in 'Active' state:
>$ oc get pods -n openshift-kube-apiserver -o wide | grep "NAME\|" | head -n 2
>NAME                                      READY   STATUS      RESTARTS   AGE     IP              NODE                    NOMINATED NODE   READINESS GATES
>installer-2-ostest-dx9v5-master-1         0/1     Completed   0          3h29m   ostest-dx9v5-master-1   <none>           <none>

>$ openstack port list | grep "Name\|"
>| ID                                   | Name                                                 | MAC Address       | Fixed IP Addresses                                                                     | Status
>| 6def5893-b747-4504-b01b-3780af80549f |                                                      | fa:16:3e:d3:25:f2 | ip_address='', subnet_id='18cbf0eb-7bfa-4ade-94d6-7385bf5ae5d9'           | ACTIVE

## Ports are reassigned to a new Pod if the namespace and the node are the same as the 'Completed' Pod:
>$ oc get pods -n openshift-kube-apiserver -o wide | grep "NAME\|"
>NAME                                      READY   STATUS      RESTARTS   AGE     IP              NODE                    NOMINATED NODE   READINESS GATES                                                         
>demo-7897db69cc-mjfcl                     1/1     Running     0          5m55s   ostest-dx9v5-master-1   <none>           <none>                                                                  
>installer-2-ostest-dx9v5-master-1         0/1     Completed   0          3h41m   ostest-dx9v5-master-1   <none>           <none>                                                                  
>installer-5-ostest-dx9v5-master-1         0/1     Completed   0          3h29m   ostest-dx9v5-master-1   <none>           <none>                                                                  
>revision-pruner-2-ostest-dx9v5-master-1   0/1     Completed   0          3h40m   ostest-dx9v5-master-1   <none>           <none>                                                                  
>revision-pruner-5-ostest-dx9v5-master-1   0/1     Completed   0          3h25m   ostest-dx9v5-master-1   <none>           <none>                                                                  

## Verify in several different projects/namespaces - deploy new "demo" pods and make sure that ports of 'Completed' Pods are reassigned. Using the following sh:

completed_pods_addresses=$(oc get pods -A -o wide | grep Completed | awk '{print $7}' | grep -v "ago")
running_pods_addresses=$(oc get pods -A -o wide | grep Running | awk '{print $7}' | grep -v "ago")
openstack port list > osp_port_list
for completed_address in $completed_pods_addresses
        cat osp_port_list | grep $completed_address
        for running_address in $running_pods_addresses
                if [ "$completed_address" == "$running_address" ]
                        echo "Reused port found! The port with the following ip address - ${completed_address}."

Comment 6 errata-xmlrpc 2022-01-19 13:30:41 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.7.41 bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.