# 不能有数字，3306要用“”包起来
# https://blog.csdn.net/baobaoxiannv/article/details/104632769/
apiVersion: apps/v1
kind: Deployment
metadata:
  name: data-model-binlog-deployment
  labels:
    app: data-model-consume-binlog
spec:
  replicas: 1
  selector:
    matchLabels:
      app: data-model-consume-binlog
  template:
    metadata:
      labels:
        app: data-model-consume-binlog
    spec:
      containers:
        - name: data-model-consume-binlog
          image: youwen21/project-data-model
          #imagePullPolicy: IfNotPresent
          imagePullPolicy: Always
          command: [ "/go/src/start_up" ]
          args: [
              "binlog-start",
              "-host=$(cmd_mysql_host)",
              "-port=$(cmd_mysql_port)",
              "-username=$(cmd_mysql_username)",
              "-password=$(cmd_mysql_password)",
              "-filter=$(cmd_filter)",
              "-server_id=$(cmd_server_id)"
          ]
          env:
            - name: DB_EVENT_PORT
              value: "3306"
            - name: DB_EVENT_HOST
              valueFrom:
                configMapKeyRef:
                  name: data-model-configmap
                  key: DB_EVENT_HOST
            - name: DB_EVENT_USERNAME
              valueFrom:
                configMapKeyRef:
                  name: data-model-configmap
                  key: DB_EVENT_USERNAME
            - name: DB_EVENT_PASSWORD
              valueFrom:
                configMapKeyRef:
                  name: data-model-configmap
                  key: DB_EVENT_PASSWORD
            - name: DB_EVENT_DATABASE
              valueFrom:
                configMapKeyRef:
                  name: data-model-configmap
                  key: DB_EVENT_DATABASE
            - name: DB_EVENT_CHARSET
              valueFrom:
                configMapKeyRef:
                  name: data-model-configmap
                  key: DB_EVENT_CHARSET
            - name: DB_EVENT_FILTER
              valueFrom:
                configMapKeyRef:
                  name: data-model-configmap
                  key: DB_EVENT_FILTER

            - name: cmd_mysql_host
              valueFrom:
                configMapKeyRef:
                  name: pdm-codeper-mysql-configmap
                  key: DB_HOST
            - name: cmd_mysql_port
              valueFrom:
                configMapKeyRef:
                  name: pdm-codeper-mysql-configmap
                  key: DB_PORT
            - name: cmd_mysql_username
              valueFrom:
                configMapKeyRef:
                  name: pdm-codeper-mysql-configmap
                  key: DB_USERNAME
            - name: cmd_mysql_password
              valueFrom:
                configMapKeyRef:
                  name: pdm-codeper-mysql-configmap
                  key: DB_PASSWORD
            - name: cmd_filter
              valueFrom:
                configMapKeyRef:
                  name: pdm-codeper-mysql-configmap
                  key: DB_FILTER
            - name: cmd_server_id
              valueFrom:
                configMapKeyRef:
                  name: pdm-codeper-mysql-configmap
                  key: DB_SERVER_ID