vitobotta / velero-notifications

A simple Kubernetes controller to receive Slack/email/webhook notifications for Velero backups
MIT License
28 stars 7 forks source link

authantication headers in webhook #4

Open TimTinneveld opened 1 year ago

TimTinneveld commented 1 year ago

Hi,

Is is possible to give like basic authenitcation in the headers for the webhook. we don't want to make the webhook available for everyone and a webhook seems to be a bit more straightforward then mailing.

Like to hear, thanks in advance.

vitobotta commented 1 year ago

Hi,

I think you can specify basic auth credentials in the format https://username:password@host.com. Have you tried?

TimTinneveld commented 11 months ago

Hi vitobotta,

Thank you for your reply. I found some time again to work on this project. i am able to successvoly deploy the pod.

2023-07-26T13:12:39.240322Z INFO - kube.transport: GET /api/v1 => HTTP OK in 00:00:00.002163620s 2023-07-26T13:12:39.243143Z INFO - kube.transport: GET /api/v1/namespaces/velero/configmaps/backups-last-resource-version => HTTP OK in 00:00:00.002418123s 2023-07-26T13:12:39.244663Z INFO - kube.transport: GET /apis/velero.io/v1 => HTTP OK in 00:00:00.001046933s 2023-07-26T13:12:39.254155Z INFO - kube.transport: GET /apis/velero.io/v1/namespaces/velero/backups => HTTP OK in 00:00:00.007153433s 2023-07-26T13:12:39.254165Z INFO - Resource version for backups: 17501581 2023-07-26T13:12:39.258936Z INFO - kube.transport: PATCH /api/v1/namespaces/velero/configmaps/backups-last-resource-version <NamedTuple(data: NamedTuple(resourceVersion: String))> => HTTP OK in 00:00:00.004520991s 2023-07-26T13:12:39.258941Z INFO - Watching backups from resource version 17501581 2023-07-26T13:13:04.420640Z INFO - Resource version for backups: 17501657 2023-07-26T13:13:04.435971Z INFO - kube.transport: PATCH /api/v1/namespaces/velero/configmaps/backups-last-resource-version <NamedTuple(data: NamedTuple(resourceVersion: String))> => HTTP OK in 00:00:00.013417878s 2023-07-26T13:13:04.435989Z INFO - Resource version for backups: 17501658 2023-07-26T13:13:04.439494Z INFO - kube.transport: PATCH /api/v1/namespaces/velero/configmaps/backups-last-resource-version <NamedTuple(data: NamedTuple(resourceVersion: String))> => HTTP OK in 00:00:00.002973762s 2023-07-26T13:13:21.405100Z INFO - Resource version for backups: 17501714 2023-07-26T13:13:21.409283Z INFO - kube.transport: PATCH /api/v1/namespaces/velero/configmaps/backups-last-resource-version <NamedTuple(data: NamedTuple(resourceVersion: String))> => HTTP OK in 00:00:00.003842359s 2023-07-26T13:13:21.733767Z INFO - [Velero] Backup test5 Completed ✅ 2023-07-26T13:13:22.241332Z INFO - Resource version for backups: 17501716 2023-07-26T13:13:22.251819Z INFO - kube.transport: PATCH /api/v1/namespaces/velero/configmaps/backups-last-resource-version <NamedTuple(data: NamedTuple(resourceVersion: String))> => HTTP OK in 00:00:00.009894310s

It also seems to detect whenever back-ups are succeeded, but it doesn't seem to send anything to the webhook address i have configured.

With postman it seems to work in this format "https://username:password@host.com". I also cannot see any logging trying to send http request to my webhook address.

Do you maybe have any idea. Thank you.

vitobotta commented 11 months ago

Does the endpoint expect GET or POST requests?

TimTinneveld commented 11 months ago

It expects a POST request. Is that something that can be defined?

vitobotta commented 11 months ago

Not at the moment, that's why I asked. At the moment it makes a GET request. I will make it configurable when I have time

TimTinneveld commented 10 months ago

Hi Vitobotta,

Did you find the time to make the adjustment?

Thanks in advanced.