apiVersion: apps/v1
kind: Deployment
metadata:
  name: playfab-auth
  labels:
    app: playfab-auth
spec:
  replicas: 1
  selector:
      matchLabels:
        app: playfab-auth
  template:
    metadata:
      labels:
        app: playfab-auth
    spec:
      containers:
      - name: esp
        image: gcr.io/endpoints-release/endpoints-runtime:1.16.0
        args: [
          "--http_port=9001",
          "--http2_port=9000",
          "--service=playfab-auth.endpoints.{{your_google_project_name}}.cloud.goog",
          "--rollout_strategy=managed",
          "--backend=grpc://127.0.0.1:4040"
        ]
        ports:
          - containerPort: 9000
          - containerPort: 9001
      - name: playfab-auth
        image: gcr.io/{{your_google_project_name}}/playfab-auth
        imagePullPolicy: Always
        ports:
        - containerPort: 4040
          protocol: TCP
        - containerPort: 8080
          name: 'metrics'
          protocol: TCP
        env:
        - name: SPATIAL_REFRESH_TOKEN
          valueFrom:
            secretKeyRef:
              name: spatialos-refresh-token
              key: service-account.txt
        - name: SPATIAL_PROJECT
          valueFrom:
            configMapKeyRef:
              name: online-services-config
              key: spatialos.project
        - name: PLAYFAB_TITLE_ID
          valueFrom:
            configMapKeyRef:
              name: online-services-config
              key: playfab.title
        - name: PLAYFAB_SECRET_KEY
          valueFrom:
            secretKeyRef:
              name: playfab-secret-key
              key: playfab-secret.txt
        args:
        - --grpc_service_port
        - "4040"
        - --spatial_project
        - "$(SPATIAL_PROJECT)"
        - --playfab_title_id
        - "$(PLAYFAB_TITLE_ID)"
