##
#
#  Copyright 2021 EPAM System, Inc.
#
#     Licensed under the Apache License, Version 2.0 (the "License");
#     you may not use this file except in compliance with the License.
#     You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#     Unless required by applicable law or agreed to in writing, software
#     distributed under the License is distributed on an "AS IS" BASIS,
#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#     See the License for the specific language governing permissions and
#     limitations under the License.
#
##
apiVersion: batch/v1
kind: Job
metadata:
  generateName: "genie-agent-launcher-"
  labels:
    app: genie-agent-launcher
spec:
  template:
    spec:
      containers:
        - name: agent-launcher
          volumeMounts:
            - mountPath: /tmp/genie
              name: jobs-pv-storage
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: failure-domain.beta.kubernetes.io/zone
                    operator: In
                    values:
                      - us-east1-b
                      - us-east1-c
        podAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - topologyKey: failure-domain.beta.kubernetes.io/zone
              labelSelector:
                matchExpressions:
                  - key: app
                    operator: In
                    values:
                      - genie-web
      restartPolicy: Never
  backoffLimit: 1
  ttlSecondsAfterFinished: 100
