apiVersion: v1
kind: ConfigMap
metadata:
  name: worker-template
  namespace: katib
data:
  cpuWorkerTemplate.yaml : |-
    apiVersion: batch/v1
    kind: Job
    metadata:
      name: {{.WorkerId}}
      namespace: katib
    spec:
      template:
        spec:
          containers:
          - name: {{.WorkerId}}
            image: katib/mxnet-mnist-example
            command:
            - "python"
            - "/mxnet/example/image-classification/train_mnist.py"
            - "--batch-size=64"
            {{- with .HyperParameters}}
            {{- range .}}
            - "{{.Name}}={{.Value}}"
            {{- end}}
            {{- end}}
          restartPolicy: Never
  gpuWorkerTemplate.yaml : |-
    apiVersion: batch/v1
    kind: Job
    metadata:
      name: {{.WorkerId}}
      namespace: katib
    spec:
      template:
        spec:
          containers:
          - name: {{.WorkerId}}
            image: katib/mxnet-mnist-example:gpu
            command:
            - "python"
            - "/mxnet/example/image-classification/train_mnist.py"
            - "--batch-size=64"
            {{- with .HyperParameters}}
            {{- range .}}
            - "{{.Name}}={{.Value}}"
            {{- end}}
            {{- end}}
            resources:
              limits:
                nvidia.com/gpu: 1
          restartPolicy: Never
