apiVersion: apps/v1
kind: Deployment
metadata:
  name: server
spec:
  # how many empty replicasets should last
  revisionHistoryLimit: 2
  selector:
    matchLabels:
      run: server
  replicas: 1
  template:
    metadata:
      labels:
        run: server
    spec:
      terminationGracePeriodSeconds: 30
      containers:
        - name: server
          image: $(Build.Definitionname)
          imagePullPolicy: Always
          env:
            - name: CLIENT_TOKEN
              value: '$(CLIENT_TOKEN)'
            - name: WORKER_TOKEN
              value: '$(WORKER_TOKEN)'
            - name: SERVICE_ACCOUNT_KEY
              value: '$(SERVICE_ACCOUNT_KEY)'
            - name: MONGO_URL
              value: '$(MONGO_URL)'
            - name: MONGO_USERNAME
              value: '$(MONGO_USERNAME)'
            - name: MONGO_PASSWORD
              value: '$(MONGO_PASSWORD)'
            - name: MONGO_DATABASE
              value: '$(MONGO_DATABASE)'
            # This is so that k8s refetches latest image
            - name: RELEASE_ID
              value: '$(Release.DeploymentId)'
