Ensuring passing context across fission (#2555)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -39,7 +39,7 @@ func Start(ctx context.Context, logger *zap.Logger, routerUrl string) error {
|
||||
|
||||
poster := publisher.MakeWebhookPublisher(logger, routerUrl)
|
||||
kubeWatch := MakeKubeWatcher(ctx, logger, kubeClient, poster)
|
||||
MakeWatchSync(logger, fissionClient, kubeWatch)
|
||||
MakeWatchSync(ctx, logger, fissionClient, kubeWatch)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -34,20 +34,20 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func MakeWatchSync(logger *zap.Logger, client versioned.Interface, kubeWatcher *KubeWatcher) *WatchSync {
|
||||
func MakeWatchSync(ctx context.Context, logger *zap.Logger, client versioned.Interface, kubeWatcher *KubeWatcher) *WatchSync {
|
||||
ws := &WatchSync{
|
||||
logger: logger.Named("watch_sync"),
|
||||
client: client,
|
||||
kubeWatcher: kubeWatcher,
|
||||
}
|
||||
go ws.syncSvc()
|
||||
go ws.syncSvc(ctx)
|
||||
return ws
|
||||
}
|
||||
|
||||
func (ws *WatchSync) syncSvc() {
|
||||
func (ws *WatchSync) syncSvc(ctx context.Context) {
|
||||
// TODO watch instead of polling
|
||||
for {
|
||||
watches, err := ws.client.CoreV1().KubernetesWatchTriggers(metav1.NamespaceAll).List(context.TODO(), metav1.ListOptions{})
|
||||
watches, err := ws.client.CoreV1().KubernetesWatchTriggers(metav1.NamespaceAll).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
ws.logger.Fatal("failed to get Kubernetes watch trigger list", zap.Error(err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user