This is not an officially supported Google product.
The MongoDb Event source adds support of MongoDb resources to Knative Eventing.
-
Install Knative Eventing in your Kubernetes Cluster.
-
Either:
-
Install MongoDb on your Kubernetes Cluster and create a Replica Set. Instructions available here.
-
Create a MongoDb Cluster on Atlas, through GCP for example. Link available here.
-
-
Install ko and then execute:
ko apply -f ./config
-
Create a secret containing the data needed to access your MongoDb service. For example:
apiVersion: v1 kind: Secret metadata: name: my-mongo-secret namespace: default stringData: URI: mongodb://USERNAME:PASSWORD@IP:PORT/USERDB
The URI is the connection string of your Mongo Database or Cluster. USERDB is the database your user account pertains to (can be
admin
). -
Create the
MongoDbSource
custom object, by configuring the requireddatabase
has to be provided, butcollection
is optional. For example, with a Knative Service as a sink:apiVersion: sources.google.com/v1alpha1 kind: MongoDbSource metadata: name: mongodb-example-source namespace: default spec: database: db1 collection: coll1 # optional secret: name: my-mongo-secret sink: ref: apiVersion: serving.knative.dev/v1 kind: Service name: event-display namespace: mongodb