pulumi / pulumi-kubernetes-operator

A Kubernetes Operator that automates the deployment of Pulumi Stacks
Apache License 2.0
220 stars 54 forks source link

Push flux events when using a flux source #573

Open nicu-da opened 5 months ago

nicu-da commented 5 months ago

Hello!

Issue details

Unless I'm missing something, there is no easy way to get notifications for when a stack CR is being updated, it has failed, it started reconciling actual differences, it has finished reconciling and so on.

I would've expected this is included in the flux source integration, and that events are published from the stack controller.

Affected area/feature

Flux integration

blampe commented 5 months ago

Hi @nicu-da, could you share a little more detail about what you'd like to see here?

The controller should already be emitting these events for the stack-controller. Are you seeing those?

Is the issue that you'd like the Flux notification-controller to more seamlessly pick these up? Or something else?

nicu-da commented 5 months ago

Hi @blampe

Thank you for the update. Indeed those events seem to be produced for the Stack but they are pure k8s events from what I can tell, and are missing the flux specific fields:

involvedObject the API version, kind, name and namespace of the Flux object
metadata.annotations the Flux specific metadata e.g. source revision
source.component the Flux controller name where the event originated from

The reasoning to have those fields present is that I expect that should allow for fluxcd alerts to be generated in this case, thus triggering slack notifications for stack events. In the current form, only the creation of a new artifact from the flux source triggers an alert, thus is pretty useless in actually understanding if the reconciliation was successful without checking logs/the stack state.

The only way I can think of to get notified about stack events currently is using something like https://github.com/kubeshop/botkube, but that adds one more layer, but please correct me if I'm wrong and there's an easier way to get real time notifications around the stack events.

cleverguy25 commented 2 months ago

Added to epic https://github.com/pulumi/pulumi-kubernetes-operator/issues/586