k8snetworkplumbingwg / multus-cni

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

Recreate configs only if base files changed (thin_entrypoint) #1234

Closed pmtk closed 5 months ago

pmtk commented 5 months ago

Changes how new kubeconfig is created after CA/token change. Instead of always creating new file on disk and comparing it to existing, it will compare base files (ca.crt and token) and recreate kubeconfig only if they changed. Multus CNI config is now treated the same way - as base file the master cni config is used.

As a result thin_entrypoint will no longer create new kubeconfig and 00-multus on each iteration of the watch loop and only recreate them when underlying base files change.

This approach was chosen over using a fsnotify because it wasn't reliable watching /var/run/secrets/kubernetes.io/serviceaccount/ - it would just stop noticing changes to files, possible reason is underlying filesystem being tmpfs.

Closes https://github.com/k8snetworkplumbingwg/multus-cni/issues/1220

coveralls commented 5 months ago

Coverage Status

coverage: 63.051% (-0.05%) from 63.099% when pulling f6b8ae848526825894da695789e6349566fb9711 on pmtk:recreate-configs-on-file-change into ca5a4c9aa97c9ac89413ae378865091e4e7e5f97 on k8snetworkplumbingwg:master.

s1061123 commented 5 months ago

Looks good to me. Merged. Thanks @pmtk