Skip to content

Commit

Permalink
replace pod name when create ip crd (#1425)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma committed Apr 6, 2022
1 parent e7c69ba commit 87164cc
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 @@ -520,8 +520,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 @@ -554,7 +555,6 @@ func (c *Controller) handleAddPod(key string) error {
}
}

podName := c.getNameByPod(pod)
portName := ovs.PodNameToPortName(podName, namespace, podNet.ProviderName)
dhcpOptions := &ovs.DHCPOptionsUUIDs{
DHCPv4OptionsUUID: subnet.Status.DHCPv4OptionsUUID,
Expand Down

0 comments on commit 87164cc

Please sign in to comment.