Configuring bucket notification in Multicloud Object Gateway
Learn how to configure bucket notifications in Multicloud Object Gateway (MCG).
Before you begin
- Ensure to have one of the following before configuring:
-
Kafka cluster is deployed.
For example, you can deploy Kafka by using
AMQ/strimzi
by referring to Getting Started with AMQ Streams on OpenShift. -
An HTTP or HTTPs server is connected.
For example, you can set up an HTTP server to log incoming HTTP requests so that you can observe them using theoc logs
command as follows:cat http_logging_server.yaml apiVersion: v1 kind: List metadata: {} items: - apiVersion: apps/v1 kind: Deployment metadata: name: http-logger spec: replicas: 1 selector: matchLabels: app: http-logger template: metadata: labels: app: http-logger spec: containers: - name: http-logger image: registry.redhat.io/ubi9/python-39:latest command: - /bin/sh - -c - | set -e # Fail on any error mkdir -p /tmp/app pip install flask cat <<EOF > /tmp/app/server.py from flask import Flask, request app = Flask(__name__) @app.route("/", methods=["POST", "GET"]) def log_request(): body = request.get_data(as_text=True) print(body) # Simple one-line logging per request return "", 200 if __name__ == "__main__": app.run(host="0.0.0.0", port=8676, debug=True) EOF exec python /tmp/app/server.py ports: - containerPort: 8676 protocol: TCP securityContext: runAsNonRoot: true allowPrivilegeEscalation: false - apiVersion: v1 kind: Service metadata: name: http-logger labels: app: http-logger spec: selector: app: http-logger ports: - port: 8676 targetPort: 8676 protocol: TCP name: http oc create -f http_logging_server.yaml -n <http-server-namespace>
-
- Make sure that server is accessible from the MCG core pod from which the notifications are sent.
- Ensure to fetch MCG’s
credentials:
NOOBAA_ACCESS_KEY=$(oc extract secret/noobaa-admin -n openshift-storage --keys=AWS_ACCESS_KEY_ID --to=- 2>/dev/null); \ NOOBAA_SECRET_KEY=$(oc extract secret/noobaa-admin -n openshift-storage --keys=AWS_SECRET_ACCESS_KEY --to=- 2>/dev/null); \ S3_ENDPOINT=https://$(oc get route s3 -n openshift-storage -o json | jq -r ".spec.host") alias aws_alias='AWS_ACCESS_KEY_ID=$NOOBAA_ACCESS_KEY AWS_SECRET_ACCESS_KEY=$NOOBAA_SECRET_KEY aws --endpoint $S3_ENDPOINT --no-verify-