apiVersion: apps/v1
kind: Deployment
metadata:
  name: templatebot-aide
  labels:
    app: templatebot-aide
spec:
  selector:
    matchLabels:
      app: templatebot-aide
  template:
    metadata:
      labels:
        app: templatebot-aide
    spec:
      containers:
        - name: templatebot-aide-app
          env:
            - name: SLACK_TOKEN
              valueFrom:
                secretKeyRef:
                  name: templatebot-aide
                  key: SLACK_TOKEN
            - name: TEMPLATEBOT_GITHUB_TOKEN
              valueFrom:
                secretKeyRef:
                  name: templatebot-aide
                  key: TEMPLATEBOT_GITHUB_TOKEN
            - name: TEMPLATEBOT_GITHUB_USER
              valueFrom:
                secretKeyRef:
                  name: templatebot-aide
                  key: TEMPLATEBOT_GITHUB_USER
            - name: TEMPLATEBOT_LTD_AWS_ID
              valueFrom:
                secretKeyRef:
                  name: templatebot-aide
                  key: TEMPLATEBOT_LTD_AWS_ID
            - name: TEMPLATEBOT_LTD_AWS_SECRET
              valueFrom:
                secretKeyRef:
                  name: templatebot-aide
                  key: TEMPLATEBOT_LTD_AWS_SECRET
            - name: TEMPLATEBOT_LTD_USERNAME
              valueFrom:
                secretKeyRef:
                  name: templatebot-aide
                  key: TEMPLATEBOT_LTD_USERNAME
            - name: TEMPLATEBOT_LTD_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: templatebot-aide
                  key: TEMPLATEBOT_LTD_PASSWORD
            - name: TEMPLATEBOT_LTD_USERNAME_EMBED
              valueFrom:
                secretKeyRef:
                  name: templatebot-aide
                  key: TEMPLATEBOT_LTD_USERNAME_EMBED
            - name: TEMPLATEBOT_LTD_PASSWORD_EMBED
              valueFrom:
                secretKeyRef:
                  name: templatebot-aide
                  key: TEMPLATEBOT_LTD_PASSWORD_EMBED
            - name: TEMPLATEBOT_TRAVIS_TOKEN_COM
              valueFrom:
                secretKeyRef:
                  name: templatebot-aide
                  key: TEMPLATEBOT_TRAVIS_TOKEN_COM
            - name: TEMPLATEBOT_TRAVIS_TOKEN_ORG
              valueFrom:
                secretKeyRef:
                  name: templatebot-aide
                  key: TEMPLATEBOT_TRAVIS_TOKEN_ORG
          envFrom:
          - configMapRef:
              name: templatebot-aide
          volumeMounts:
            - name: "client-tls"
              mountPath: "/var/strimzi-client"
              readOnly: True
            - name: "broker-tls"
              mountPath: "/var/strimzi-broker"
              readOnly: True
      volumes:
        # Mount the TLS secret created by KafkaUser
        - name: "client-tls"
          secret:
            secretName: kafkauser-templatebot-aide
        - name: "broker-tls"
          secret:
            secretName: "events-cluster-ca-cert" # matches name of Strimzi cluster cluster CA cert secret
