Skip to content

Commit

Permalink
replace pod name when create ip crd
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma committed Apr 6, 2022
1 parent 8e65f6f commit 71e3f11
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,9 @@ func (c *Controller) handleAddPod(key string) error {
return err
}

if err := c.createOrUpdateCrdIPs(pod.Name, ipStr, mac, subnet.Name, pod.Namespace, pod.Spec.NodeName, podNet.ProviderName); err != nil {
klog.Errorf("failed to create IP %s.%s: %v", pod.Name, pod.Namespace, err)
podName := c.getNameByPod(pod)
if err := c.createOrUpdateCrdIPs(podName, ipStr, mac, subnet.Name, pod.Namespace, pod.Spec.NodeName, podNet.ProviderName); err != nil {
klog.Errorf("failed to create IP %s.%s: %v", podName, pod.Namespace, err)
}

if podNet.Type != providerTypeIPAM {
Expand Down Expand Up @@ -531,7 +532,6 @@ func (c *Controller) handleAddPod(key string) error {
}
}

podName := c.getNameByPod(pod)
portName := ovs.PodNameToPortName(podName, namespace, podNet.ProviderName)
if err := c.ovnClient.CreatePort(subnet.Name, portName, ipStr, mac, podName, pod.Namespace, portSecurity, securityGroupAnnotation, vips, podNet.AllowLiveMigration); err != nil {
c.recorder.Eventf(pod, v1.EventTypeWarning, "CreateOVNPortFailed", err.Error())
Expand Down

0 comments on commit 71e3f11

Please sign in to comment.