Add check for annotation presence 05/68405/1
authorRitu Sood <ritu.sood@intel.com>
Fri, 30 Aug 2019 00:50:51 +0000 (17:50 -0700)
committerRitu Sood <ritu.sood@intel.com>
Fri, 30 Aug 2019 00:58:19 +0000 (17:58 -0700)
If annotation is found on pod then pod
is already processed, stop processing.
This is different from "Failed to add
ports" error.

Change-Id: I101df641c150e007146bc1aeda9c5b372be329ca
Signed-off-by: Ritu Sood <ritu.sood@intel.com>
internal/pkg/ovn/ovn.go
pkg/controller/pod/pod_controller.go

index 82fe837..12a4912 100644 (file)
@@ -72,11 +72,6 @@ func (oc *Controller) AddLogicalPorts(pod *kapi.Pod, ovnNetObjs []map[string]int
                return
        }
 
-       if _, ok := pod.Annotations[Ovn4nfvAnnotationTag]; ok {
-               log.V(1).Info("AddLogicalPorts : Pod annotation found")
-               return
-       }
-
        var ovnString, outStr string
        ovnString = "["
        var ns netInterface
index 8792985..23a847e 100644 (file)
@@ -167,6 +167,9 @@ func (r *ReconcilePod) addLogicalPorts(pod *corev1.Pod) error {
                if err != nil {
                        return err
                }
+                if _, ok := pod.Annotations[ovn.Ovn4nfvAnnotationTag]; ok {
+                       return fmt.Errorf("Pod annotation found")
+               }
                key, value := ovnCtl.AddLogicalPorts(pod, nfn.Interface)
                if len(key) > 0 {
                        return r.setPodAnnotation(pod, key, value)