apiVersion: v1
kind: ConfigMap
metadata:
  name: metricscollector-template
  namespace: kubeflow
data:
  defaultMetricsCollectorTemplate.yaml : |-
    apiVersion: batch/v1beta1
    kind: CronJob
    metadata:
      name: {{.WorkerID}}
      namespace: {{.NameSpace}}
    spec:
      schedule: "*/1 * * * *"
      successfulJobsHistoryLimit: 0
      failedJobsHistoryLimit: 1
      jobTemplate:
        spec:
          backoffLimit: 0
          template:
            spec:
              serviceAccountName: metrics-collector
              containers:
              - name: {{.WorkerID}}
                image: katib/metrics-collector
                command: ["./metricscollector"]
                args:
                - "-s"
                - "{{.StudyID}}"
                - "-t"
                - "{{.TrialID}}"
                - "-w"
                - "{{.WorkerID}}"
                - "-k"
                - "{{.WorkerKind}}"
                - "-n"
                - "{{.NameSpace}}"
                - "-m"
                - "{{.ManagerSerivce}}"
              restartPolicy: Never
