apiVersion: v1
kind: Service
metadata:
  name: sta-tdb-oauth
  namespace: sta-tdb-oauth
  labels:
    app: sta-tdb-oauth
    service: sta-tdb-oauth
spec:
  ports:
    - port: 8080
      name: http-tdb-oauth
  selector:
    app: sta-tdb-oauth
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sta-tdb-oauth
  namespace: sta-tdb-oauth
spec:
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: sta-tdb-oauth
      version: v1
  template:
    metadata:
      name: sta-tdb-oauth
      labels:
        app: sta-tdb-oauth
        version: v1
    spec:
      containers:
        - name: tdb-oauth
          image: docker.adaoncloud.com/ada/sta-tdb-oauth:<<imagetag>>
          imagePullPolicy: Always
          env:
            - 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: "13"
            - name: FSTLOGLEVEL
              value: info
            - name: NODE_ENV
              value: sta
            - name: DEFAULT_PORT
              value: "8080"
            - name: ACCESS_TOKEN_LIFETIME
              value: "300"
            - name: MONGO_DB_URL
              value: mongodb://node1-2f76db0a4964324f.database.cloud.ovh.net
            - name: MONGO_DB_NAME
              value: sta_tdbauth
            - name: MONGO_DB_USER
              value: sta_tdb_oauth
            - name: MONGO_DB_PASS
              value: F3r86pdwBA1HnYMmjXt9
            - name: REDIRECTS_URI
              value: '["http://localhost:3019"]'
            - 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: 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
