apiVersion: apps/v1
kind: Deployment
metadata:
  name: deployment-pool
  labels:
    app: deployment-pool
spec:
  replicas: 1
  selector:
      matchLabels:
        app: deployment-pool
  template:
    metadata:
      labels:
        app: deployment-pool
    spec:
      volumes:
      - name: pool-config
        projected:
          sources:
          - configMap:
              name: "snapshot"
          - configMap:
              name: "launch-config"
      - name: analytics-api-key
        secret:
          secretName: analytics-api-key
      - name: online-services-analytics-config
        configMap:
          name: online-services-analytics-config
      containers:
      - name: deployment-pool
        image: gcr.io/{{your_google_project_id}}/deployment-pool # Update
        imagePullPolicy: Always
        volumeMounts:
        - name: pool-config
          mountPath: /etc/pool
          readOnly: true
        - name: analytics-api-key
          mountPath: /secrets/
        - name: online-services-analytics-config
          mountPath: /config/
        ports:
        - containerPort: 8080
          name: 'metrics'
          protocol: TCP
        env:
        - name: SPATIAL_REFRESH_TOKEN
          valueFrom:
            secretKeyRef:
              name: spatialos-refresh-token
              key: service-account
        - name: SPATIAL_PROJECT
          valueFrom:
            configMapKeyRef:
              name: online-services-config
              key: spatialos.project
        args:
        # Deployment Pool Arguments
        - --launch-config
        - "/etc/pool/default_launch.json"
        - --snapshot
        - "/etc/pool/default.snapshot"
        - --minimum-ready-deployments
        - "3"
        - --match-type
        - "{{your_match_type}}" # Update to, for instance, `match` (which is the default setting of the sample-matcher)
        - --assembly-name
        - "{{your_assembly_name}}" # Update
        - --project
        - "$(SPATIAL_PROJECT)"
        # Analytics Instrumentation Arguments
        - --analytics.endpoint
        - "http://analytics-{{your_environment}}.endpoints.{{your_google_project_id}}.cloud.goog:80/v1/event" # Update
        - --analytics.allow-insecure-endpoint
        - --analytics.config-file-path
        - "/config/online-services-analytics-config"
        - --analytics.gcp-key-path
        - "/secrets/analytics-api-key"
        - --event.environment
        - "{{your_environment}}" # Update
        - --event.schema
        - "improbable"
      terminationGracePeriodSeconds: 300
