Avoid per-CR-instance loggers to fix reconcile-loop CPU overhead
get_cr_logger() created a dedicated logging.Logger per (namespace, name) CR instance via getChild(). These loggers are registered in the global logging.Logger.manager.loggerDict for the remaining process lifetime and are never cleaned up, so their number grows with the number of CR instances ever reconciled.
kubernetes_asyncio deep-copies its Configuration object on essentially
every API call, and Configuration.deepcopy always reassigns the
debug property, whose setter calls Logger.setLevel() on its internal
loggers. setLevel() clears the cache of every logger that has ever been
created in the process, not just its own. Combined with an ever-growing
per-CR logger population, this turned into an increasing CPU tax paid on
every single Kubernetes API call.
A CPU profile of the neutron-ovn operator daemon confirmed this: over 50% of sampled own-time was spent in logging._clear_cache, reached through kubernetes_asyncio's Configuration deepcopy inside the watch stream loop, which was suspected of slowing down drainage of the watcher task queue.
Replace the per-instance logger with a logging.LoggerAdapter wrapping a logger bounded by CR type (api_version/plural), which keeps per-instance context in log output without registering a new logger per instance.