k8snetworkplumbingwg / multus-cni

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

Configuration writes should be atomic #1252

Open dougbtv opened 3 months ago

dougbtv commented 3 months ago

This change introduces a method atomicFileWrite(...) which writes to a temporary file and then renames it to avoid partial reads, e.g.

Mar 29 04:13:05 labkubedualhost-node-1 crio[33593]: time="2024-03-29 04:13:05.977398607+09:00" level=info msg="CNI monitoring event CREATE        \"/etc/cni/net.d/00-multus.conf\""
Mar 29 04:13:05 labkubedualhost-node-1 crio[33593]: time="2024-03-29 04:13:05.977767189+09:00" level=error msg="Error loading CNI config file /etc/cni/net.d/00-multus.conf: error parsing configuration: unexpected end of JSON input"
coveralls commented 3 months ago

Coverage Status

coverage: 62.8% (+0.02%) from 62.778% when pulling 5d0ff075a0faef5006907fbc62f67c780e60f94b on dougbtv:thick-atomic-config-write into 0fd3fa79191f9e570df74568cf0ea61b2cd12820 on k8snetworkplumbingwg:master.