apiVersion: v1
kind: Service
metadata:
  name: sta-ada-bo-gateway
  namespace: sta-ada-bo-gateway
  labels:
    app: sta-ada-bo-gateway
    service: sta-ada-bo-gateway
spec:
  ports:
    - port: 8080
      name: http-bo-gateway
  selector:
    app: sta-ada-bo-gateway
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sta-ada-bo-gateway
  namespace: sta-ada-bo-gateway
spec:
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: sta-ada-bo-gateway
      version: v1
  template:
    metadata:
      name: sta-ada-bo-gateway
      labels:
        app: sta-ada-bo-gateway
        version: v1
    spec:
      containers:
        - name: bo-gateway
          image: docker.adaoncloud.com/ada/sta-bo-gateway:<<imagetag>>
          imagePullPolicy: Always
          volumeMounts:
            - name: cassandracerts
              mountPath: "/cassandracerts"
              readOnly: true
          env:
            - name: CASSANDRA_DC
              value: sta-ada-dc1
            - name: CASSANDRA_KS
              value: ada_tracking
            - name: CASSANDRA_HOST_URL
              value: cassandradb4.sta-ada-cassandradb.svc.cluster.local
            - name: CASSANDRA_HOST_PORT
              value: "9042"
            - name: CASSANDRA_USERNAME
              valueFrom:
                secretKeyRef:
                  name: cassandra-adatracking
                  key: username
                  optional: false
            - name: CASSANDRA_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: cassandra-adatracking
                  key: password
                  optional: false
            - name: REDIS_SENTINEL_HOST
              value: ada-redis.sta-ada-redis.svc.cluster.local
            - name: REDIS_SENTINEL_PORT
              value: "26379"
            - name: REDIS_SENTINEL_NAME
              value: sta-ada-master
            - name: REDIS_SENTINEL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: ada-redis
                  key: redis-password
                  optional: false
            - name: REDIS_SENTINEL_DB
              value: "14"
            - name: ELASTIC_HOST
              value: "https://ada-elastic-es-http.sta-ada-elastic.svc.cluster.local:9200"
            - name: ELASTIC_REJECTUNAUTHORIZED
              value: "true"
            - name: ELASTIC_USERNAME
              valueFrom:
                secretKeyRef:
                  name: elastic-user-rw
                  key: username
                  optional: false
            - name: ELASTIC_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: elastic-user-rw
                  key: password
                  optional: false
            - name: ELASTIC_USERNAME_LOG
              valueFrom:
                secretKeyRef:
                  name: tdb-logs-es-user-rw
                  key: username
                  optional: false
            - name: ELASTIC_PASSWORD_LOG
              valueFrom:
                secretKeyRef:
                  name: tdb-logs-es-user-rw
                  key: password
                  optional: false
            - name: FSTLOGLEVEL
              value: info
            - name: NODE_ENV
              value: sta
            - name: DEFAULT_PORT
              value: "8080"
            - name: TDB_OAUTH_URL
              value: "http://sta-tdb-oauth.sta-tdb-oauth.svc.cluster.local:8080"
            - name: DEBUG_QUERY
              value: "false"
            - name: QUERY_CACHE_TTL
              value: "30"
            - name: ADA_GALLERY_BE_URL
              value: "http://sta-gallery-be.sta-gallery-be.svc.cluster.local"
            - name: ADA_BUILDER_BE_URL
              value: "http://sta-builder-be.sta-builder-be.svc.cluster.local"
      restartPolicy: Always
      imagePullSecrets:
        - name: ada-registry
      volumes:
        - name: cassandracerts
          secret:
            secretName: ada-dc1
            optional: false
