apiVersion: v1
kind: ServiceAccount
metadata:
  name: <<appenv>>tdb-tinyurl
  namespace: <<appenv>>tdb-tinyurl
---
apiVersion: v1
kind: Service
metadata:
  name: <<appenv>>tdb-tinyurl
  namespace: <<appenv>>tdb-tinyurl
  labels:
    app: <<appenv>>tdb-tinyurl
    service: <<appenv>>tdb-tinyurl
spec:
  ports:
    - port: 8080
      name: http-<<appenv>>tdb-tinyurl
  selector:
    app: <<appenv>>tdb-tinyurl
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: <<appenv>>tdb-tinyurl
  namespace: <<appenv>>tdb-tinyurl
spec:
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: <<appenv>>tdb-tinyurl
  template:
    metadata:
      name: <<appenv>>tdb-tinyurl
      labels:
        app: <<appenv>>tdb-tinyurl
    spec:
      serviceAccountName: <<appenv>>tdb-tinyurl
      containers:
        - name: tdb-tinyurl
          image: docker.adaoncloud.com/tdb/<<appenv>>tdb-tinyurl:<<imagetag>>
          volumeMounts:
            - name: kafkacerts
              mountPath: "/kafkacerts"
              readOnly: true
            - name: cassandracerts
              mountPath: "/cassandracerts"
              readOnly: true
          ports:
            - containerPort: 8080
          imagePullPolicy: Always
          env:
            - name: CASSANDRA_DC
              value: ada-dc1
            - name: CASSANDRA_KS
              value: tdb_tinyurl
            - name: CASSANDRA_HOST_URL
              value: cassandradb4.adaoncloud.com
            - name: CASSANDRA_HOST_PORT
              value: "9043"
            - name: CASSANDRA_USERNAME
              value: adaclient
            - name: CASSANDRA_PASSWORD
              value: bfVJEGMie3flYzB2liQVHVBcrQMlux47
            - name: KAFKA_CLIENTID
              value: tinyurl-app
            - name: KAFKA_SERVER
              value: "kafka-new.adaoncloud.com:9093"
            - name: KAFKA_GROUPID
              value: tinyurl-consumer
            - name: KAFKA_USERNAME
              value: "ada-tinyurl-user"
            - name: KAFKA_PASSWORD
              value: "thzfcsHSChdJ"
            - name: DEFAULT_DOMAIN
              value: adaon.eu
            - name: FSTLOGLEVEL
              value: info
      restartPolicy: Always
      imagePullSecrets:
        - name: ada-registry
      volumes:
        - name: kafkacerts
          secret:
            secretName: ada-tinyurl-user
            optional: false
        - name: cassandracerts
          secret:
            secretName: ada-dc1
            optional: false
