diff --git a/pkg/monitor/agent.go b/pkg/monitor/agent.go index e89ae854a78..5452a2014fe 100644 --- a/pkg/monitor/agent.go +++ b/pkg/monitor/agent.go @@ -92,6 +92,6 @@ func (monitor *agentMonitor) getAgentCRD() (*v1beta1.AntreaAgentInfo, error) { func (monitor *agentMonitor) updateAgentCRD(partial bool) (*v1beta1.AntreaAgentInfo, error) { monitor.querier.GetAgentInfo(monitor.agentCRD, partial) monitor.agentCRD.APICABundle = monitor.apiCertData - klog.V(2).Infof("Updating agent monitoring CRD %+v, partial: %t", monitor.agentCRD, partial) + klog.V(2).InfoS("Updating agent monitoring CRD", "name", klog.KObj(monitor.agentCRD), "partial", partial) return monitor.client.CrdV1beta1().AntreaAgentInfos().Update(context.TODO(), monitor.agentCRD, metav1.UpdateOptions{}) } diff --git a/pkg/monitor/controller.go b/pkg/monitor/controller.go index 58243b7e39f..e15efa6b200 100644 --- a/pkg/monitor/controller.go +++ b/pkg/monitor/controller.go @@ -188,14 +188,14 @@ func (monitor *controllerMonitor) createControllerCRD(crdName string) (*v1beta1. controllerCRD := new(v1beta1.AntreaControllerInfo) controllerCRD.Name = crdName monitor.querier.GetControllerInfo(controllerCRD, false) - klog.V(2).Infof("Creating controller monitoring CRD %+v", controllerCRD) + klog.V(2).InfoS("Creating controller monitoring CRD", "name", klog.KObj(controllerCRD)) return monitor.client.CrdV1beta1().AntreaControllerInfos().Create(context.TODO(), controllerCRD, metav1.CreateOptions{}) } // updateControllerCRD updates the monitoring CRD. func (monitor *controllerMonitor) updateControllerCRD(partial bool) (*v1beta1.AntreaControllerInfo, error) { monitor.querier.GetControllerInfo(monitor.controllerCRD, partial) - klog.V(2).Infof("Updating controller monitoring CRD %+v, partial: %t", monitor.controllerCRD, partial) + klog.V(2).InfoS("Updating controller monitoring CRD", "name", klog.KObj(monitor.controllerCRD), "partial", partial) return monitor.client.CrdV1beta1().AntreaControllerInfos().Update(context.TODO(), monitor.controllerCRD, metav1.UpdateOptions{}) } diff --git a/pkg/ovs/openflow/ofctrl_bridge.go b/pkg/ovs/openflow/ofctrl_bridge.go index d98582e86f1..c0f6ede4daa 100644 --- a/pkg/ovs/openflow/ofctrl_bridge.go +++ b/pkg/ovs/openflow/ofctrl_bridge.go @@ -308,7 +308,13 @@ func (b *OFBridge) DumpTableStatus() []TableStatus { // PacketRcvd is a callback when a packetIn is received on ofctrl.OFSwitch. func (b *OFBridge) PacketRcvd(sw *ofctrl.OFSwitch, packet *ofctrl.PacketIn) { - klog.V(2).InfoS("Received packetIn", "packet", packet) + // Correspond to MessageStream.outbound log level. + if klog.V(7).Enabled() { + klog.InfoS("Received packetIn", "packet", packet) + } else { + klog.V(4).InfoS("Received packetIn") + } + if len(packet.UserData) == 0 { klog.Info("Received packetIn without packetIn category in userdata") return diff --git a/third_party/proxy/config/config.go b/third_party/proxy/config/config.go index c37107d582b..710f2276238 100644 --- a/third_party/proxy/config/config.go +++ b/third_party/proxy/config/config.go @@ -330,7 +330,7 @@ func (c *EndpointSliceConfig) handleAddEndpointSlice(obj interface{}) { return } for _, h := range c.eventHandlers { - klog.V(4).InfoS("Calling handler.OnEndpointSliceAdd", "endpointSlice", endpointSlice) + klog.V(4).InfoS("Calling handler.OnEndpointSliceAdd", "endpointSlice", klog.KObj(endpointSlice)) h.OnEndpointSliceAdd(endpointSlice) } } @@ -347,7 +347,7 @@ func (c *EndpointSliceConfig) handleUpdateEndpointSlice(oldObj, newObj interface return } for _, h := range c.eventHandlers { - klog.V(4).InfoS("Calling handler.OnEndpointSliceUpdate", "from", oldEndpointSlice, "to", newEndpointSlice) + klog.V(4).InfoS("Calling handler.OnEndpointSliceUpdate", "endpointSlice", klog.KObj(newEndpointSlice)) h.OnEndpointSliceUpdate(oldEndpointSlice, newEndpointSlice) } } @@ -366,7 +366,7 @@ func (c *EndpointSliceConfig) handleDeleteEndpointSlice(obj interface{}) { } } for _, h := range c.eventHandlers { - klog.V(4).InfoS("Calling handler.OnEndpointSliceDelete", "endpointSlice", endpointSlice) + klog.V(4).InfoS("Calling handler.OnEndpointSliceDelete", "endpointSlice", klog.KObj(endpointSlice)) h.OnEndpointSliceDelete(endpointSlice) } }