apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    run:  bank-cdc-source
  name:  bank-cdc-source
spec:
  replicas: 1
  selector:
    matchLabels:
      name:  bank-cdc-source
  template:
    metadata:
      labels:
        name:  bank-cdc-source
    spec:
      containers:
        - env:
            - name: spring.application.name
              value: "bank-cdc-source"
            - name: spring.data.gemfire.pool.locators
              valueFrom:
                configMapKeyRef:
                  name: gemfire1-config
                  key: locators
            - name: spring.datasource.url
              value: "jdbc:postgresql://postgres/postgres"
            - name: spring.datasource.username
              value: "postgres"
            - name: spring.datasource.password
              value: "CHANGEME"
            - name: cdc.source.rabbit.streamName
              value: "banking.bank.bankingBankStream"
            - name: cdc.source.schedule.cron
              value: "*/3 * * * * *"
            - name: cdc.source.jdbc.sqlSelectWithFrom
              value: |+
                select bank_id as id, bank_id, short_name,full_name,
                logo, website, bank_routings, update_ts
                from banks
            - name: cdc.source.jdbc.sqlSqlWhereClause
              value: "where bank_id > ? or update_ts > ?"
            - name: rabbitmq.streaming.uris
              value: "rabbitmq-stream://cdc:cdc@rabbitmq:5552/%2f"
            - name: cdc.source.jdbc.lastRowIdWherePosition
              value: "1"
            - name: cdc.source.jdbc.lastTimestampWherePosition
              value: "2"
            - name: cdc.source.jdbc.lastRowIdSelectColumnName
              value: "atm_id"
            - name: cdc.source.jdbc.cdcId
              value: "Atm"
            - name: cdc.source.jdbc.lastTimestampSelectColumnName
              value: "update_ts"
            - name: spring.rabbitmq.stream.host
              value: "rabbitmq"
            - name: rabbitmq.streaming.stream.maxAgeHours
              value: "7"
            - name: rabbitmq.streaming.stream.maxLengthGb
              value: "1"
            - name: rabbitmq.streaming.stream.maxSegmentSizeMb
              value: "500"
            - name: spring.rabbitmq.host
              value: "rabbitmq"
            - name: spring_rabbitmq_username
              value: "cdc"
            - name: spring.rabbitmq.password
              value: "cdc"
            - name: cdc.source.rabbit.contentType
              value: "application/json"
          image: cloudnativedata/jdbc-cdc-rabbitmq-source:0.0.1-SNAPSHOT
          name: bank-cdc-source
          imagePullPolicy: Always