---
apiVersion: batch/v1
kind: Job
metadata:
  name: ${CONTEXT}
  labels:
    app: ${CONTEXT}
    git/branch: ${BRANCH_NAME}
    git/commit: ${COMMIT}
    gitlab/job: "${JOB_ID}"
spec:
  template:
    spec:
      containers:
        - image: ${IMAGE_NAME}:${IMAGE_TAG}
          name: ${CONTEXT}
          env:
            # - name: NODE_OPTIONS
            #   value: "--max_old_space_size=2048"
            - name: ELASTICSEARCH_URL
              valueFrom:
                secretKeyRef:
                  name: elasticsearch-cloud-data
                  key: url
            - name: ELASTICSEARCH_USER
              valueFrom:
                secretKeyRef:
                  name: elasticsearch-cloud-data
                  key: user
            - name: ELASTICSEARCH_PWD
              valueFrom:
                secretKeyRef:
                  name: elasticsearch-cloud-data
                  key: password
            - name: ES_INDEX_PREFIX
              value: "${ES_INDEX_PREFIX}"
          resources:
            requests:
              cpu: 5m
              memory: 100Mi
            limits:
              cpu: 300m
              memory: 2Gi
      restartPolicy: Never
