Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cathy-zhou committed Jun 22, 2020
1 parent 35497e2 commit b1931d6
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions go-controller/pkg/ovn/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/cni/types"
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config"
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/metrics"
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/ovn/ipallocator"
util "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/util"
kapi "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/wait"
Expand Down Expand Up @@ -272,13 +273,15 @@ func (oc *Controller) addLogicalPort(pod *kapi.Pod) error {
if podMac == nil || podIfAddrs == nil {
podMac, podIfAddrs, err = oc.assignPodAddresses(logicalSwitch)
if err != nil {
podRef, err := ref.GetReference(scheme.Scheme, pod)
if err != nil {
klog.Errorf("Couldn't make a ref to pod %s/%s: '%v'", pod.Namespace, pod.Name, err)
} else {
klog.V(5).Infof("Sending a IPRangeFull event for Pod %s in namespace %s.", pod.Name, pod.Namespace)
oc.recorder.Eventf(podRef, kapi.EventTypeWarning, "IPRangeFull",
"No IP address available for pod %s/%s", pod.Namespace, pod.Name)
if err == ipallocator.ErrFull {
podRef, err := ref.GetReference(scheme.Scheme, pod)
if err != nil {
klog.Errorf("Couldn't make a ref to pod %s/%s: '%v'", pod.Namespace, pod.Name, err)
} else {
klog.V(5).Infof("Sending a IPRangeFull event for Pod %s in namespace %s.", pod.Name, pod.Namespace)
oc.recorder.Eventf(podRef, kapi.EventTypeWarning, "IPRangeFull",
"No IP address available for pod %s/%s", pod.Namespace, pod.Name)
}
}
return fmt.Errorf("failed to assign pod addresses for pod %s on node: %s, err: %v",
portName, logicalSwitch, err)
Expand Down

0 comments on commit b1931d6

Please sign in to comment.