You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I have an issue with the notification controller that is, I believe, related to this #385 PR.
When the controller tries to dispatch the Kustomization I see the error in the notification-controller logs:
{"level":"error","ts":"2022-08-21T15:15:37.267Z","logger":"event-server","msg":"failed to send notification","reconciler kind":"Kustomization","name":"nginx-ingress","namespace":"flux-system","error":"could not list commit statuses: context canceled"}
As far as I see the client's request is not synchronous and it doesn't wait while the request is processed. So it cancels the context because the incoming request from the client (which is the kustomization controller) had been closed before the notification controller could get the result from GitHub API.
I've built my own version of the controller with the context.Background (for test purposes) instead of the ctx from the parent method and it works as expected.
statuses, _, err := g.Client.Repositories.ListStatuses(context.Background(), g.Owner, g.Repo, rev, opts)
if err != nil {
return fmt.Errorf("could not list commit statuses: %v", err)
}
if duplicateGithubStatus(statuses, status) {
return nil
}
_, _, err = g.Client.Repositories.CreateStatus(context.Background(), g.Owner, g.Repo, rev, status)
Other Flux controllers have configurable Timeouts which allows users to set it according to their needs.
I think the same could be beneficial here.
During the Bug Scrub we discussed about the possibility of having a flag to define Timeouts at the handleEvent() level. And potentially a CRD level Spec.Timeout for the providers. But it would be great to get the views of other maintainers on the matter.
Hello. I have an issue with the notification controller that is, I believe, related to this #385 PR.
When the controller tries to dispatch the Kustomization I see the error in the notification-controller logs:
As far as I see the client's request is not synchronous and it doesn't wait while the request is processed. So it cancels the context because the incoming request from the client (which is the kustomization controller) had been closed before the notification controller could get the result from GitHub API.
Here is the Alert definition:
The provider definition looks like:
The controller creates the context from the incoming parent's request context and passes it to the notifier.Post() method:
notification-controller/internal/server/event_handlers.go
Line 66 in cef6398
I've built my own version of the controller with the
context.Background
(for test purposes) instead of thectx
from the parent method and it works as expected.Instead of this.
notification-controller/internal/notifier/github.go
Lines 117 to 125 in cef6398
The text was updated successfully, but these errors were encountered: