You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The adapter will be an HTTP server and/or Kafka consumer running in a pod inside a k8s cluster, configured in noobaa as "bucketNotifications" connection (either as HTTP notifications, or Kafka notifications)
5
-
It will distribute the notifications received from NooBaa to individual triggers, according to the configuration specified by MCGOBCTrigger custom resources.
5
+
It will distribute the notifications received from NooBaa to individual triggers, according to the configuration specified by OBCSource custom resources.
6
6
The notifications to individual triggers will be sent as cloudevents via HTTP or Kafka
7
7
It will be implemented in go, using k8s client libraries, the cloudevents k8s libraries, aws s3 client library, https://github.com/IBM/sarama, and the operator sdk (https://sdk.operatorframework.io)
8
8
@@ -58,26 +58,23 @@ calls put-bucket-notification for a bucket, it uses these values so that NooBaa
58
58
knows where to deliver notifications (HTTP endpoint or Kafka topic, depending on
59
59
NOTIFICATIONS_MODE).
60
60
61
-
Internal MCG/NooBaa trigger CRD
62
-
-------------------------------
61
+
ObjectBucketSource CRD
62
+
----------------------------
63
63
64
-
an example CR from the MCGOBCTrigger:
64
+
an example CR from the ObjectBucketSource:
65
65
```
66
-
apiVersion: internal.functions.dev/v1alpha1
67
-
kind: MCGOBCTrigger
66
+
apiVersion: sources.functions.dev/v1alpha1
67
+
kind: ObjectBucketSource
68
68
metadata:
69
69
namespace: foobar
70
70
name: foo
71
71
spec:
72
-
obc:
72
+
objectBucketClaim:
73
73
name: foo-bucket
74
74
events:
75
75
- "s3:ObjectCreated:*"
76
-
triggers:
77
-
- uri: http://foo.foobar.svc.cluster.local
78
-
- uri: http://logger.foobar.svc.cluster.local
79
-
- kafka:
80
-
topic: foo-topic
76
+
sink:
77
+
uri: http://foo.foobar.svc.cluster.local
81
78
status:
82
79
conditions:
83
80
- type: OBCCredentialsAvailable
@@ -88,7 +85,25 @@ status:
88
85
status: "True"
89
86
```
90
87
91
-
Where "obc" is a reference to an ObjectBucketClaim (living in the same namespace as the MCGOBCTrigger), e.g.:
88
+
As an alternative, uri can point to a Kafka Topic:
89
+
```
90
+
apiVersion: sources.functions.dev/v1alpha1
91
+
kind: ObjectBucketSource
92
+
metadata:
93
+
namespace: foobar
94
+
name: foo
95
+
spec:
96
+
objectBucketClaim:
97
+
name: foo-bucket
98
+
events:
99
+
- "s3:ObjectCreated:*"
100
+
sink:
101
+
uri: kafka:foo-topic
102
+
status:
103
+
...
104
+
```
105
+
106
+
Where "objectBucketClaim" is a reference to an ObjectBucketClaim (living in the same namespace as the ObjectBucketSource), e.g.:
92
107
93
108
94
109
```
@@ -207,13 +222,13 @@ for each record, the dispatcher will match the bucket name and eventName and fin
207
222
(dropping the "s3:" prefix, and matching '*' at the end of the specified event name as meaning any suffix (like in this case, "ObjectCreated:Put" matching the specified "s3:ObjectCreated:*")
208
223
To each such trigger, it will send the list of records as a cloudevent (it will keep the same JSON structure of the original, including thje Records list, but will filter out records not matching the rules.)
209
224
210
-
Multiple MCGOBCTrigger resources for the same bucket
225
+
Multiple ObjectBucketSource resources for the same bucket
Copy file name to clipboardExpand all lines: README.md
+18-22Lines changed: 18 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,42 +1,39 @@
1
1
# MCG Adapter
2
2
3
-
A Kubernetes operator that receives S3 bucket notifications from NooBaa (Multicloud Object Gateway) and dispatches them as CloudEvents to configured trigger endpoints.
3
+
A Kubernetes operator that receives S3 bucket notifications from NooBaa (Multicloud Object Gateway) and dispatches them as CloudEvents to configured sink endpoints.
4
4
5
5
## Description
6
6
7
-
The MCG Adapter runs inside a Kubernetes cluster, registered as a `bucketNotifications` connection in NooBaa. It can receive notifications via HTTP (default) or by consuming from a Kafka topic. It watches `MCGOBCTrigger` custom resources to determine which S3 events from which buckets should be forwarded to which endpoints. When NooBaa delivers a notification, the adapter matches the event against all configured triggers and dispatches CloudEvents via HTTP or Kafka to the matching endpoints.
7
+
The MCG Adapter runs inside a Kubernetes cluster, registered as a `bucketNotifications` connection in NooBaa. It can receive notifications via HTTP (default) or by consuming from a Kafka topic. It watches `ObjectBucketSource` custom resources to determine which S3 events from which buckets should be forwarded to which endpoints. When NooBaa delivers a notification, the adapter matches the event against all configured sources and dispatches CloudEvents via HTTP or Kafka to the matching sinks.
8
8
9
-
## Custom Resource: MCGOBCTrigger
9
+
## Custom Resource: ObjectBucketSource
10
10
11
11
```yaml
12
-
apiVersion: internal.functions.dev/v1alpha1
13
-
kind: MCGOBCTrigger
12
+
apiVersion: sources.functions.dev/v1alpha1
13
+
kind: ObjectBucketSource
14
14
metadata:
15
15
namespace: foobar
16
16
name: foo
17
17
spec:
18
-
obc:
18
+
objectBucketClaim:
19
19
name: foo-bucket # ObjectBucketClaim in the same namespace
20
20
events:
21
21
- "s3:ObjectCreated:*"# S3 event types to subscribe to
22
-
triggers:
23
-
- uri: http://foo.foobar.svc.cluster.local
24
-
- uri: http://logger.foobar.svc.cluster.local
25
-
- kafka:
26
-
topic: foo-topic
22
+
sink:
23
+
uri: http://foo.foobar.svc.cluster.local
27
24
```
28
25
29
-
Triggers can target HTTP endpoints (via `uri`) or Kafka topics (via `kafka.topic`). A single trigger entry can specify either or both. The Kafka broker(s) to connect to are configured globally via the `KAFKA_BROKERS` environment variable.
26
+
The sink URI can be an HTTP endpoint or a Kafka topic reference (e.g.`kafka:foo-topic`). The Kafka broker(s) to connect to are configured globally via the `KAFKA_BROKERS` environment variable.
30
27
31
28
The controller manages three status conditions:
32
29
33
30
| Condition | Meaning |
34
31
|---|---|
35
-
| `OBCCredentialsAvailable` | The OBC’s ConfigMap and Secret exist with the expected keys |
32
+
| `OBCCredentialsAvailable` | The OBC's ConfigMap and Secret exist with the expected keys |
36
33
| `BucketNotificationSet` | The S3 bucket notification was configured in NooBaa |
37
34
| `TestEventReceived` | The test event sent by NooBaa after notification setup was received |
38
35
39
-
Multiple `MCGOBCTrigger` resources referencing the same OBC are merged into a single bucket notification configuration (union of event types). Each trigger only receives events matching its own subscription.
36
+
Multiple `ObjectBucketSource` resources referencing the same OBC are merged into a single bucket notification configuration (union of event types). Each source only receives events matching its own subscription.
40
37
41
38
## Getting Started
42
39
@@ -57,7 +54,7 @@ The adapter is configured via environment variables:
57
54
| `ADAPTER_TOPIC` | `mcg-adapter-connection/connect.json` | NooBaa connection secret reference used as TopicArn in put-bucket-notification calls |
58
55
| `ADAPTER_PORT` | `8888` | Port the notification HTTP server listens on (HTTP mode only) |
59
56
| `NOTIFICATIONS_MODE` | `http` | `http` or `kafka` — selects how the adapter receives NooBaa notifications |
60
-
| `KAFKA_BROKERS` | _(none)_ | Comma-separated list of Kafka broker addresses. Required for Kafka triggers and when `NOTIFICATIONS_MODE=kafka`. |
57
+
| `KAFKA_BROKERS` | _(none)_ | Comma-separated list of Kafka broker addresses. Required for Kafka sinks and when `NOTIFICATIONS_MODE=kafka`. |
61
58
| `KAFKA_SECRET` | _(none)_ | Name of a Kubernetes Secret (in the adapter's namespace) containing Kafka credentials. See `kafka-secret-format.md`. |
62
59
| `KAFKA_NOTIFICATIONS_TOPIC` | _(none)_ | Kafka topic to consume NooBaa notifications from. Required when `NOTIFICATIONS_MODE=kafka`. |
63
60
| `KAFKA_NOTIFICATIONS_GROUP_ID` | _(none)_ | Consumer group ID for consuming NooBaa notifications. Required when `NOTIFICATIONS_MODE=kafka`. |
@@ -86,20 +83,20 @@ EOF
86
83
87
84
```sh
88
85
existing_connections=$(oc get noobaa noobaa -n openshift-storage -o json \
0 commit comments