Skip to content

Commit

Permalink
ignore hostnetwork pod when initipam
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma committed Jan 10, 2022
1 parent 84ee33b commit 695f453
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/controller/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ func (c *Controller) InitIPAM() error {
return err
}
for _, pod := range pods {
if pod.Spec.HostNetwork {
continue
}
podNets, err := c.getPodKubeovnNets(pod)
if err != nil {
klog.Errorf("failed to get pod kubeovn nets %s.%s address %s: %v", pod.Name, pod.Namespace, pod.Annotations[util.IpAddressAnnotation], err)
Expand All @@ -322,9 +325,10 @@ func (c *Controller) InitIPAM() error {
if err != nil {
klog.Errorf("failed to init pod %s.%s address %s: %v", pod.Name, pod.Namespace, pod.Annotations[fmt.Sprintf(util.IpAddressAnnotationTemplate, podNet.ProviderName)], err)
}
}
if err = c.initAppendPodExternalIds(pod); err != nil {
klog.Errorf("failed to init append pod %s.%s externalIds: %v", pod.Name, pod.Namespace, err)

if err = c.initAppendPodExternalIds(pod); err != nil {
klog.Errorf("failed to init append pod %s.%s externalIds: %v", pod.Name, pod.Namespace, err)
}
}
}
}
Expand Down

0 comments on commit 695f453

Please sign in to comment.