apiVersion: debezium.io/v1alpha1
kind: DebeziumServer
metadata:
  name: {{ .Release.Name }}
spec:
  runtime:
    templates:
      pod:
        affinity:
          nodeAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
              nodeSelectorTerms:
                - matchExpressions:
                    - key: nodetype
                      operator: In
                      values:
                        - <redacted>
    metrics:
      jmxExporter:
        enabled: true
  image: quay.io/debezium/server:3.0.8.Final
  quarkus:
    config:
      log.console.json: false
      kubernetes-config.enabled: true
      kubernetes-config.secrets: debezium-secrets
  source:
    class: "io.debezium.connector.sqlserver.SqlServerConnector"
    config:
      tasks.max:
      offset.storage: io.debezium.storage.redis.offset.RedisOffsetBackingStore
      offset.storage.redis.address: {{ .Values.debezium_server.redis.address }}
      offset.storage.redis.auth.password: ${REDIS_PASSWORD}
      offset.storage.redis.ssl.enabled: true
      offset.storage.redis.wait.retry.enabled: true
      offset.storage.redis.wait.timeout.ms: 1000
      offset.storage.redis.key: {{ .Values.debezium_server.redis.key }}
      offset.flush.interval.ms: 1000
      database.trustServerCertificate: true
      database.hostname: {{ .Values.debezium_server.database.hostname }}
      database.port: {{ .Values.debezium_server.database.port }}
      {{- if (ne .Values.environment "production") }}
      database.instance: {{ .Values.debezium_server.database.instance }}
      {{- end }}
      database.user: {{ .Values.debezium_server.database.user }}
      database.password: ${DB_PASSWORD}
      database.names: {{ .Values.debezium_server.database.names }}
      table.include.list: {{ .Values.debezium_server.database.table.list }}
      snapshot.mode: no_data
      topic.prefix: <redacted>
      snapshot.locking.mode: none
      snapshot.isolation.mode: read_uncommitted
      schema.history.internal.store.only.captured.tables.ddl: true
      poll.interval.ms: 500
      max.iteration.transactions: 500
  sink:
    type: eventhubs
    config:
      connectionstring: ${EHUBS_CONNECTION_STRING}
      hubname: <redacted>
  format:
    value:
      type: json
      config:
        schemas.enable: false
  predicates:
    contacts:
      type: org.apache.kafka.connect.transforms.predicates.TopicNameMatches
      config:
        pattern: <redacted>
    contactEmails:
      type: org.apache.kafka.connect.transforms.predicates.TopicNameMatches
      config:
        pattern: <redacted>
    transactionalDataDocuments:
      type: org.apache.kafka.connect.transforms.predicates.TopicNameMatches
      config:
        pattern: <redacted>
  transforms:
    - config:
        partition.payload.fields: <redacted>
        partition.topic.num: 10
      predicate: <redacted>
      type: io.debezium.transforms.partitions.PartitionRouting
    - config:
        partition.payload.fields: <redacted>
        partition.topic.num: 10
      predicate: <redacted>
      type: io.debezium.transforms.partitions.PartitionRouting
    - config:
        partition.payload.fields: <redacted>
        partition.topic.num: 10
      predicate: <redacted>
      type: io.debezium.transforms.partitions.PartitionRouting
