apiVersion: v1
kind: Service
metadata:
  name: tdb-oauth
  namespace: tdb-oauth
  labels:
    app: tdb-oauth
    service: tdb-oauth
spec:
  ports:
    - port: 8080
      name: http-tdb-oauth
  selector:
    app: tdb-oauth
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: tdb-oauth
  namespace: tdb-oauth
spec:
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: tdb-oauth
      version: v1
  template:
    metadata:
      name: tdb-oauth
      labels:
        app: tdb-oauth
        version: v1
    spec:
      containers:
        - name: tdb-oauth
          image: docker.adaoncloud.com/ada/tdb-oauth:<<imagetag>>
          imagePullPolicy: Always
          env:
            - name: REDIS_SENTINEL_HOST
              value: ada-redis.ada-redis.svc.cluster.local
            - name: REDIS_SENTINEL_PORT
              value: "26379"
            - name: REDIS_SENTINEL_NAME
              value: ada-master
            - name: REDIS_SENTINEL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: ada-redis
                  key: redis-password
                  optional: false
            - name: REDIS_SENTINEL_DB
              value: "13"
            - name: FSTLOGLEVEL
              value: warn
            - name: NODE_ENV
              value: prod
            - name: DEFAULT_PORT
              value: "8080"
            - name: MONGO_DB_URL
              value: mongodb://node1-2f76db0a4964324f.database.cloud.ovh.net
            - name: MONGO_DB_NAME
              value: tdbauth
            - name: MONGO_DB_USER
              value: tdb_oauth
            - name: MONGO_DB_PASS
              value: 98WLDdp7RNUTsSY3J0yo
            - name: REDIRECTS_URI
              value: '["https://mobi.adaoncloud.com"]'
            - name: ELASTIC_HOST
              value: "https://elastic.adaoncloud.com:9200"
            - name: ELASTIC_REJECTUNAUTHORIZED
              value: "true"
            - name: ELASTIC_USERNAME
              valueFrom:
                secretKeyRef:
                  name: tdb-logs-es-user-rw
                  key: username
                  optional: false
            - name: ELASTIC_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: tdb-logs-es-user-rw
                  key: password
                  optional: false
      restartPolicy: Always
      imagePullSecrets:
        - name: ada-registry
