Repository navigation
How to trace&debug Provider and Alert CRs? #6100
|
I'd like to make use of the GOTK notification API by implementing a generic webhook provider, so I deploy a HTTP endpoint (basic echo at the moment) and service and refer to it As can be seen, the service is up and running, the notification CRs don't throw any errors – but no POST request gets routed to the webhook service ever. How can I trace the flow of events in the notification subsystem to find out what's missing? |
Replies: 6 comments 5 replies
|
If you don't see any log at all in notification-controller about the event, the reason may be that source-controller did not actually send the event you were expecting. We unfortunately don't have a table with the events sent by each Flux CRD, so at the moment you will need to look at the gitrepository_controller.go file in source-controller to find when/why/which events will be sent for GitRepository objects. You can also increase the log verbosity in the controllers to see if it gives you more info. |
|
I turned up log level in all GOTK controllers to debug, but could not find any additional log entries on the Alert or Provider described above. no POST request is sent to my receiver. @matheuscscp is my understanding of the notification API correct in the sense that if I specify Providers/Alerts as given above, the notification controller should post events to my webhook service? |
|
The Alert/Provider resources themselves don't tell you much, the real signal is in notification-controller's logs. I tail them while forcing an event through: You'll see lines per dispatch attempt, including the HTTP status your webhook returned. If nothing shows up at all, the Alert isn't matching, so double check Your curl test is fine for verifying the echo endpoint is reachable from the cluster, but note flux sends its own event JSON payload, not arbitrary bodies. If your endpoint only echoes, you'll just see the event object come back, which is exactly what you want for now. — |
|
@Unveraenderbar Those source-controller records that Event, then separately POSTs a copy to its The same arg is patched onto kustomize-controller and helm-controller ( Stop grepping Reconcile
If the next reconcile prints |
|
Thanks a lot for the debugging help!! As far as I understand k8s NetworkPolicies, it might be that the resource deployed on Flux bootstrapping is too "narrow" and would need a section allowing connections from pods (vs. only allowing them only from "namespace-outside")... maybe a hint in the notification API on checking network policies if no events become visible might be helpful. |
|
@matheuscscp yes, that would be nic – but unfortunately, as soon the default ingress policy (or any egress policy that tries to narrow down the connectivity to notification controller towards webhook pod) is set for the notification controller, no events are routed to the generic webhook. I'm not sure whether / to which degree network policies are additive, might be the default resource deployed during Flux bootstrapping would have to be patched in order to enable the event flow to the webhook pod. |
I'm wondering if maybe the Flux NetworkPolicies are blocking the traffic from notification-controller to your HTTP server. Please try adding a NetworkPolicy to the flux-system namespace allowing this traffic flow. It could be that notification-controller is hanging on the TCP handshake due to the Flux NetworkPolicies, and never prints a log...