Unverified Commit a3975fe1 authored by hzma's avatar hzma Committed by GitHub
Browse files

Merge pull request #1340 from kubeovn/update-pod

add check for pod update process
parents 7354d0c3 ffd5c844
Showing with 10 additions and 1 deletion
+10 -1
......@@ -44,11 +44,12 @@ func (c *Controller) inspectPod() error {
for _, lsp := range lsps {
if portName == lsp {
isLspExist = true
break
}
}
if !isLspExist {
delete(pod.Annotations, fmt.Sprintf(util.AllocatedAnnotationTemplate, podNet.ProviderName))
delete(pod.Annotations, util.RoutedAnnotation)
delete(pod.Annotations, fmt.Sprintf(util.RoutedAnnotationTemplate, podNet.ProviderName))
if _, err := c.config.KubeClient.CoreV1().Pods(pod.Namespace).Patch(context.Background(), pod.Name, types.JSONPatchType, generatePatchPayload(pod.Annotations, "replace"), metav1.PatchOptions{}, ""); err != nil {
klog.Errorf("patch pod %s/%s failed %v during inspection", pod.Name, pod.Namespace, err)
return err
......@@ -56,6 +57,14 @@ func (c *Controller) inspectPod() error {
klog.V(5).Infof("finish remove annotation for %s", portName)
c.addPodQueue.Add(fmt.Sprintf("%s/%s", pod.Namespace, pod.Name))
break
} else {
if pod.Annotations[fmt.Sprintf(util.AllocatedAnnotationTemplate, podNet.ProviderName)] == "true" && pod.Spec.NodeName != "" {
if pod.Annotations[fmt.Sprintf(util.RoutedAnnotationTemplate, podNet.ProviderName)] != "true" {
klog.V(5).Infof("enqueue update pod %s/%s", pod.Namespace, pod.Name)
c.updatePodQueue.Add(fmt.Sprintf("%s/%s", pod.Namespace, pod.Name))
break
}
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment