playbook 0.4.2

YAML driven Docker DevOps
Documentation
---
apiVersion: batch/v1
kind: Job
metadata:
  generateName: batch-{{ data.hotwings_task_id.Str }}-
  namespace: bluecheese
spec:
  ttlSecondsAfterFinished: 20
  template:
    metadata:
      name: bluecheese
    spec:
      volumes:
        - name: public-ro
          persistentVolumeClaim:
            claimName: public-ro-claim
        - name: current-ro
          persistentVolumeClaim:
            claimName: current-ro-claim-{{ data.hotwings_task_id.Str }}
      containers:
        - name: step
          image: {{ data.image.Str }}
          command: ['playbook']
          args: {{{ data.command_str.Str }}}
          imagePullPolicy: Always
          tty: true
          stdin: true
          env:
          - name: PYTHONUNBUFFERED
            value: "1"
          volumeMounts:
          - name: public-ro
            mountPath: /data/public-ro
            readOnly: true
          - name: current-ro
            mountPath: /home/{{ data.hotwings_user.Str }}/current-ro
            readOnly: true
          working_dir: /home/{{ data.hotwings_user.Str }}/current-ro
          resources:
            limits:
            {{~#if data.hotwings_nvidia.Bool}}
              nvidia.com/gpu: {{ data.hotwings_gpus.Int }}
            {{~else}}
              nvidia.com/gpu: 0
            {{~/if}}
      restartPolicy: Never
      nodeSelector:
        workset: gpu
  backoffLimit: 1
{{!-- # refs:
# https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/CoreV1Api.md
# https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/BatchV1Api.md
# https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Job.md
# https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1JobSpec.md
# https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1PodTemplateSpec.md
# https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1PodSpec.md
# https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Container.md
--}}