k8snetworkplumbingwg / multus-cni

A CNI meta-plugin for multi-homed pods in Kubernetes
Apache License 2.0
2.29k stars 575 forks source link

supplement log with stringified version of StdinData to enhance debug #1215

Closed DennisPeriquet closed 6 months ago

DennisPeriquet commented 6 months ago

In a job like this, we a have failure log like the one below (note the StdinData:[123 34 98 ... 34 125]} []byte which, as-is, is not as helpful for debugging as it could be:

: [sig-network] pods should successfully create sandboxes by adding pod to network expand_less | 0s
-- | --
{  1 failures to create the sandbox  namespace/e2e-deployment-9011 node/ci-op-ggi2sw56-08da5-pvlps-worker-westus-ncbwh pod/webserver-556cc9d77-pbbkd hmsg/c8f1f77703 - 7.83 seconds after deletion - interesting/true reason/FailedCreatePodSandBox Failed to create pod sandbox: rpc error: code = Unknown desc = failed to create pod network sandbox
 k8s_webserver-556cc9d77-pbbkd_e2e-deployment-9011_ee30da87-8670-4b7e-b59f-6936fafca599_0(16c0f727ca5ce4b8819ad519ec29b30145e116cf7d78aeacfe3f1128546d1267): error adding pod e2e-deployment-9011_webserver-556cc9d77-pbbkd to CNI network "multus-cni-network": plugin type="multus-shim" name="multus-cni-network" failed (add): CmdAdd (shim): CNI request failed with status 400:
 '&{ContainerID:16c0f727ca5ce4b8819ad519ec29b30145e116cf7d78aeacfe3f1128546d1267 Netns:/var/run/netns/c4864d9a-7928-4af9-b79d-6d4e206dee0e IfName:eth0 Args:IgnoreUnknown=1;K8S_POD_NAMESPACE=e2e-deployment-9011;K8S_POD_NAME=webserver-556cc9d77-pbbkd;K8S_POD_INFRA_CONTAINER_ID=16c0f727ca5ce4b8819ad519ec29b30145e116cf7d78aeacfe3f1128546d1267;K8S_POD_UID=ee30da87-8670-4b7e-b59f-6936fafca599 
Path: StdinData:[123 34 98 ... 34 125]} ContainerID:"16c0f727ca5ce4b8819ad519ec29b30145e116cf7d78aeacfe3f1128546d1267" Netns:"/var/run/netns/c4864d9a-7928-4af9-b79d-6d4e206dee0e" IfName:"eth0" Args:"IgnoreUnknown=1;K8S_POD_NAMESPACE=e2e-deployment-9011;K8S_POD_NAME=webserver-556cc9d77-pbbkd;K8S_POD_INFRA_CONTAINER_ID=16c0f727ca5ce4b8819ad519ec29b30145e116cf7d78aeacfe3f1128546d1267;K8S_POD_UID=ee30da87-8670-4b7e-b59f-6936fafca599" 
Path:"" ERRORED: error configuring pod [e2e-deployment-9011/webserver-556cc9d77-pbbkd] networking: Multus: [e2e-deployment-9011/webserver-556cc9d77-pbbkd/ee30da87-8670-4b7e-b59f-6936fafca599]: error waiting for pod: pods "webserver-556cc9d77-pbbkd" not found '}

This change supplements that byte slice with a stringified version which will help aid in debugging.

coveralls commented 6 months ago

Coverage Status

coverage: 63.688% (+0.3%) from 63.432% when pulling cad8c0913f319ccf9da9056fbd10ca9ed95d7353 on DennisPeriquet:supplment_log_for_stdindata into 6812ce0ed68cce1042ecad7b8e851fe1de226f78 on k8snetworkplumbingwg:master.