Skip to content

Commit e38c2a7

Browse files
Merge pull request #22684 from danwinship/more-sdn-startup
Continue improving SDN startup logging
2 parents d3855f5 + 02cece8 commit e38c2a7

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

pkg/network/node/node.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ func (node *OsdnNode) Start() error {
331331
}
332332

333333
if networkChanged && len(existingPods) > 0 {
334-
klog.Infof("OVS bridge has been recreated. Will reattach %d existing pods...", len(existingPods))
335334
err := node.reattachPods(existingPods)
336335
if err != nil {
337336
return err
@@ -382,7 +381,7 @@ func (node *OsdnNode) reattachPods(existingPods map[string]podNetworkInfo) error
382381
for sandboxID, podInfo := range existingPods {
383382
sandbox, ok := sandboxes[sandboxID]
384383
if !ok {
385-
klog.Warningf("Could not find sandbox for existing pod with IP %s; it may be in an inconsistent state", podInfo.ip)
384+
klog.V(5).Infof("Sandbox for pod with IP %s no longer exists", podInfo.ip)
386385
continue
387386
}
388387
if _, err := netlink.LinkByName(podInfo.vethName); err != nil {
@@ -400,6 +399,7 @@ func (node *OsdnNode) reattachPods(existingPods map[string]podNetworkInfo) error
400399
AssignedIP: podInfo.ip,
401400
Result: make(chan *cniserver.PodResult),
402401
}
402+
klog.Infof("Reattaching pod '%s/%s' to SDN", req.PodNamespace, req.PodName)
403403
// NB: we don't need to worry about locking here because the cniserver
404404
// isn't running for real yet.
405405
if _, err := node.podManager.handleCNIRequest(req); err != nil {
@@ -421,7 +421,7 @@ func (node *OsdnNode) killFailedPods(failed []*kruntimeapi.PodSandbox) {
421421
podRef := &corev1.ObjectReference{Kind: "Pod", Name: sandbox.Metadata.Name, Namespace: sandbox.Metadata.Namespace, UID: types.UID(sandbox.Metadata.Uid)}
422422
node.recorder.Eventf(podRef, corev1.EventTypeWarning, "NetworkFailed", "The pod's network interface has been lost and the pod will be stopped.")
423423

424-
klog.V(5).Infof("Killing pod '%s/%s' sandbox due to failed restart", podRef.Namespace, podRef.Name)
424+
klog.V(5).Infof("Killing pod '%s/%s' sandbox", podRef.Namespace, podRef.Name)
425425
if err := node.runtimeService.StopPodSandbox(sandbox.Id); err != nil {
426426
klog.Warningf("Failed to kill pod '%s/%s' sandbox: %v", podRef.Namespace, podRef.Name, err)
427427
}

pkg/network/node/runtime.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ func (node *OsdnNode) getPodSandboxes() (map[string]*kruntimeapi.PodSandbox, err
7070
return nil, err
7171
}
7272

73-
podSandboxList, err := runtimeService.ListPodSandbox(&kruntimeapi.PodSandboxFilter{})
73+
podSandboxList, err := runtimeService.ListPodSandbox(&kruntimeapi.PodSandboxFilter{
74+
State: &kruntimeapi.PodSandboxStateValue{State: kruntimeapi.PodSandboxState_SANDBOX_READY},
75+
})
7476
if err != nil {
7577
return nil, fmt.Errorf("failed to list pod sandboxes: %v", err)
7678
}

0 commit comments

Comments
 (0)