Search code examples
kuberneteskube-proxy

When a Kubernetes service is created, which one among these watchers is called first 'kube proxy' or 'a custom watcher'


I have a custom watcher as follows:

watchlist := cache.NewListWatchFromClient(client.Core().RESTClient(), "configmaps", KubeSystemNameSpace, fields.SelectorFromSet(fields.Set{"metadata.name": "test-map"}))
    resyncPeriod := 30 * time.Minute
//Setup an informer to call functions when the watchlist changes
_, controller = cache.NewInformer(
    watchlist,
    &v1.ConfigMap{},
    resyncPeriod,
    cache.ResourceEventHandlerFuncs{
        UpdateFunc: configMapUpdated,
    },
)

Kubernetes's kube-proxy also listens for service events using informers. Is it always guaranteed that kube-proxy's handler's are called before the custom watcher gets the call?


Solution

  • Is it always guaranteed that kube-proxy's handler's are called before the custom watcher gets the call?

    No, both kube-proxy and the custom watcher are treated as normal API clients, and there is no "happens before" guarantee as to which receives the service event first.