apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaConnect
metadata:
  name: freeleaps-prod-mongo-cds
  namespace: freeleaps-data-platform
  annotations:
    strimzi.io/use-connector-resources: "true"
spec:
  version: 4.0.0
  bootstrapServers: freeleaps-kafka-cluster-kafka-bootstrap.freeleaps-data-platform.svc.freeleaps.cluster:9093
  config:
    config.storage.topic: freeleaps-prod-mongo-cds-configs
    config.storage.replication.factor: -1
    group.id: freeleaps-prod-mongo-cds
    offset.storage.topic: freeleaps-prod-mongo-cds-offsets
    offset.storage.replication.factor: -1
    status.storage.topic: freeleaps-prod-mongo-cds-status
    status.storage.replication.factor: -1
  image: freeleaps/kafka-connectors:mongo-connector
  replicas: 1
  authentication:
    type: scram-sha-512
    username: freeleaps-user
    passwordSecret:
      secretName: freeleaps-user
      password: password
  tls:
    trustedCertificates:
      - secretName: freeleaps-kafka-cluster-cluster-ca-cert
        pattern: "*.crt"
---
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaConnector
metadata:
  name: freeleaps-prod-mongo-cds
  namespace: freeleaps-data-platform
  labels:
    strimzi.io/cluster: freeleaps-prod-mongo-cds
spec:
  class: com.mongodb.kafka.connect.MongoSourceConnector
  config:
    connection.uri: mongodb+srv://freeadmin:0eMV0bt8oyaknA0m@freeleaps2.zmsmpos.mongodb.net/?retryWrites=true&w=majority
    database: freeleaps2
    pipeline: '[{"$match": {"operationType": {"$in": ["insert", "update", "delete", "replace"]}}}]'
    # we need full document from cdc stream
    change.stream.full.document: "whenAvailable"
    # also we need full document before change
    change.stream.full.document.before.change: "whenAvailable"
    startup.mode: copy_existing
    startup.mode.copy.existing.pipeline: "[]"
    topic.prefix: raw-cds-events
  tasksMax: 1
