1

I am trying to configure FluxCD in Kubernetes to send notifications to Microsfot Teams for reconciliation events.

I have followed the FluxCD "Setup Notifications" instructions. Everything is deployed as expected.

enter image description here

I am not receiving any alerts in Teams as expected when I edit a config (e.g. pod replicaCount) and run "flux reconcile ...". This is the error I am seeing in the Notification Controller

enter image description here

enter image description here

enter image description here

Here is the secret with the Microsoft Teams channel URL

enter image description here

Does anyone have any ideas to please share with me today. Thank you

Koman
  • 187
  • 1
  • 1
  • 12
  • Can you share the yaml (secrets redacted) to give a bit more clarity on the setup? – Nalum Apr 28 '22 at 12:09
  • I have edited the question and added the secret containing the Microsoft Teams URL. The URL is base64'd and in the format https://teams.microsoft.com/l/channel//General?groupId=&tenantId= Thank you – Koman Apr 29 '22 at 05:27
  • could you include the provider and alert yaml too please, that was more what I meant? – Nalum Apr 29 '22 at 08:55
  • Oh of course, sorry about that. Thank you. Added – Koman Apr 29 '22 at 09:00
  • these look right, could be a bug, have you reached out to the Flux maintainers or community in slack? – Nalum May 05 '22 at 13:27
  • So I asked a question to the Flux team and first thing that came up was I had not setup an incoming webhook on Teams using these instructions https://fluxcd.io/docs/components/notification/provider/#ms-teams. However, when I did this I then ended up with the following error: failed to initialize provider, error: invalid MS Teams webhook URL https://mycompany.webhook.office.com/webhookb2/edc0165a-6d60-4674-a173-3985bd2cdfa3@ce846fab-cc1c-465b-5432-18f07c9ac198/IncomingWebhook/cea31703336a4c201213226b4615dbcd/cfe4915g-54d9-456b-a238-8dc4727c8er0. I am now waiting for suggestions from them – Koman May 10 '22 at 05:33

1 Answers1

1

So, firstly, I had not created an incoming webhook in Microsoft Teams UI: https://fluxcd.io/docs/components/notification/provider/#ms-teams

Secondly, I asked a question to the Flux maintainers as @Nalum suggested and there was a follow-on issue with encoding the Teams URL correctly. I had a trailing newline character which caused the URL to be invalid as reported by the Provider. I was reciving the following error

enter image description here

To resolve this I had to use the -n switch on the echo command when base64'ing the Teams URL for the Secret in Kubernetes.

echo -n '<teams url>' | base64

My final Kubernetes config was as follows: enter image description here

enter image description here

enter image description here

A full breakdown of the investigation can be seen here: https://github.com/fluxcd/flux2/discussions/2719

Koman
  • 187
  • 1
  • 1
  • 12