Commit Graph

105 Commits

Author SHA1 Message Date
Matheus Pimenta ae6cc4b4f6 Reduce logging repeated code in event server
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2023-06-12 14:26:59 +01:00
Hidde Beydals b7cccbee81 Prefix event key attributes with identifier
This to prevent collisions between different event attributes.

For example when first an event with revision `foo` is received
without a token, after which a token `foo` is received without a
revision.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-24 15:52:46 +02:00
Matheus Pimenta 8c11d8a19b Fix Alert .spec.eventMetadata behavior
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2023-05-24 11:27:27 +01:00
Matheus Pimenta 4e05bc8ee2 Include eventv1.MetaTokenKey on event rate limiting key calculation
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2023-05-24 11:30:14 +02:00
Hidde Beydals 49122b90b1
Merge pull request #517 from matheuscscp/fix-rate-limit
Fix revision discarded on event rate limiting key calculation
2023-05-17 09:33:50 +02:00
Matheus Pimenta a8af5647e8 Fix revision discarded on event rate limiting key calculation
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2023-05-11 20:10:38 +01:00
Matheus Pimenta e9d1fb3d86 Add event metadata field to Alert spec
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2023-05-11 18:14:49 +01:00
Stefan Prodan 13fe515890
Update dependencies
- github.com/Azure/azure-amqp-common-go/v4 v4.1.0
- github.com/Azure/azure-event-hubs-go/v3 v3.5.0
- github.com/fluxcd/pkg/runtime v0.35.0
- github.com/getsentry/sentry-go v0.20.0
- github.com/go-logr/logr v1.2.4
- github.com/google/go-github/v52 v52.0.0
- github.com/ktrysmt/go-bitbucket v0.9.56
- github.com/xanzy/go-gitlab v0.83.0
- golang.org/x/oauth2 v0.7.0
- sigs.k8s.io/controller-runtime v0.14.6

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-08 16:34:30 +03:00
Hidde Beydals 4effb1542d
Merge pull request #506 from aryan9600/indexing
index receivers using webhook path as key
2023-05-03 13:49:26 +02:00
Sanskar Jaiswal 00fab6693b
index receivers using webhook path as key
Use `.status.webhookPath` as a key to index Receivers. Use this key
while listing Receivers during the handling of a payload.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-03 16:32:38 +05:30
Matheus Pimenta 9b7a80942f Add InclusionList to Alert CRD
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
Co-authored-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-02 10:05:16 +01:00
Max Jonas Werner 75b1cc109f
Use GitRepository v1 as default version in receiver handler
v1 will be the default version in the upcoming version of n-c.

