cloudandheat / ch-k8s-lbaas

Flexible Loadbalancer-as-a-Service controller for Kubernetes
Apache License 2.0
9 stars 7 forks source link

`handleAuxUpdated` causes push of empty config on startup #45

Open ibot3 opened 1 year ago

ibot3 commented 1 year ago

The handleAuxUpdated function of the controller enqueues a UpdateConfigJob: https://github.com/cloudandheat/ch-k8s-lbaas/blob/84662aae22ccdcf1db35e41fb22e71867babfc2f/internal/controller/controller.go#L309-L313

The function is called by several informers, for example nodeInformer, endpointsInformer and networkPoliciesInformer.

The problem is that this causes the function to be called several times on startup which in turn creates UpdateConfigJobs. An UpdateConfigJob is therefore run before even one SyncServiceJob has been successfully executed. This results in an empty config to be pushed to the agent on startup.

Possible solutions:

ibot3 commented 1 year ago

I created a gist with the controller output log with additional log output for new enqueued jobs (job name + stacktrace): https://gist.github.com/ibot3/e60317fdd58eecbcaaf3a8f9d4676839

The SyncServiceJobs start in line 379.