Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bucket Notifications #8337

Merged
merged 7 commits into from
Oct 30, 2024
Merged

Bucket Notifications #8337

merged 7 commits into from
Oct 30, 2024

Conversation

alphaprinz
Copy link
Contributor

@alphaprinz alphaprinz commented Sep 9, 2024

Explain the changes

Add S3 notification support.
AWS info https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventNotifications.html

Limitations:
-No LifeCycle events.

Issues: Fixed #xxx / Gap #xxx

  1. Implement an s3 feature.

Testing Instructions:

-Run local Kafka with
docker run -p 9092:9092 apache/kafka-native:3.8.0
Connect cli consumer to Kafka:
./kafka/kafka_2.13-3.8.0/bin/kafka-console-consumer.sh --topic --from-beginning --bootstrap-server localhost:9092

  • Create a notification either by standard s3api put-bucket-notification-configuration.
    Alternatively, for nsfs, you can use nsfs_manage to add "notifications" field to bucket.

Example of an nsfs bucket with notifications:
aprinzse:noobaa-core$ cat bucket_notif_event.json
{
"name": "notif-both",
"owner": "amit1",
"path": "/home/aprinzse/work/standalone/storage_root/notif_both",
"notifications": [
{"Id": "notif_event_kafka", "Events": ["s3:ObjectCreated:"], "Connect": "/home/aprinzse/work/standalone/connect.kv"},
{"Id": "notif_event_http", "Events": ["s3:ObjectCreated:
"], "Connect": "/home/aprinzse/work/standalone/connect_http.kv"}
]
}

Where connect.kv for Kafka looks like-
aprinzse:noobaa-core$ cat /home/aprinzse/work/standalone/connect.kv
metadata.broker.list=localhost:9092
notification_protocol=kafka
topic=
name=kafka_notif

And for http:
aprinzse:noobaa-core$ cat /home/aprinzse/work/standalone/connect_http.kv
http_object={"host": "localhost", "port": 9999, "timeout": 100}
notification_protocol=http
name=http_notif

-Run NSFS server with NOTIFICATION_LOG_DIR env, eg
NOTIFICATION_LOG_DIR=/home/aprinzse/work/standalone/notifications_log node src/cmd/nsfs

-Kicking-off notification file processor to send notification with "notification" operation (also need the NOTIFICATION_LOG_DIR env param):
NOTIFICATION_LOG_DIR=/home/aprinzse/work/standalone/notifications_log node src/cmd/manage_nsfs notification

  • Doc added/updated
  • Tests added - to follow in future PR

@alphaprinz alphaprinz force-pushed the notifications branch 2 times, most recently from 180b6fc to e3888e6 Compare September 9, 2024 17:28
@alphaprinz alphaprinz force-pushed the notifications branch 4 times, most recently from 7c2633e to e48b9c5 Compare September 16, 2024 22:52
@alphaprinz alphaprinz force-pushed the notifications branch 5 times, most recently from d09a342 to 47edd81 Compare October 4, 2024 19:40
@alphaprinz alphaprinz changed the title notifications | nsfs notifications Oct 4, 2024
@alphaprinz alphaprinz force-pushed the notifications branch 3 times, most recently from a090200 to 627dd18 Compare October 7, 2024 23:40
@@ -76,6 +79,11 @@ async function put_object(req, res) {
};
}
res.setHeader('ETag', `"${reply.etag}"`);

if (reply.seq) {
res.seq = reply.seq;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like seq is only returned in namespace_nb flows. This will not work for other namespaces

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right.
As we've discussed we can add a sequence to standalone, at the cost of adding a synchronized step to all s3 ops, so it's preferred for now to see if this is actually needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what about other namespaces (S3, Azure, FS) that are not in standalone?

@alphaprinz alphaprinz force-pushed the notifications branch 3 times, most recently from e81d8dd to cdcf436 Compare October 10, 2024 17:49
@alphaprinz alphaprinz marked this pull request as ready for review October 10, 2024 18:23
@nimrod-becker nimrod-becker changed the title notifications Bucket Notifications Oct 14, 2024
@alphaprinz alphaprinz force-pushed the notifications branch 3 times, most recently from fe4db12 to cb3a0c5 Compare October 15, 2024 21:32
@alphaprinz alphaprinz force-pushed the notifications branch 3 times, most recently from af9d0f6 to eb831a2 Compare October 22, 2024 17:00
Signed-off-by: Amit Prinz Setter <[email protected]>
Signed-off-by: Amit Prinz Setter <[email protected]>
Signed-off-by: Amit Prinz Setter <[email protected]>
…amespace for easier parsing)

Signed-off-by: Amit Prinz Setter <[email protected]>
1. Introduce OP_TO_EVENT, remove req.s3event
2. sequencer fallback to timestamp for non-noobaa nss

Signed-off-by: Amit Prinz Setter <[email protected]>
@alphaprinz alphaprinz merged commit 9dece0e into noobaa:master Oct 30, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants