apiVersion: v1
kind: ServiceAccount
metadata:
  name: <<appenv>>tdb-tinyurl-connector
  namespace: <<appenv>>tdb-tinyurl
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
  namespace: <<appenv>>tdb-tinyurl
data:
  application.conf: |
    [
      {
        "url": "https://mobi.adaoncloud.com/openVA.php",
        "username": "@S>hF2waEpMwHZS!ih??9FEJ3",
        "password": "oZc<M#gvN4yNkRZC9*AF%92",
        "action": "tdbTinyUrl"
      }
    ]
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: <<appenv>>tdb-tinyurl-connector
  namespace: <<appenv>>tdb-tinyurl
spec:
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: <<appenv>>tdb-tinyurl-connector
  template:
    metadata:
      name: <<appenv>>tdb-tinyurl-connector
      labels:
        app: <<appenv>>tdb-tinyurl-connector
    spec:
      serviceAccountName: <<appenv>>tdb-tinyurl-connector
      containers:
        - name: tdb-tinyurl-connector
          image: docker.adaoncloud.com/tdb/<<appenv>>kafka-connector:<<imagetag>>
          imagePullPolicy: Always
          env:
            - name: KAFKA_CLIENTID
              value: "tinyurl-app"
            - name: KAFKA_SERVER
              value: "kafka-new.adaoncloud.com:9093"
            - name: KAFKA_GROUPID
              value: "tinyurl-consumer"
            - name: KAFKA_TOPICS
              value: '["ada-events"]'
            - name: KAFKA_USERNAME
              value: "ada-tinyurl-user"
            - name: KAFKA_PASSWORD
              value: "thzfcsHSChdJ"
            - name: NODE_ENV
              value: "prod"
            - name: ELABORATE_KEY
              value: "tdbTinyUrl"
          volumeMounts:
            - name: kafkacerts
              mountPath: "/kafkacerts"
              readOnly: true
            - name: config-volume
              mountPath: /appConfig
      restartPolicy: Always
      imagePullSecrets:
        - name: ada-registry
      volumes:
        - name: kafkacerts
          secret:
            secretName: ada-tinyurl-user
            optional: false
        - name: config-volume
          configMap:
            name: app-config
