Skip to content

Commit

Permalink
chore: refactor log
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Nov 2, 2020
1 parent 240cd80 commit 9d821bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pkg/daemon/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ func (c *Controller) runGateway() {
return
}
if !exists {
klog.Info("iptables rules not exist, recreate iptables rules")
klog.Infof("iptables rules %s not exist, recreate iptables rules", strings.Join(iptRule.Rule, " "))
if err := c.iptable.Insert(iptRule.Table, iptRule.Chain, 1, iptRule.Rule...); err != nil {
klog.Errorf("insert iptable rule %v failed, %+v", iptRule.Rule, err)
klog.Errorf("insert iptable rule %s failed, %+v", strings.Join(iptRule.Rule, " "), err)
return
}
}
Expand Down Expand Up @@ -296,7 +296,7 @@ func (c *Controller) appendMssRule() {
}

if !exists {
klog.Info("iptables rules not exist, append iptables rules")
klog.Infof("iptables rules %s not exist, append iptables rules", strings.Join(MssMangleRule.Rule, " "))
if err := c.iptable.Append(MssMangleRule.Table, MssMangleRule.Chain, MssMangleRule.Rule...); err != nil {
klog.Errorf("append iptable rule %v failed, %+v", MssMangleRule.Rule, err)
return
Expand Down
8 changes: 5 additions & 3 deletions pkg/daemon/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,11 @@ func (csh cniServerHandler) handleDel(req *restful.Request, resp *restful.Respon
return
}
// check if it's a sriov device
for _, container := range pod.Spec.Containers {
if _, ok := container.Resources.Requests[util.SRIOVResourceName]; ok {
podRequest.DeviceID = util.SRIOVResourceName
if pod != nil {
for _, container := range pod.Spec.Containers {
if _, ok := container.Resources.Requests[util.SRIOVResourceName]; ok {
podRequest.DeviceID = util.SRIOVResourceName
}
}
}

Expand Down

0 comments on commit 9d821bc

Please sign in to comment.