From: Ritu Sood Date: Fri, 30 Aug 2019 00:50:51 +0000 (-0700) Subject: Add check for annotation presence X-Git-Tag: v0.1.0~12 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=00a81d850fc144c2d43bcc0cf401d355ec7b712c;p=ovn4nfv-k8s-plugin.git Add check for annotation presence 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 --- diff --git a/internal/pkg/ovn/ovn.go b/internal/pkg/ovn/ovn.go index 82fe837..12a4912 100644 --- a/internal/pkg/ovn/ovn.go +++ b/internal/pkg/ovn/ovn.go @@ -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 diff --git a/pkg/controller/pod/pod_controller.go b/pkg/controller/pod/pod_controller.go index 8792985..23a847e 100644 --- a/pkg/controller/pod/pod_controller.go +++ b/pkg/controller/pod/pod_controller.go @@ -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)