cloud-provider-gcp
                                
                                 cloud-provider-gcp copied to clipboard
                                
                                    cloud-provider-gcp copied to clipboard
                            
                            
                            
                        Reuse shared informers in nodeipam and gkenetworkparamset controllers
For core K8s APIs, cloud-node, cloud-node-lifecycle, service and route controllers fetch informers from the completed config rather than from the controller context (e.g. here), so we basically mimic that behavior with this change.
This gives us two small performance gains:
- We deduplicate the API traffic by opening less watches from the CCM,
- Shared informers from the completed config use protobuf encoding instead of the (less efficient) JSON encoding.
- The fact that these informers use protobuf comes from the that CCM's config defaulting runs defaulting for generic CM config that runs defaulting for the client connection config that sets the content type to protobuf.
- That content type is passed to "kubeconfig" here and used for creating the client builder and the shared informers here.
- Apparently, we don't run analogous defaulting for the fields of controller context - but I didn't delve deeper into understanding that given we have simpler solution at hand here 🤷.
 
I didn't find an elegant way to dedupe NetworkInformer and GKENetworkParamSetInformer informers used by both of these controllers, though, so I left it out of this PR.