Skip to content

Commit

Permalink
add debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
cathy-zhou committed Oct 15, 2024
1 parent 3dc7eff commit fc796cc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions go-controller/pkg/ovn/pod_selector_port_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ func (bnc *BaseNetworkController) handleSharedPGPodSelectorAddFunc(podHandlerInf
}
// get info for new pods that are not listed in np.localPods
portNamesToUUIDs, policyPortUUIDs, errs := bnc.getNewLocalPolicyPorts(&podHandlerInfo.localPods, podHandlerInfo.portGroupName, objs...)
{
klog.Infof("Cathy handleSharedPGPodSelectorAddFunc portGroupKey %s podHandlerInfo %s returns portNamesToUUIDs %v policyPortUUIDs %v",
podHandlerInfo.key, podHandlerInfo.portGroupName, portNamesToUUIDs, policyPortUUIDs)
}
// for multiple objects, try to update the ones that were fetched successfully
// return error for errPods in the end
if len(portNamesToUUIDs) > 0 {
Expand All @@ -352,6 +356,10 @@ func (bnc *BaseNetworkController) handleSharedPGPodSelectorAddFunc(podHandlerInf
return fmt.Errorf("unable to get ops to add new pod to policy shared port group %s: %v", podHandlerInfo.portGroupName, err)
}
}
{
klog.Infof("Cathy handleSharedPGPodSelectorAddFunc add ports %v to portGroupKey %s portGroupName %s",
policyPortUUIDs, podHandlerInfo.key, podHandlerInfo.portGroupName)
}
// all operations were successful, update np.localPods
for portName, portUUID := range portNamesToUUIDs {
podHandlerInfo.localPods.Store(portName, portUUID)
Expand Down Expand Up @@ -383,13 +391,21 @@ func (bnc *BaseNetworkController) handleSharedPGPodSelectorDelFunc(podHandlerInf
if err != nil {
return err
}
{
klog.Infof("Cathy handleSharedPGPodSelectorDelFunc portGroupKey %s portGroupName %s returns portNamesToUUIDs %v policyPortUUIDs %v",
podHandlerInfo.key, podHandlerInfo.portGroupName, portNamesToUUIDs, policyPortUUIDs)
}

if len(portNamesToUUIDs) > 0 {
// del pods from shared pod selector port group
err := libovsdbops.DeletePortsFromPortGroup(bnc.nbClient, podHandlerInfo.portGroupName, policyPortUUIDs...)
if err != nil {
return fmt.Errorf("unable to delete ports from shared policy port group %s: %v", podHandlerInfo.portGroupName, err)
}
{
klog.Infof("Cathy handleSharedPGPodSelectorAddFunc delete ports %v from portGroupKey %s portGroupName %s",
policyPortUUIDs, podHandlerInfo.key, podHandlerInfo.portGroupName)
}
// all operations were successful, update np.localPods
for portName := range portNamesToUUIDs {
podHandlerInfo.localPods.Delete(portName)
Expand Down

0 comments on commit fc796cc

Please sign in to comment.