Signed-off-by: Max Jonas Werner <mail@makk.es>
2023-03-30 15:48:42 +02:00
Max Jonas Werner ec03bd20a3
Introduce v1 API and bump Receiver version to v1
This commit bumps the Receiver API version to v1 in preparation of
the Flux GitOps GA milestone
(https://fluxcd.io/roadmap/#flux-gitops-ga-q1-2023).

We are now actively maintaining two versions of the notification API
group in parallel: v1 which currently only holds the Receiver kind and
v1beta2 for all other kinds.

Since we haven't run into this situation before, I had to change the
way we expose the API docs in ./docs/api: The directory now has
sub-directories for each active API version. Therefore we need to
change our scripts in the website repository to take this change into
account so that we expose both API group version at
https://fluxcd.io/flux/components/notification/api/. This change is
implemented in https://github.com/fluxcd/website/pull/1427.

refs #436

Signed-off-by: Max Jonas Werner <mail@makk.es>
2023-03-30 15:40:54 +02:00
Somtochi Onyekwere 4fcde0026d add docs and log when no objects are found
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-03-20 22:20:54 +01:00
Raffael Sahli 57f62f400c
feat: support multi receiver by matchLabels
Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>
2023-03-20 08:11:30 +00:00
Hidde Beydals 7448a667a0
receiver: update default ImageRepository version
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-02-28 11:14:42 +01:00
Hidde Beydals fd86289062 Add digest metadata event key to ignore list
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-13 10:28:34 +01:00
Stefan Prodan d16588a193 Deprecate `Receiver.status.url` in favor of `.status.webhookPath`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-12-09 12:05:51 +00:00
Stefan Prodan 5fd17e6220 Refactor the Receiver URL generation
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-12-09 12:05:51 +00:00
Stefan Prodan 9f2d0e1a6c Generate unique commit status updates
Use the Provider cluster assigned UID to compose a unique commit status
ID to avoid name collisions when multiple clusters write to the same
repository.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-12-09 12:05:51 +00:00
Stefan Prodan 974a77da00 Refactor reconcilers and introduce v1beta2 API
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-12-09 11:03:53 +00:00
Sunny ac17d75bc3 receiver: Use new ServeMux
Use its own ServeMux.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-12-01 18:30:20 +05:30
Stefan Prodan 224b12a2b8 Refactor notifiers to use Event API v1beta1
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-11-22 11:00:25 +00:00
Somtochi Onyekwere 25eeaf46dd Add .spec.timeout to Provider
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-31 11:25:09 +01:00
Philip Laine 82253a9558 Fix context cancel defer
Signed-off-by: Philip Laine <philip.laine@gmail.com>
2022-08-26 18:02:47 +02:00
Somtochi Onyekwere 472858f7fb remove status
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-10 23:49:02 +01:00
Somtochi Onyekwere 55f3c6bf29 test validate func
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-10 23:46:32 +01:00
Somtochi Onyekwere db485228dd remove code for parsing github payload
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-10 21:19:22 +01:00
Philip Laine 2c69c847d3 Add context to Post function
Signed-off-by: Philip Laine <philip.laine@gmail.com>
2022-07-27 18:26:28 +02:00
Somtochi Onyekwere 9b8586e35d remove line overriding err
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-07-04 16:31:50 +01:00
Somtochi Onyekwere b5f67d4f59 use masktoken pkg for redacting token
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-07-04 16:15:10 +01:00
Soule BA 44f5b43a4c
Update flux types api versions
Signed-off-by: Soule BA <bah.soule@gmail.com>
2022-06-07 15:44:40 +02:00
Paulo Gomes a0dc84e36a
Small fixes
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-05-24 07:20:15 +01:00
Somtochi Onyekwere b30e2458d8 return actual error when regex.Compile fails
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-04-08 16:26:52 +01:00
Somtochi Onyekwere 6477e1500e return error on invalid UTF-8
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-04-08 15:09:18 +01:00
Stefan Prodan 89008fb775 Filter event metadata based on the object group
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-03-23 20:37:46 +01:00
Stefan Prodan 08182712b6
Cleanup metadata fields before alerting
Remove the checksum field from alerts metadata

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-03-21 12:38:06 +02:00
Filipe Sequeira c9040611e5 Add basic auth support to grafana provider
Signed-off-by: Filipe Sequeira <filipe@weave.works>
2022-02-21 12:37:38 +00:00
Filipe Sequeira 95cf1a699d add Proxy to SecretRef
Signed-off-by: Filipe Sequeira <filipe@weave.works>
Co-authored-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-02-18 11:41:01 +00:00
Somtochi Onyekwere ae5fbba16b Use PartialMetadata for annotating objects
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-02-17 11:02:20 +01:00
Somtochi Onyekwere 100e928546 Use metdataclient for getting labels for events
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-02-16 12:58:52 +01:00
Somtochi Onyekwere 519b6a5c5c Add LabelSelectors for Event Sources
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-02-10 11:09:39 +01:00
Stefan Prodan 44c08a2659
Allow disabling cross-namespace event sources
Introduce the flag `--no-cross-namespace-refs` (defaults to false) for allowing cluster admins to disable cross-namespace event sources for alerts.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-28 10:30:31 +02:00
Somtochi Onyekwere 1b0afc2c88 pass pointer to yaml.Unmarshal
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-01-26 14:59:32 +01:00
Moritz Schmitz von Hülst 3c7363234a Pass headers to generic provider through secretRef
Co-authored-by: Moritz Schmitz von H<C3><BC>lst <moritz@hauptstadtoffice.com>
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-01-26 12:39:02 +01:00
Stefan Prodan 6ffaef2a41
Update dependencies (fix CVE-2021-43565)
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-11 13:21:26 +02:00
Somtochi Onyekwere 19a0daa906 Use conditions helper in reconciler
Co-authored-by: Piaras Hoban <piaras@weave.works>
Co-authored-by: Hidde Beydals <hiddeco@users.noreply.github.com>
Co-authored-by: souleb <bah.soule@gmail.com>
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-11-01 14:20:12 +01:00
Ali AKCA 7ded18f850
chore: Drop deprecated io/ioutil
Signed-off-by: Ali AKCA <ali@akca.io>
2021-10-27 09:44:51 +02:00
Somtochi Onyekwere 996ee365c5 Create function for redacting logs
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-10-21 16:37:33 +01:00
Somtochi Onyekwere f5d4328cbe Use regex to find and replace token
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-10-21 11:51:49 +01:00