---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: auth-server
  labels:
    db: pgsql
spec:
  selector:
    matchLabels:
      name: auth-server
  template:
    metadata:
      labels:
        name: auth-server
    spec:
      containers:
      - name: auth-server
        image: gcr.io/pixie-oss/pixie-dev/cloud/auth_server_image
        ports:
        - containerPort: 50100
        readinessProbe:
          httpGet:
            scheme: HTTPS
            path: /healthz
            port: 50100
        livenessProbe:
          httpGet:
            scheme: HTTPS
            path: /healthz
            port: 50100
        envFrom:
        - configMapRef:
            name: pl-tls-config
        - configMapRef:
            name: pl-db-config
        - configMapRef:
            name: pl-domain-config
        - configMapRef:
            name: pl-support-access-config
        - configMapRef:
            name: pl-ory-service-config
        - configMapRef:
            name: pl-errors-config
            optional: true
        env:
        - name: PL_JWT_SIGNING_KEY
          valueFrom:
            secretKeyRef:
              name: cloud-auth-secrets
              key: jwt-signing-key
        - name: PL_AUTH0_CLIENT_ID
          valueFrom:
            secretKeyRef:
              name: cloud-auth0-secrets
              key: auth0-client-id
              optional: true
        - name: PL_AUTH0_CLIENT_SECRET
          valueFrom:
            secretKeyRef:
              name: cloud-auth0-secrets
              key: auth0-client-secret
              optional: true
        - name: PL_PROFILE_SERVICE
          valueFrom:
            configMapKeyRef:
              name: pl-service-config
              key: PL_PROFILE_SERVICE
        - name: PL_PROJECT_MANAGER_SERVICE
          valueFrom:
            configMapKeyRef:
              name: pl-service-config
              key: PL_PROJECT_MANAGER_SERVICE
        - name: PL_DATABASE_KEY
          valueFrom:
            secretKeyRef:
              name: pl-db-secrets
              key: database-key
        - name: PL_POSTGRES_USERNAME
          valueFrom:
            secretKeyRef:
              name: pl-db-secrets
              key: PL_POSTGRES_USERNAME
        - name: PL_POSTGRES_PASSWORD
          valueFrom:
            secretKeyRef:
              name: pl-db-secrets
              key: PL_POSTGRES_PASSWORD
        - name: PL_OAUTH_PROVIDER
          valueFrom:
            configMapKeyRef:
              name: pl-oauth-config
              key: PL_OAUTH_PROVIDER
        - name: PL_HYDRA_CLIENT_ID
          valueFrom:
            configMapKeyRef:
              name: pl-oauth-config
              key: PL_AUTH_CLIENT_ID
        - name: PL_AUTH_URI
          valueFrom:
            configMapKeyRef:
              name: pl-oauth-config
              key: PL_AUTH_URI
        - name: PL_AUTH0_HOST
          value: https://$(PL_AUTH_URI)
        volumeMounts:
        - name: certs
          mountPath: /certs
      volumes:
      - name: certs
        secret:
          secretName: service-tls-certs
